Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51E9CC54EBC for ; Sun, 8 Jan 2023 03:04:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B719B85627; Sun, 8 Jan 2023 04:04:03 +0100 (CET) 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="c9r4QPoc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A7148562E; Sun, 8 Jan 2023 04:03:54 +0100 (CET) Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (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 8A29685677 for ; Sun, 8 Jan 2023 03:51:29 +0100 (CET) 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-il1-x130.google.com with SMTP id c20so3284605ilj.10 for ; Sat, 07 Jan 2023 18:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=n7//JyS4XpEyZtVvWhCMpXQ25mUrkRv8VzMhj8b3pb0=; b=c9r4QPocHKUe16U/omkNlFG5xU8b5sVH1wpUjIhXP/VYsNQ01KJif+OUBAvp89J8SI JzU/Nh/Ma990Ssxy2jMDuvcMEJ4l0ZmXFejCbuewgw7nwCWvsJRz9gYdH2acnSNGvWpi Hv1+y1zD3bjZX89lmQ0buto2JBHLLJBgpcc20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=n7//JyS4XpEyZtVvWhCMpXQ25mUrkRv8VzMhj8b3pb0=; b=qNjvVF1UmOPK1daBYXwxGiBCOe9dKzcm1g6jnw+Mz7aq391W+NKh4CReI6tb3CWZzx wcE7tSQsi56RbIGWBB0fcd7jNnQPttIeg6WXab7y4rglMrtR2f1Cs+ktb5VgrAwYVhVm RRDSjCHgXKn5HJ1uHkgXE4j4iNXQ7WxErpsw2x8Ai4ZbzjdkvoYIP7z+Pleoqrg5MqQ0 evN224jL028w6wkP3ZauoiprsVxPJntfALWMVU+1HuG6qgirwueipKjQtvKrp4Ge6XNA WUZa3bk7CI+Jj1OBs0sqolB+ETfQwkH7XpvWeapeIJuEZCaxZ3F+CJCTqKx6ayDrtMZU KIYg== X-Gm-Message-State: AFqh2koA6OH5a7orn0s1JxEi46pHp5/eHfAGXSNXKq7mhjpz7ydZDKnf 0mAoBJ8Ho0UaPicXvFuZqCQXllYMs1x4MToq X-Google-Smtp-Source: AMrXdXuDVWR31v0uzV1xeT/KyNaF1LFDSMBHdeBN4RGYvjI5BEiuuAHqZBslTYkqiQeP5udS1D8cHQ== X-Received: by 2002:a92:dd83:0:b0:300:a953:a263 with SMTP id g3-20020a92dd83000000b00300a953a263mr47567441iln.21.1673146289012; Sat, 07 Jan 2023 18:51:29 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-71-56-217-229.hsd1.co.comcast.net. [71.56.217.229]) by smtp.gmail.com with ESMTPSA id c17-20020a92bd11000000b00302a00aaefasm1622174ile.26.2023.01.07.18.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:51:28 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass Subject: [PATCH v2 47/71] bootstd: Include the device tree in the bootflow Date: Sat, 7 Jan 2023 19:50:23 -0700 Message-Id: <20230108025047.522240-48-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230108025047.522240-1-sjg@chromium.org> References: <20230108025047.522240-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Some bootmeths provide a way to load a device tree as well as the base OS image. Add a way to store this in the bootflow. Update the 'bootflow info' command to show this information. Note that the device tree is not allocated, but instead is stored at an address provided by an environment variable. This may need to be adjusted at some point, but for now it works well and fits in with the existing distro-boot scripts. Signed-off-by: Simon Glass --- (no changes since v1) boot/bootflow.c | 1 + cmd/bootflow.c | 6 ++++++ include/bootflow.h | 6 ++++++ test/boot/bootflow.c | 1 + 4 files changed, 14 insertions(+) diff --git a/boot/bootflow.c b/boot/bootflow.c index 0345755f58f..52cc2f9d548 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -355,6 +355,7 @@ void bootflow_free(struct bootflow *bflow) free(bflow->fname); free(bflow->buf); free(bflow->os_name); + free(bflow->fdt_fname); } void bootflow_remove(struct bootflow *bflow) diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 2b6ed26fdcb..56dd35b69cf 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -344,6 +344,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, printf("Logo size: %x (%d bytes)\n", bflow->logo_size, bflow->logo_size); } + printf("FDT: %s\n", bflow->fdt_fname); + if (bflow->fdt_fname) { + printf("FDT size: %x (%d bytes)\n", bflow->fdt_size, + bflow->fdt_size); + printf("FDT addr: %lx\n", bflow->fdt_addr); + } printf("Error: %d\n", bflow->err); if (dump && bflow->buf) { /* Set some sort of maximum on the size */ diff --git a/include/bootflow.h b/include/bootflow.h index 8ff9e332b1f..bf71b09edad 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -60,6 +60,9 @@ enum bootflow_state_t { * @err: Error number received (0 if OK) * @os_name: Name of the OS / distro being booted, or NULL if not known * (allocated) + * @fdt_fname: Filename of FDT file + * @fdt_size: Size of FDT file + * @fdt_addr: Address of loaded fdt */ struct bootflow { struct list_head bm_node; @@ -79,6 +82,9 @@ struct bootflow { int size; int err; char *os_name; + char *fdt_fname; + int fdt_size; + ulong fdt_addr; }; /** diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index f852b6e9b6f..b71ec52eb7a 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -199,6 +199,7 @@ static int bootflow_cmd_info(struct unit_test_state *uts) 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("Logo: (none)"); + ut_assert_nextline("FDT: "); ut_assert_nextline("Error: 0"); ut_assert_console_end(); -- 2.39.0.314.g84b9a713c41-goog