Skip to contentSkip to conversation

cmd: spl: provide address and size of prepared FDT in environment

PATCH In review Anatolij Gustschin 2 participants 2 messages Aug 17, 2017 – Aug 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: spl: provide address and size of prepared FDT in environment

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.

---
 cmd/spl.c         | 5 +++++
 doc/README.falcon | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
cmd/spl.c +5 -0
index 057764a..3a2a15d 100644
@@ -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);
+			setenv_addr("fdtargsaddr", images.ft_addr);
+			setenv_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:
doc/README.falcon +6 -1
index e9f8a75..9a7f0bc 100644
@@ -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).
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · Anatolij Gustschin

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170826/18d60ccd/attachment.sig>