bootelf unable to boot

Hello Simon,
In 78398652723b ("bootm: Tidy up use of autostart env var") you rationalised the checking of autoboot in the bootelf command handling. This changed the bootelf default behaviour from "autostart by default" to "autostart only when autostart=on".
The issue is with boards that have a flow where they dhcp or tftp an image and then load it with bootelf. If they set autostart=on, the dhcp command will try to use the bootm flow to load the elf, which fails. If they set autostart=off, there's no way to reach do_bootelf_exec.
There seems to be two use cases for bootelf in the tree: an ELF-loading version of bootm (x86/sebios testing, and a way to load an arbitrary ELF into memory for another processor to run (Zynq). I was using it for the former, for a powerpc platform.
The following change would restore the existing behaviour, and fix my use case:
diff --git a/cmd/elf.c b/cmd/elf.c index 2b33c50bd026..d3beb818e53f 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -68,7 +68,7 @@ int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) else addr = load_elf_image_shdr(addr);
- if (!env_get_autostart()) + if (env_get_no("autostart") == 1) return rcode;
printf("## Starting application at 0x%08lx ...\n", addr); diff --git a/env/common.c b/env/common.c index f9226e0690d0..7d6e4386e08d 100644 --- a/env/common.c +++ b/env/common.c @@ -235,6 +235,16 @@ int env_get_yesno(const char *var) 1 : 0; }
+int env_get_no(const char *var) +{ + char *s = env_get(var); + + if (s == NULL) + return -1; + return (*s == '0' || *s == 'n' || *s == 'N' || *s == 'f' || *s == 'F') ? + 1 : 0; +} +
Do you have any alternative suggestions?
Cheers,
Joel
participants (1)
-
Joel Stanley