diff options
author | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-09-13 15:22:23 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-09-13 15:22:23 +0200 |
commit | 6634cfe849b547b35e50e73b0a142a294cd39a80 (patch) | |
tree | 291c1fca6a32b35654c8358689e53d1458da7bdc /common/startup.c | |
parent | 46f6648adbbad796e459acf9f3cb8a53b7408584 (diff) | |
download | barebox-6634cfe849b547b35e50e73b0a142a294cd39a80.tar.gz barebox-6634cfe849b547b35e50e73b0a142a294cd39a80.tar.xz |
add default environment
Diffstat (limited to 'common/startup.c')
-rw-r--r-- | common/startup.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/common/startup.c b/common/startup.c index 68753bdc1b..643077343e 100644 --- a/common/startup.c +++ b/common/startup.c @@ -34,6 +34,7 @@ #include <debug_ll.h> #include <fs.h> #include <linux/stat.h> +#include <environment.h> #include <reloc.h> #ifndef CONFIG_IDENT_STRING @@ -74,6 +75,26 @@ void early_init (void) #endif /* CONFIG_HAS_EARLY_INIT */ +#ifdef CONFIG_DEFAULT_ENVIRONMENT +#include <uboot_default_env.h> + +static struct device_d default_env_dev = { + .name = "rom", + .id = "defaultenv", +}; + +static void register_default_env(void) +{ + default_env_dev.map_base = (unsigned long)default_environment; + default_env_dev.size = sizeof(default_environment); + register_device(&default_env_dev); +} +#else +static void register_default_env(void) +{ +} +#endif + void start_uboot (void) { initcall_t *initcall; @@ -102,11 +123,19 @@ void start_uboot (void) display_banner(); #endif + register_default_env(); + mount("none", "ramfs", "/"); mkdir("/dev"); mkdir("/env"); mount("none", "devfs", "/dev"); - run_command("loadenv", 0); + + if (envfs_load("/dev/env0", "/env")) { +#ifdef CONFIG_DEFAULT_ENVIRONMENT + printf("using default environment\n"); + envfs_load("/dev/defaultenv", "/env"); +#endif + } if (!stat("/env/init", &s)) { printf("running /env/init\n"); @@ -114,9 +143,8 @@ void start_uboot (void) } /* main_loop() can return to retry autoboot, if so just run it again. */ - for (;;) { + for (;;) main_loop (); - } /* NOTREACHED - no way out of command loop except booting */ } |