mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Debug: add Kconfig option to abort autoboot
@ 2026-02-23 15:39 Sascha Hauer
  2026-02-24 15:59 ` Jonas Rebmann
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2026-02-23 15:39 UTC (permalink / raw)
  To: Barebox List

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@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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Debug: add Kconfig option to abort autoboot
  2026-02-23 15:39 [PATCH] Debug: add Kconfig option to abort autoboot Sascha Hauer
@ 2026-02-24 15:59 ` Jonas Rebmann
  2026-02-25  7:54   ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Rebmann @ 2026-02-24 15:59 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List

Hi Sascha,

On 2026-02-23 16:39, Sascha Hauer wrote:
> For debugging purposes it's sometimes useful when barebox doesn't boot
> through, but stops at the prompt.

Isn't this already compile-time configurable by setting the defaultenv
autoboot to "abort"?

Regards,
Jonas

> 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@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;

-- 
Pengutronix e.K.                           | Jonas Rebmann               |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Debug: add Kconfig option to abort autoboot
  2026-02-24 15:59 ` Jonas Rebmann
@ 2026-02-25  7:54   ` Sascha Hauer
  2026-02-25  9:52     ` Jonas Rebmann
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2026-02-25  7:54 UTC (permalink / raw)
  To: Jonas Rebmann; +Cc: Barebox List

On Tue, Feb 24, 2026 at 04:59:00PM +0100, Jonas Rebmann wrote:
> Hi Sascha,
> 
> On 2026-02-23 16:39, Sascha Hauer wrote:
> > For debugging purposes it's sometimes useful when barebox doesn't boot
> > through, but stops at the prompt.
> 
> Isn't this already compile-time configurable by setting the defaultenv
> autoboot to "abort"?

Yes, it is. It's just easier sometimes to just change a config, at least
for Claude.

Sascha

> 
> Regards,
> Jonas
> 
> > 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@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;
> 
> -- 
> Pengutronix e.K.                           | Jonas Rebmann               |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Debug: add Kconfig option to abort autoboot
  2026-02-25  7:54   ` Sascha Hauer
@ 2026-02-25  9:52     ` Jonas Rebmann
  2026-02-25 10:11       ` Ahmad Fatoum
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Rebmann @ 2026-02-25  9:52 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List

On 2026-02-25 08:54, Sascha Hauer wrote:
> On Tue, Feb 24, 2026 at 04:59:00PM +0100, Jonas Rebmann wrote:
>> Hi Sascha,
>>
>> On 2026-02-23 16:39, Sascha Hauer wrote:
>>> For debugging purposes it's sometimes useful when barebox doesn't boot
>>> through, but stops at the prompt.
>>
>> Isn't this already compile-time configurable by setting the defaultenv
>> autoboot to "abort"?
> 
> Yes, it is. It's just easier sometimes to just change a config, at least
> for Claude.

I think for the human, managing one option in two systems in different
ways makes things confusing. If the change is really needed, I suggest
the help text could explain that this overrides global.autoboot and that
configuration via defaultenv has further options for boot behavior.
Maybe also the autoboot global help text could be extended: "Autoboot
state. Possible values: countdown (default), abort, halt, menu, boot.
Ineffective if overwritten by CONFIG_DEBUG_AUTOBOOT_ABORT."

Regards,
Jonas

-- 
Pengutronix e.K.                           | Jonas Rebmann               |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Debug: add Kconfig option to abort autoboot
  2026-02-25  9:52     ` Jonas Rebmann
@ 2026-02-25 10:11       ` Ahmad Fatoum
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2026-02-25 10:11 UTC (permalink / raw)
  To: Jonas Rebmann, Sascha Hauer; +Cc: Barebox List

Hi,

On 2/25/26 10:52 AM, Jonas Rebmann wrote:
> On 2026-02-25 08:54, Sascha Hauer wrote:
>> On Tue, Feb 24, 2026 at 04:59:00PM +0100, Jonas Rebmann wrote:
>>> Hi Sascha,
>>>
>>> On 2026-02-23 16:39, Sascha Hauer wrote:
>>>> For debugging purposes it's sometimes useful when barebox doesn't boot
>>>> through, but stops at the prompt.
>>>
>>> Isn't this already compile-time configurable by setting the defaultenv
>>> autoboot to "abort"?
>>
>> Yes, it is. It's just easier sometimes to just change a config, at least
>> for Claude.
> 
> I think for the human, managing one option in two systems in different
> ways makes things confusing. If the change is really needed, I suggest
> the help text could explain that this overrides global.autoboot and that
> configuration via defaultenv has further options for boot behavior.
> Maybe also the autoboot global help text could be extended: "Autoboot
> state. Possible values: countdown (default), abort, halt, menu, boot.
> Ineffective if overwritten by CONFIG_DEBUG_AUTOBOOT_ABORT."

Or alternatively, we add defaultenv/defaultenv-2-devel/nv/autoboot ==
abort and then have a config option that enables this environment overlay.

Cheers,
Ahmad

> 
> Regards,
> Jonas
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-25 10:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-23 15:39 [PATCH] Debug: add Kconfig option to abort autoboot Sascha Hauer
2026-02-24 15:59 ` Jonas Rebmann
2026-02-25  7:54   ` Sascha Hauer
2026-02-25  9:52     ` Jonas Rebmann
2026-02-25 10:11       ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox