[PATCH 6/7] bootm: switch globalvar to it's own device
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Wed Mar 13 14:05:21 EDT 2013
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
commands/bootm.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/commands/bootm.c b/commands/bootm.c
index 4d3f022..b70cd05 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -48,6 +48,12 @@
#include <asm-generic/memory_layout.h>
static LIST_HEAD(handler_list);
+static struct device_d *bootm_dev;
+
+static const char* bootm_get_global(const char * var)
+{
+ return dev_get_param(bootm_dev, var);
+}
/*
* Additional oftree size for the fixed tree
@@ -265,10 +271,10 @@ static int do_bootm(int argc, char *argv[])
data.verify = 0;
data.verbose = 0;
- oftree = getenv("global.bootm.oftree");
- os_file = getenv("global.bootm.image");
+ oftree = bootm_get_global("oftree");
+ os_file = bootm_get_global("image");
if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD))
- initrd_file = getenv("global.bootm.initrd");
+ initrd_file = bootm_get_global("initrd");
while ((opt = getopt(argc, argv, BOOTM_OPTS)) > 0) {
switch(opt) {
@@ -443,11 +449,11 @@ err_out:
static int bootm_init(void)
{
-
- globalvar_add_simple("bootm.image");
- globalvar_add_simple("bootm.oftree");
+ bootm_dev = global_add_device("bootm");
+ global_add_simple(bootm_dev, "image");
+ global_add_simple(bootm_dev, "oftree");
if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD))
- globalvar_add_simple("bootm.initrd");
+ global_add_simple(bootm_dev, "initrd");
return 0;
}
--
1.7.10.4
More information about the barebox
mailing list