diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-06 14:51:31 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-15 07:01:42 +0200 |
commit | 041b2bd31fe1e6b77fb445da3bd3c2fcb5612ae3 (patch) | |
tree | 437677fb0fb9f900f77d7890967fcdf8d7e8170e /common/startup.c | |
parent | 55c8ed306f5266288667b55d74cf9e355435a1a2 (diff) | |
download | barebox-041b2bd31fe1e6b77fb445da3bd3c2fcb5612ae3.tar.gz barebox-041b2bd31fe1e6b77fb445da3bd3c2fcb5612ae3.tar.xz |
startup: introduce postenvironment_initcall
To allow init code that depends on the environment being loaded.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r-- | common/startup.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/common/startup.c b/common/startup.c index e59b06d533..6178fc5353 100644 --- a/common/startup.c +++ b/common/startup.c @@ -62,6 +62,24 @@ static int mount_root(void) fs_initcall(mount_root); #endif +#ifdef CONFIG_ENV_HANDLING +static int load_environment(void) +{ + const char *default_environment_path; + + default_environment_path = default_environment_path_get(); + + if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) + defaultenv_load("/env", 0); + + envfs_load(default_environment_path, "/env", 0); + nvvar_load(); + + return 0; +} +environment_initcall(load_environment); +#endif + int (*barebox_main)(void); void __noreturn start_barebox(void) @@ -84,16 +102,6 @@ void __noreturn start_barebox(void) pr_debug("initcalls done\n"); - if (IS_ENABLED(CONFIG_ENV_HANDLING)) { - char *default_environment_path = default_environment_path_get(); - - if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) - defaultenv_load("/env", 0); - - envfs_load(default_environment_path, "/env", 0); - nvvar_load(); - } - if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) { pr_info("running /env/bin/init...\n"); |