diff options
author | Simon Glass | 2023-10-01 19:15:25 -0600 |
---|---|---|
committer | Tom Rini | 2023-12-13 18:39:05 -0500 |
commit | a4bee0b45504397d71302cd1b186f5651424a332 (patch) | |
tree | 9f183791b4ac46c3e8be6c67d63baf495bfae04d /cmd/bootflow.c | |
parent | 6b8f26bca4854ea6826d8d9f3b1f644e349c9b7e (diff) |
bootstd: Add a menu option to bootflow scan
Allow showing a menu and automatically booting, with 'bootflow scan'.
This is more convenient than using a script.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/bootflow.c')
-rw-r--r-- | cmd/bootflow.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 3aeb40d690f..4a47265ebd5 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -135,7 +135,7 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc, struct udevice *dev = NULL; struct bootflow bflow; bool all = false, boot = false, errors = false, no_global = false; - bool list = false, no_hunter = false; + bool list = false, no_hunter = false, menu = false, text_mode = false; int num_valid = 0; const char *label = NULL; bool has_args; @@ -155,6 +155,8 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc, no_global = strchr(argv[1], 'G'); list = strchr(argv[1], 'l'); no_hunter = strchr(argv[1], 'H'); + menu = strchr(argv[1], 'm'); + text_mode = strchr(argv[1], 't'); argc--; argv++; } @@ -213,15 +215,32 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc, } if (list) show_bootflow(i, &bflow, errors); - if (boot && !bflow.err) + if (!menu && boot && !bflow.err) bootflow_run_boot(&iter, &bflow); } bootflow_iter_uninit(&iter); if (list) show_footer(i, num_valid); - if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && !num_valid && !list) - printf("No bootflows found; try again with -l\n"); + if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && IS_ENABLED(CONFIG_EXPO)) { + if (!num_valid && !list) { + printf("No bootflows found; try again with -l\n"); + } else if (menu) { + struct bootflow *sel_bflow; + + ret = bootflow_handle_menu(std, text_mode, &sel_bflow); + if (!ret && boot) { + ret = console_clear(); + if (ret) { + log_err("Failed to clear console: %dE\n", + ret); + return ret; + } + + bootflow_run_boot(NULL, sel_bflow); + } + } + } return 0; } |