help
Boot an ELF/vxWorks image from the memory.
+config CMD_ELF_FDT_SETUP
+ bool "Flattened Device Tree setup in bootelf cmd"
+ default n
+ depends on CMD_ELF
+ select LIB_LIBFDT
+ select LMB
+ help
+ Do FDT setup in bootelf command optionally by param -d, which
+ allows to bring additional system info (e.g. /memory node) to
+ the Operating System or application.
+
config CMD_FDT
bool "Flattened Device Tree utility commands"
default y
/* Interpreter command to boot an arbitrary ELF image from memory */
int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
+#if CONFIG_IS_ENABLED(CMD_ELF_FDT_SETUP)
+ struct bootm_headers img = {0};
+ unsigned long fdt_addr = 0; /* Address of the FDT */
+#endif
unsigned long addr; /* Address of the ELF image */
unsigned long rc; /* Return value from user code */
char *sload = NULL;
/* Consume 'bootelf' */
argc--; argv++;
- /* Check for flag. */
+ /* Check for [-p|-s] flag. */
if (argc >= 1 && (argv[0][0] == '-' && \
(argv[0][1] == 'p' || argv[0][1] == 's'))) {
sload = argv[0];
/* Consume flag. */
argc--; argv++;
}
+
+#if CONFIG_IS_ENABLED(CMD_ELF_FDT_SETUP)
+ /* Check for [-d fdt_addr_r] option. */
+ if ((argc >= 2) && (argv[0][0] == '-') && (argv[0][1] == 'd')) {
+ if (strict_strtoul(argv[1], 16, &fdt_addr) != 0)
+ return CMD_RET_USAGE;
+ /* Consume option. */
+ argc -= 2;
+ argv += 2;
+ }
+#endif
+
/* Check for address. */
if (argc >= 1 && strict_strtoul(argv[0], 16, &addr) != -EINVAL) {
/* Consume address */
else
addr = load_elf_image_shdr(addr);
+#if CONFIG_IS_ENABLED(CMD_ELF_FDT_SETUP)
+ if (fdt_addr) {
+ printf("## Setting up FDT at 0x%08lx ...\n", fdt_addr);
+ flush();
+
+ if (image_setup_libfdt(&img, (void *)fdt_addr, NULL))
+ return 1;
+ }
+#endif
+
if (!env_get_autostart())
return rcode;
U_BOOT_CMD(
bootelf, CONFIG_SYS_MAXARGS, 0, do_bootelf,
"Boot from an ELF image in memory",
- "[-p|-s] [address]\n"
+ "[-p|-s] "
+#if CONFIG_IS_ENABLED(CMD_ELF_FDT_SETUP)
+ "[-d fdt_addr_r] "
+#endif
+ "[address]\n"
"\t- load ELF image at [address] via program headers (-p)\n"
- "\t or via section headers (-s)"
+ "\t or via section headers (-s)\n"
+#if CONFIG_IS_ENABLED(CMD_ELF_FDT_SETUP)
+ "\t- setup FDT image at [fdt_addr_r] (-d)"
+#endif
);
U_BOOT_CMD(