]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: spl: provide address and size of prepared FDT in environment
authorAnatolij Gustschin <agust@denx.de>
Thu, 17 Aug 2017 19:01:48 +0000 (21:01 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 26 Aug 2017 18:56:12 +0000 (14:56 -0400)
Writing prepared FDT to persistent storage should be possible in
scripts. Create environment variables containing address and size
of the updated FDT. Scripts can use these variables after running
'spl export fdt ...' command to write the new blob to persistent
storage.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
cmd/spl.c
doc/README.falcon

index 057764aa8d984c323f4df96e170ecae20f5921f7..1165b786d3428745fb8660d967336366ba443905 100644 (file)
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -118,6 +118,11 @@ static int spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                case SPL_EXPORT_FDT:
                        printf("Argument image is now in RAM: 0x%p\n",
                                (void *)images.ft_addr);
+                       env_set_addr("fdtargsaddr", images.ft_addr);
+                       env_set_hex("fdtargslen", fdt_totalsize(images.ft_addr));
+                       if (fdt_totalsize(images.ft_addr) >
+                           CONFIG_CMD_SPL_WRITE_SIZE)
+                               puts("WARN: FDT size > CMD_SPL_WRITE_SIZE\n");
                        break;
 #endif
                case SPL_EXPORT_ATAGS:
index e9f8a7583c721cd96eb364ff23d591c0284c70b3..9a7f0bc23515089d1a5e8e968c7db58f051cb613 100644 (file)
@@ -118,7 +118,12 @@ after each run of 'spl export'. Unfortunately the position of temporary
 storage can not be predicted nor provided at commandline, it depends
 highly on your system setup and your provided data (ATAGS or FDT).
 However at the end of an succesful 'spl export' run it will print the
-RAM address of temporary storage.
+RAM address of temporary storage. The RAM address of FDT will also be
+set in the environment variable 'fdtargsaddr', the new length of the
+prepared FDT will be set in the environment variable 'fdtargslen'.
+These environment variables can be used in scripts for writing updated
+FDT to persistent storage.
+
 Now the user have to save the generated BLOB from that printed address
 to the pre-defined address in persistent storage
 (CONFIG_CMD_SPL_NAND_OFS in case of NAND).