diff options
author | Ladislav Michl <ladis@linux-mips.org> | 2019-08-21 15:28:59 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-23 09:09:10 +0200 |
commit | 7536df20a8aefb35b83aebdb5eac636ef1df75fd (patch) | |
tree | c5d8c35215d295a82ddc37d0c86c9cd146be4247 | |
parent | db04e7b448785b5b5224c858684e8fb249b2648c (diff) | |
download | barebox-7536df20a8aefb35b83aebdb5eac636ef1df75fd.tar.gz barebox-7536df20a8aefb35b83aebdb5eac636ef1df75fd.tar.xz |
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...")
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | common/startup.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/common/startup.c b/common/startup.c index 92bf94f849..88eeee5e3d 100644 --- a/common/startup.c +++ b/common/startup.c @@ -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 */ |