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 68B70C352A1 for ; Wed, 7 Dec 2022 09:04:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 79D7A856FF; Wed, 7 Dec 2022 09:56:45 +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="eaev4Zjs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6984B856D9; Wed, 7 Dec 2022 09:56:42 +0100 (CET) Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 8E8C8856E1 for ; Wed, 7 Dec 2022 09:56:39 +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-pf1-x42c.google.com with SMTP id 124so17005189pfy.0 for ; Wed, 07 Dec 2022 00:56:39 -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=O69prlR6vG6QDwsCSzbGhjkcYveW6o4H8pk1vkbh3N8=; b=eaev4Zjs/ZGmZNk9x+m9//ZykWhkwuB9EOBEWH0MzJcH2jh75TN0jrjUNbvljTDNGM 3/Ac8q9MvLr7MTPEUUsTeKW7KKEOXDcvPcNrPfveB0mUmM75I66PEZoC7yr3e1gaFOAR mhyWuzugcpRHQYlTA9yIUXyAIpSEj0LJ4b4g8= 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=O69prlR6vG6QDwsCSzbGhjkcYveW6o4H8pk1vkbh3N8=; b=EoEAedoMiPuQcQd83NpCCz/DS7FQVS4mEkWVf1iHOrPyS9k4GPxOc+YYVngQpEjgBe Z2M/7LLa71Lpw5/58QKRrJKefcaSb1u5Kil9T0PQuaYwlPUwJisMLoKUWui3cCGyLHxw aJeIpmQDybtQFizZxQ9ZqSSHTQc3Fa0jQOXJlG5ztC1diorXKMCs7YpUl7RyOSHLjJeP rBHFoEUTyNFPidZ5k13gU3xF6y/NA4fMzgBJTZaET3JYWAPUOuOfoDe5QDKRrafF1wd+ DdkY6pzUy38fp/B8V6jtylNjFCHW5PrQ4IpvMNAoBx2G3vqoDioRPl7qvVJz2JmnFdbc B1Cw== X-Gm-Message-State: ANoB5pmEeCYILgljaLWx8V16N4lgbCb/oxAhvVV4Vqff6/NxlFLYwq2e xALz3HnK3C6Nit8fZDaK8jDOD1LQeozTi/JO X-Google-Smtp-Source: AA0mqf4C5Zj8dlB+f9KclwUuQlZgvdHyXpEfGlpAIaM+JG6TM6eBdwokuPnNJGKjYTe2pUa6DiW2Aw== X-Received: by 2002:a05:6a00:290f:b0:56b:e15a:7215 with SMTP id cg15-20020a056a00290f00b0056be15a7215mr72497474pfb.27.1670403397698; Wed, 07 Dec 2022 00:56:37 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:56:37 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass Subject: [PATCH 47/71] bootstd: Include the device tree in the bootflow Date: Wed, 7 Dec 2022 21:51:13 +1300 Message-Id: <20221207085137.445249-48-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-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 --- 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 8c01a4efdc9..21d4f6b5a9a 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -354,6 +354,7 @@ void bootflow_free(struct bootflow *bflow) free(bflow->subdir); free(bflow->fname); free(bflow->buf); + free(bflow->fdt_fname); } void bootflow_remove(struct bootflow *bflow) diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 313103d2775..98c0d757b06 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -337,6 +337,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, printf("Filename: %s\n", bflow->fname); printf("Buffer: %lx\n", (ulong)map_to_sysmem(bflow->buf)); printf("Size: %x (%d bytes)\n", bflow->size, bflow->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 905410974c8..f7b821fa10e 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -52,6 +52,9 @@ enum bootflow_state_t { * @buf: Bootflow file contents (allocated) * @size: Size of bootflow file in bytes * @err: Error number received (0 if OK) + * @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; @@ -68,6 +71,9 @@ struct bootflow { char *buf; int size; int err; + char *fdt_fname; + int fdt_size; + ulong fdt_addr; }; /** diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 9e9a3e4061c..7cbcfe1f08e 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -189,6 +189,7 @@ static int bootflow_cmd_info(struct unit_test_state *uts) ut_assert_nextline("Filename: /extlinux/extlinux.conf"); ut_assert_nextlinen("Buffer: "); ut_assert_nextline("Size: 253 (595 bytes)"); + ut_assert_nextline("FDT: "); ut_assert_nextline("Error: 0"); ut_assert_console_end(); -- 2.39.0.rc0.267.gcb52ba06e7-goog