Skip to contentSkip to conversation

Autoboot when idling at prompt possible?

DISCUSSION Konstantin Kletschke 2 participants 3 messages Mar 16, 2023 – Mar 17, 2023 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

Hi there,

in order to get the booting more robust I already changed autoboot_abort_key from "any" to "ctrl-c".

We wan't to keep the autoboot_timeout to be able to access the bootloader prompt manually or with install tools more reliably to a non zero positive value. I.e. enter prompt with timeout greater than zero still should be possible.

Is there a mechanism already implemented or thinkable to be added as a command, which boots when the prompt is idling for a couple of minutes? Lets say the bootloader caught ctrl-c by accident (free serial pins in headless encasing in rough EMV environment) and idles there for years...

Kind Regards
Konstantin

Signature · 14 lines
INSIDE M2M GmbH
Konstantin Kletschke
Berenbosteler Straße 76 B
30823 Garbsen

Telefon: +49 (0) 5137 90950136
Mobil: +49 (0) 151 15256238
Fax: +49 (0) 5137 9095010

[email protected]
http://www.inside-m2m.de 

Geschäftsführung: Michael Emmert, Derek Uhlig
HRB: 111204, AG Hannover
#1 lore raw

Hello Konstantin,

Quoted 9 lines · Konstantin Kletschke

Hi there,

in order to get the booting more robust I already changed autoboot_abort_key from "any" to "ctrl-c".

We wan't to keep the autoboot_timeout to be able to access the bootloader prompt manually or with install tools more reliably to a non zero positive value. I.e. enter prompt with timeout greater than zero still should be possible.

If you keep ctrl+c pressed during boot, you may abort before init runs, even if global.autboot_timeout=0.

Quoted 5 lines

Is there a mechanism already implemented or thinkable to be added as a command, which boots when the prompt is idling for a couple of minutes? Lets say the bootloader caught ctrl-c by accident (free serial pins in headless encasing in rough EMV environment) and idles there for years...

You can enable watchdog before init runs, e.g. in your board code, let's say with a timeout of 2 minutes. If you have reason to use the shell, you run wd -x manually or set global.autoboot=abort and reset.

You may need to enable watchdog poller support if you have a watchdog timer that can't be disabled and you want for barebox to periodically poll it instead.

This is readily possible. You can still set a shorter boot watchdog timeout with global.boot.watchdog_timeout. Other possibilities:

- Allow entering bootloader shell only after systemctl reboot loader (See barebox reboot mode documentation)

- Add option to have barebox password login at most increase countdown, but not abort it. Users must then enter full password within specified time or system autoboots

Cheers,
Ahmad

Quoted 5 lines

Kind Regards
Konstantin

Signature · 4 lines
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 |
#2 lore raw

Dear Ahmad,

thanks for your kind support.

Quoted 2 lines · Ahmad Fatoum

If you keep ctrl+c pressed during boot, you may abort before init runs, even if global.autboot_timeout=0.

Interesting, I double checked "my" barebox for this feature, nice to know.

Quoted 3 lines

You can enable watchdog before init runs, e.g. in your board code, let's say with a timeout of 2 minutes. If you have reason to use the shell, you run wd -x manually or set global.autoboot=abort and reset.

This sounds neat and not over complicated. Nice Idea, to have a watchdog enabled at barebox level, why not. The manual required "wd -x" is fine.

I have a beaglebone board, added CONFIG_WATCHDOG and manual enabling watchdog via "wd 120" and disabling vie "wd -x" works fine. Now I wonder how to enable at boot up.

Something like

arch/arm/boards/beaglebone/board.c +5 -0
@@ -25,6 +25,8 @@
 #include <linux/err.h>
 #include <mach/bbu.h>
 
+#include <watchdog.h>
+
 #include "beaglebone.h"
 
 static int beaglebone_coredevice_init(void)
@@ -84,6 +86,9 @@ static int beaglebone_devices_init(void)
        if (IS_ENABLED(CONFIG_SHELL_NONE))
                return am33xx_of_register_bootdevice();
 
+       struct watchdog *wd = watchdog_get_default();
+       watchdog_set_timeout(wd, 120);
+
        return 0;
 }
 coredevice_initcall(beaglebone_devices_init);

?

I can't test at the moment because I am remote and cant handle a abused crashing barebox at the moment. It compiles, though!

The passwort entry approach is kinda neat to, I will investigate this feature too.

Kind Regards
Konstantin

Signature · 14 lines
INSIDE M2M GmbH
Konstantin Kletschke
Berenbosteler Straße 76 B
30823 Garbsen

Telefon: +49 (0) 5137 90950136
Mobil: +49 (0) 151 15256238
Fax: +49 (0) 5137 9095010

[email protected]
http://www.inside-m2m.de 

Geschäftsführung: Michael Emmert, Derek Uhlig
HRB: 111204, AG Hannover