[PATCH 06/11] bootm: move globalvars from command to common

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 24 03:08:42 EDT 2013


The globalvars should be available even if the bootm command
is not directly present.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/bootm.c | 14 --------------
 common/bootm.c   | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index c1d2ec4..005d582 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -158,20 +158,6 @@ err_out:
 	return 1;
 }
 
-static int bootm_init(void)
-{
-	globalvar_add_simple("bootm.image", NULL);
-	globalvar_add_simple("bootm.image.loadaddr", NULL);
-	globalvar_add_simple("bootm.oftree", NULL);
-	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) {
-		globalvar_add_simple("bootm.initrd", NULL);
-		globalvar_add_simple("bootm.initrd.loadaddr", NULL);
-	}
-
-	return 0;
-}
-late_initcall(bootm_init);
-
 BAREBOX_CMD_HELP_START(bootm)
 BAREBOX_CMD_HELP_USAGE("bootm [OPTIONS] image\n")
 BAREBOX_CMD_HELP_SHORT("Boot an application image.\n")
diff --git a/common/bootm.c b/common/bootm.c
index 6b2c2a6..259feac 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -16,6 +16,8 @@
 #include <fs.h>
 #include <malloc.h>
 #include <memory.h>
+#include <globalvar.h>
+#include <init.h>
 
 static LIST_HEAD(handler_list);
 
@@ -322,3 +324,17 @@ err_out:
 
 	return ret;
 }
+
+static int bootm_init(void)
+{
+	globalvar_add_simple("bootm.image", NULL);
+	globalvar_add_simple("bootm.image.loadaddr", NULL);
+	globalvar_add_simple("bootm.oftree", NULL);
+	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) {
+		globalvar_add_simple("bootm.initrd", NULL);
+		globalvar_add_simple("bootm.initrd.loadaddr", NULL);
+	}
+
+	return 0;
+}
+late_initcall(bootm_init);
-- 
1.8.4.rc3




More information about the barebox mailing list