summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Connolly <[email protected]>2025-03-31 14:23:19 +0200
committerCaleb Connolly <[email protected]>2025-04-11 15:28:14 +0200
commit657e19f8f2dd279d3db6744d3d6859952d67c8c9 (patch)
tree2103190697bee621b1e8de6a20d8be095e8028df
parentfd775fb7aff82b55832f1d345d0ac07d7bd448e8 (diff)
cli_hush: support running bootcmd on boot retry
Introduce a new config option: RETRY_BOOTCMD. When enabled this causes hush shell to re-run "bootcmd" when the auto-boot counter times out. Tested-by: Danila Tikhonov <[email protected]> # google-sunfish Tested-by: Jens Reidel <[email protected]> # xiaomi-davinci Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
-rw-r--r--boot/Kconfig7
-rw-r--r--common/cli_hush.c6
-rw-r--r--common/cli_hush_upstream.c6
3 files changed, 15 insertions, 4 deletions
diff --git a/boot/Kconfig b/boot/Kconfig
index f101200ba7a..fb37d912bc9 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -1704,6 +1704,13 @@ config RESET_TO_RETRY
After the countdown timed out, the board will be reset to restart
again.
+config RETRY_BOOTCMD
+ bool "Run bootcmd on retry"
+ depends on BOOT_RETRY && HUSH_PARSER && !RESET_TO_RETRY
+ help
+ If this option is enabled, the "bootcmd" will be run after the
+ countdown times out.
+
endmenu
menu "Image support"
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 9f437ae5f47..7bd6943d3ed 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -1028,8 +1028,10 @@ static void get_user_input(struct in_str *i)
puts("\nTimeout waiting for command\n");
# ifdef CONFIG_RESET_TO_RETRY
do_reset(NULL, 0, 0, NULL);
-# else
-# error "This currently only works with CONFIG_RESET_TO_RETRY enabled"
+# elif IS_ENABLED(CONFIG_RETRY_BOOTCMD)
+ strcpy(console_buffer, "run bootcmd\n");
+# else
+# error "This only works with CONFIG_RESET_TO_RETRY or CONFIG_BOOT_RETRY_COMMAND enabled"
# endif
}
#endif
diff --git a/common/cli_hush_upstream.c b/common/cli_hush_upstream.c
index ab5aa5f9b36..748ef60ac90 100644
--- a/common/cli_hush_upstream.c
+++ b/common/cli_hush_upstream.c
@@ -2907,8 +2907,10 @@ static void get_user_input(struct in_str *i)
puts("\nTimeout waiting for command\n");
# ifdef CONFIG_RESET_TO_RETRY
do_reset(NULL, 0, 0, NULL);
-# else
-# error "This currently only works with CONFIG_RESET_TO_RETRY enabled"
+# elif IS_ENABLED(CONFIG_RETRY_BOOTCMD)
+ strcpy(console_buffer, "run bootcmd\n");
+# else
+# error "This only works with CONFIG_RESET_TO_RETRY or CONFIG_BOOT_RETRY_COMMAND enabled"
# endif
}
# endif