Skip to contentSkip to conversation

startup: Register autoboot variables earlier

PATCH Applied Ladislav Michl 2 participants 2 messages Aug 21, 2019 – Aug 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 startup: Register autoboot variables earlier

Autoboot is controlled by autoboot_timeout and autoboot_abort_key variables which might be altered by init scripts, so we need to register them before those scripts are run. Otherwise they are set back to defaultenv values upon registration.

Fixes 35266d7e583f ("startup: Factor out the autoboot counter...")
---
 common/startup.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
common/startup.c +11 -7
index bef9d29c6..b5b86d114 100644
@@ -221,13 +221,6 @@ enum autoboot_state do_autoboot_countdown(void)
 	if (autoboot_state != AUTOBOOT_UNKNOWN)
 		return autoboot_state;
 
-	globalvar_add_simple_enum("autoboot_abort_key",
-				  &global_autoboot_abort_key,
-                                  global_autoboot_abort_keys,
-				  ARRAY_SIZE(global_autoboot_abort_keys));
-	globalvar_add_simple_int("autoboot_timeout",
-				 &global_autoboot_timeout, "%u");
-
 	menu_exists = stat(MENUFILE, &s) == 0;
 
 	if (menu_exists) {
@@ -272,6 +265,17 @@ static int run_init(void)
 	enum autoboot_state autoboot;
 	struct stat s;
 
+	/*
+	 * Register autoboot variables here as they might be altered by
+	 * init scripts.
+	 */
+	globalvar_add_simple_enum("autoboot_abort_key",
+				  &global_autoboot_abort_key,
+                                  global_autoboot_abort_keys,
+				  ARRAY_SIZE(global_autoboot_abort_keys));
+	globalvar_add_simple_int("autoboot_timeout",
+				 &global_autoboot_timeout, "%u");
+
 	setenv("PATH", "/env/bin");
 
 	/* Run legacy /env/bin/init if it exists */
Signature · 7 lines
2.23.0.rc1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 10 lines · Ladislav Michl

Autoboot is controlled by autoboot_timeout and autoboot_abort_key variables which might be altered by init scripts, so we need to register them before those scripts are run. Otherwise they are set back to defaultenv values upon registration.

Fixes 35266d7e583f ("startup: Factor out the autoboot counter...")
---
 common/startup.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox