From patchwork Fri Apr 28 19:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775123 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=gQZ6Cmxx; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q7MqN5jJyz23td for ; Sat, 29 Apr 2023 05:19:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1148685FD2; Fri, 28 Apr 2023 21:18:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gQZ6Cmxx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D897F86176; Fri, 28 Apr 2023 21:18:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 70F8E86044 for ; Fri, 28 Apr 2023 21:18:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7606ce9bfdeso13963139f.0 for ; Fri, 28 Apr 2023 12:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682709518; x=1685301518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/15PsBc5vgvGd/xJLUUcJikjqHGNN+RtE76TuiHIiqA=; b=gQZ6CmxxO0ALd42tdaz/D519qexRQ4TrO6gGebyk/ena8mn/V/11sz9hmMM2kgwhLb 0IE5deIWjk6MzCmvAAfZVkPnv+ScvJsJfqmJ1KItWYJZpKdfLG4muRohZ7IPryGbkaR+ nNT4wkrZ1XzkeRIKcyaMh8Cr4Q+1iyabsm6Gc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682709518; x=1685301518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/15PsBc5vgvGd/xJLUUcJikjqHGNN+RtE76TuiHIiqA=; b=bospn1B969vB4vtwNrDNYkRj+kj7QXtEfuTQ0bbr467T4TztwAhqnYqNiIQKkVybHm VEMFY7D73L1TBruZolR9gNWCcV/39vdir06qln9unZ94jhON8+T1yZK3P3UL5UzgeSVd c+PgMyNRrZMA0eRt1hJaVLHCEcVzAZzgBhvYHUOTw+PLAqvUuBwSiCngzecmxtj6PcOp 80MgKQajJs/tEcdQ+6RSY9KTKy1R39hQtPq34BOMst75O0As/5+RjXjrexlh1kRYtvke EK2A3PfVTa+sjRQJdQD3h/TPT7qOge32Glz5GAsjCuCUhr8VUSJHKQvMHvbgAPIoV2Im Qbaw== X-Gm-Message-State: AC+VfDxZa9SofMZMh8R2DSZglkn/zIHJSKC8u0Q24KzgrPLNfOgVVOeG +5BiFS+t+F+O79TUZ9M1S65zQyr7tip0hGcVbKY= X-Google-Smtp-Source: ACHHUZ6pJpgMFHSILgihobcoL1jH0zrYgLEsIK/Opt1Nwe3iRjebX/xUFx31/bITrJOVXjM+gwDuzQ== X-Received: by 2002:a6b:dc02:0:b0:760:ea3c:7ba4 with SMTP id s2-20020a6bdc02000000b00760ea3c7ba4mr4615638ioc.9.1682709517875; Fri, 28 Apr 2023 12:18:37 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:9261:21dc:edb:e426]) by smtp.gmail.com with ESMTPSA id l12-20020a0566380d8c00b0041407c67451sm1698811jaj.165.2023.04.28.12.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 12:18:37 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 06/18] bootstd: Allow storing the OS command line in the bootflow Date: Fri, 28 Apr 2023 13:18:06 -0600 Message-ID: <20230428191819.3070393-6-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230428191819.3070393-1-sjg@chromium.org> References: <20230428191819.3070393-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Some operating systems have a command line which can be adjusted before booting. Store this in the bootflow so it can be controlled within U-Boot. Fix up the example output while we are here, since there are a few new items. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bootflow.c | 6 ++++++ doc/usage/cmd/bootflow.rst | 5 ++++- include/bootflow.h | 2 ++ test/boot/bootflow.c | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/bootflow.c b/cmd/bootflow.c index aa06999e3db..59d1bdc25b7 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -324,6 +324,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, printf("Buffer: %lx\n", (ulong)map_to_sysmem(bflow->buf)); printf("Size: %x (%d bytes)\n", bflow->size, bflow->size); printf("OS: %s\n", bflow->os_name ? bflow->os_name : "(none)"); + printf("Cmdline: "); + if (bflow->cmdline) + puts(bflow->cmdline); + else + puts("(none)"); + putc('\n'); printf("Logo: %s\n", bflow->logo ? simple_xtoa((ulong)map_to_sysmem(bflow->logo)) : "(none)"); if (bflow->logo) { diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index cad09bbec9a..1e14fd05ad5 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -258,7 +258,6 @@ displayed and booted:: Name: mmc@7e202000.bootdev.part_2 Device: mmc@7e202000.bootdev Block dev: mmc@7e202000.blk - Sequence: 1 Method: distro State: ready Partition: 2 @@ -266,6 +265,10 @@ displayed and booted:: Filename: extlinux/extlinux.conf Buffer: 3db7ae88 Size: 232 (562 bytes) + OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) + Cmdline: (none) + Logo: (none) + FDT: Error: 0 U-Boot> bootflow boot ** Booting bootflow 'smsc95xx_eth.bootdev.0' diff --git a/include/bootflow.h b/include/bootflow.h index 018d021b810..e49f3a24864 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -81,6 +81,7 @@ enum bootflow_flags_t { * @fdt_size: Size of FDT file * @fdt_addr: Address of loaded fdt * @flags: Flags for the bootflow (see enum bootflow_flags_t) + * @cmdline: OS command line, or NULL it not known (allocated) */ struct bootflow { struct list_head bm_node; @@ -104,6 +105,7 @@ struct bootflow { int fdt_size; ulong fdt_addr; int flags; + char *cmdline; }; /** diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index fd0e1d62435..b9ac539107b 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -226,6 +226,7 @@ static int bootflow_cmd_info(struct unit_test_state *uts) ut_assert_nextlinen("Buffer: "); ut_assert_nextline("Size: 253 (595 bytes)"); ut_assert_nextline("OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)"); + ut_assert_nextline("Cmdline: (none)"); ut_assert_nextline("Logo: (none)"); ut_assert_nextline("FDT: "); ut_assert_nextline("Error: 0");