summaryrefslogtreecommitdiffstats
path: root/common/startup.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-02-18 10:25:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-28 08:14:14 +0100
commit7fa10256c3f4b38f9ca899c5367584380c017bea (patch)
treed1c5654947c4d8305d66646aa35656c8611bd16d /common/startup.c
parentb850dbad6557c4cd0e03c9b83be88579412cdd3f (diff)
downloadbarebox-7fa10256c3f4b38f9ca899c5367584380c017bea.tar.gz
defaultenv: Allow multiple defaultenvironment overlays
We can compile barebox for multiple boards at once, but currently they all share a single default environment. This patch adds a defaultenv_append() which boards can call to customize the default environment during runtime. Each board now generate default environment snippets using bbenv-y and add them during runtime with defaultenv_append() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r--common/startup.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/common/startup.c b/common/startup.c
index 6847b61..9c4e995 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -44,39 +44,6 @@
extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[],
__barebox_initcalls_end[];
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
-#include "barebox_default_env.h"
-
-static int register_default_env(void)
-{
- int ret;
- void *defaultenv;
-
- if (!IS_ENABLED(CONFIG_DEFAULT_COMPRESSION_NONE)) {
-
- defaultenv = xzalloc(default_environment_uncompress_size);
-
- ret = uncompress(default_environment, default_environment_size,
- NULL, NULL,
- defaultenv, NULL, uncompress_err_stdout);
- if (ret) {
- free(defaultenv);
- return ret;
- }
- } else {
- defaultenv = (void *)default_environment;
- }
-
-
- add_mem_device("defaultenv", (unsigned long)defaultenv,
- default_environment_uncompress_size,
- IORESOURCE_MEM_WRITEABLE);
- return 0;
-}
-
-device_initcall(register_default_env);
-#endif
-
#if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS
static int mount_root(void)
{
@@ -120,7 +87,7 @@ void __noreturn start_barebox(void)
pr_err("no valid environment found on %s. "
"Using default environment\n",
default_environment_path);
- envfs_load("/dev/defaultenv", "/env", 0);
+ defaultenv_load("/env", 0);
}
}