[PATCH] Debug: add Kconfig option to abort autoboot

Sascha Hauer s.hauer at pengutronix.de
Mon Feb 23 07:39:08 PST 2026


For debugging purposes it's sometimes useful when barebox doesn't boot
through, but stops at the prompt. This allows for automated debugging
without having to catch the autoboot timeout first. This normally works
thanks to labgrid, but at the cost that messages are eaten up by the
barebox strategy.

This adds a Kconfig option to just stop at the prompt.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/Kconfig.debug | 6 ++++++
 common/startup.c     | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/Kconfig.debug b/common/Kconfig.debug
index b307b84202..13a686d0ad 100644
--- a/common/Kconfig.debug
+++ b/common/Kconfig.debug
@@ -56,6 +56,12 @@ config DEBUG_INITCALLS
 	help
 	  If enabled this will print initcall traces.
 
+config DEBUG_AUTOBOOT_ABORT
+	bool "Abort autoboot"
+	help
+	  If enabled barebox will not automatically boot but start a shell
+	  instead.
+
 config DEBUG_PBL
 	bool "Print PBL debugging information"
 	depends on PBL_CONSOLE
diff --git a/common/startup.c b/common/startup.c
index 055d94fe6a..7551813a50 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -189,7 +189,9 @@ void set_autoboot_state(enum autoboot_state autoboot)
  */
 enum autoboot_state do_autoboot_countdown(void)
 {
-	static enum autoboot_state autoboot_state = AUTOBOOT_UNKNOWN;
+	static enum autoboot_state autoboot_state =
+		IS_ENABLED(CONFIG_DEBUG_AUTOBOOT_ABORT) ?
+			AUTOBOOT_ABORT : AUTOBOOT_UNKNOWN;
 	unsigned flags = CONSOLE_COUNTDOWN_EXTERN;
 	int ret;
 	struct stat s;
-- 
2.47.3




More information about the barebox mailing list