summaryrefslogtreecommitdiffstats
path: root/common/startup.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-06-25 10:55:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-26 08:01:29 +0200
commit8628b5881418c23a22d72319b76ab04b7ec644f9 (patch)
tree8c66b91767f684f86626e448e6a8679f00e8a4c0 /common/startup.c
parent61b28fb70a9f1be33705279456d2705d94556a83 (diff)
downloadbarebox-8628b5881418c23a22d72319b76ab04b7ec644f9.tar.gz
barebox-8628b5881418c23a22d72319b76ab04b7ec644f9.tar.xz
startup: register autoboot vars in initcall
globalvars should be registered early so that code modifying them also updates the backing store pointer. Move registering of global.autoboot_abort_key, global.autoboot_timeout and global.autoboot to an initcall. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r--common/startup.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/common/startup.c b/common/startup.c
index 511675ed55..7e0f7d6b64 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -281,19 +281,8 @@ enum autoboot_state do_autoboot_countdown(void)
return autoboot_state;
}
-static int run_init(void)
+static int register_autoboot_vars(void)
{
- DIR *dir;
- struct dirent *d;
- const char *initdir = "/env/init";
- bool env_bin_init_exists;
- 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,
@@ -305,6 +294,19 @@ static int run_init(void)
global_autoboot_states,
ARRAY_SIZE(global_autoboot_states));
+ return 0;
+}
+postcore_initcall(register_autoboot_vars);
+
+static int run_init(void)
+{
+ DIR *dir;
+ struct dirent *d;
+ const char *initdir = "/env/init";
+ bool env_bin_init_exists;
+ enum autoboot_state autoboot;
+ struct stat s;
+
setenv("PATH", "/env/bin");
/* Run legacy /env/bin/init if it exists */