summaryrefslogtreecommitdiffstats
path: root/common/startup.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-01-20 13:30:17 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-01-20 16:33:03 +0100
commit7ed52f887036fb0f4c1c4ccb38b72fd766082410 (patch)
tree6f28455be4aa89e425627d1fd25a0d1d850de9af /common/startup.c
parenta32ba9323999073cd4fa804b8238197233739f16 (diff)
downloadbarebox-7ed52f887036fb0f4c1c4ccb38b72fd766082410.tar.gz
startup: Use IS_ENABLED for loading environment
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r--common/startup.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/common/startup.c b/common/startup.c
index 6513ba5..c26bc5f 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -110,16 +110,18 @@ void start_barebox (void)
debug("initcalls done\n");
-#ifdef CONFIG_ENV_HANDLING
- if (envfs_load(default_environment_path, "/env", 0)) {
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
- printf("no valid environment found on %s. "
- "Using default environment\n",
- default_environment_path);
- envfs_load("/dev/defaultenv", "/env", 0);
-#endif
+ if (IS_ENABLED(CONFIG_ENV_HANDLING)) {
+ int ret;
+
+ ret = envfs_load(default_environment_path, "/env", 0);
+
+ if (ret && IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) {
+ printf("no valid environment found on %s. "
+ "Using default environment\n",
+ default_environment_path);
+ envfs_load("/dev/defaultenv", "/env", 0);
+ }
}
-#endif
if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) {
printf("running /env/bin/init...\n");