Skip to content

Commit

Permalink
cmd: mtkload: ignore env "autostart" to run loaded image automatically
Browse files Browse the repository at this point in the history
Signed-off-by: Shiji Yang <[email protected]>
  • Loading branch information
DragonBluep committed May 4, 2023
1 parent 578c680 commit d6260af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 16 additions & 2 deletions board/ralink/common/cmd_mtkupgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,8 @@ static int run_image(size_t data_addr, uint32_t data_size)
{
char *uimage_ptr;
char *argv[2], str[64];
const char *ep;
int ret;
struct image_header hdr;

/* Check for SPL bootloader first */
Expand All @@ -979,11 +981,23 @@ static int run_image(size_t data_addr, uint32_t data_size)
uimage_ptr = (void *) data_addr;
}

ep = env_get("autostart");
if (ep)
ep = strdup(ep);

env_set("autostart", "yes");
sprintf(str, "0x%p", uimage_ptr);
argv[0] = "bootm";
argv[1] = str;

return do_bootm(find_cmd("do_bootm"), 0, 2, argv);
ret = do_bootm(find_cmd("do_bootm"), 0, 2, argv);

if (ep) {
env_set("autostart", ep);
free((void *) ep);
} else
env_set("autostart", "");

return ret;
}

static int do_mtkload(cmd_tbl_t *cmdtp, int flag, int argc,
Expand Down
3 changes: 2 additions & 1 deletion board/ralink/mt7621_nand_rfb/cmd_mtkboardboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ static int do_mtkboardboot(cmd_tbl_t *cmdtp, int flag, int argc,
if (ep) {
env_set("autostart", ep);
free((void *) ep);
}
} else
env_set("autostart", "");

#ifndef CONFIG_WEBUI_FAILSAFE_ON_AUTOBOOT_FAIL
return CMD_RET_FAILURE;
Expand Down

0 comments on commit d6260af

Please sign in to comment.