]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootstd: Include the device tree in the bootflow
authorSimon Glass <sjg@chromium.org>
Tue, 17 Jan 2023 17:47:56 +0000 (10:47 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 23 Jan 2023 23:11:40 +0000 (18:11 -0500)
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 <sjg@chromium.org>
boot/bootflow.c
cmd/bootflow.c
include/bootflow.h
test/boot/bootflow.c

index 0345755f58fccb41340375c2c1eb415919014f50..52cc2f9d548eb310c5360be95f3b58ad1ce821e5 100644 (file)
@@ -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)
index 2b6ed26fdcb6131d234f0248511faa2c97e399b0..56dd35b69cf49be6064db266e4336a0924e769ba 100644 (file)
@@ -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 */
index 8ff9e332b1f24a2c0283ad00473403d2e5e17ede..bf71b09edad2d3f54d07a701cda0aa7666f169a3 100644 (file)
@@ -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;
 };
 
 /**
index f852b6e9b6f2c3cebf88703509e0be0ff0428984..b71ec52eb7a18c445b0fefee72e9e488f32d2d69 100644 (file)
@@ -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:       <NULL>");
        ut_assert_nextline("Error:     0");
        ut_assert_console_end();