mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 5/5] bootm: switch globalvar to it's own device
Date: Mon, 24 Sep 2012 17:40:28 +0200	[thread overview]
Message-ID: <1348501228-23083-5-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1348501228-23083-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 .../boards/crystalfontz-cfa10036/env/boot/mmc-ext3 |    4 ++--
 arch/arm/boards/pcm038/env/boot/nand-ubi           |    4 ++--
 commands/bootm.c                                   |   24 ++++++++++++--------
 defaultenv-2/base/boot/initrd                      |    6 ++---
 defaultenv-2/base/boot/net                         |    4 ++--
 defaultenv-2/base/data/boot-template               |    6 ++---
 6 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 b/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3
index 7d7eb50..163c2fe 100644
--- a/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3
+++ b/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3
@@ -5,6 +5,6 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-global.bootm.image="/mnt/disk0.1/zImage-cfa10036"
-global.bootm.oftree="/mnt/disk0.1/oftree-cfa10036"
+bootm.image="/mnt/disk0.1/zImage-cfa10036"
+bootm.oftree="/mnt/disk0.1/oftree-cfa10036"
 bootargs-root-ext -r 3 -m mmcblk0p3
diff --git a/arch/arm/boards/pcm038/env/boot/nand-ubi b/arch/arm/boards/pcm038/env/boot/nand-ubi
index a3f748e..81a4397 100644
--- a/arch/arm/boards/pcm038/env/boot/nand-ubi
+++ b/arch/arm/boards/pcm038/env/boot/nand-ubi
@@ -5,6 +5,6 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-global.bootm.image="/dev/nand0.kernel.bb"
-#global.bootm.oftree="/env/oftree"
+bootm.image="/dev/nand0.kernel.bb"
+#bootm.oftree="/env/oftree"
 bootargs-root-ubi -r root -m nand0.root
diff --git a/commands/bootm.c b/commands/bootm.c
index 8e51695..c0180d4 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 device_d *bootm_dev;
+
+static const char* bootm_get_global(const char * var)
+{
+	return dev_get_param(bootm_dev, var);
+}
 
 int register_image_handler(struct image_handler *handler)
 {
@@ -267,10 +273,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) {
@@ -440,11 +446,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;
 }
@@ -475,8 +481,8 @@ BAREBOX_CMD_START(bootm)
 BAREBOX_CMD_END
 
 BAREBOX_MAGICVAR(bootargs, "Linux Kernel parameters");
-BAREBOX_MAGICVAR_NAMED(global_bootm_image, global.bootm.image, "bootm default boot image");
-BAREBOX_MAGICVAR_NAMED(global_bootm_initrd, global.bootm.initrd, "bootm default initrd");
+BAREBOX_MAGICVAR_NAMED(bootm_image, bootm.image, "bootm default boot image");
+BAREBOX_MAGICVAR_NAMED(bootm_initrd, bootm.initrd, "bootm default initrd");
 
 static struct binfmt_hook binfmt_uimage_hook = {
 	.type = filetype_uimage,
diff --git a/defaultenv-2/base/boot/initrd b/defaultenv-2/base/boot/initrd
index 7c44d07..6bfc11c 100644
--- a/defaultenv-2/base/boot/initrd
+++ b/defaultenv-2/base/boot/initrd
@@ -6,10 +6,10 @@ if [ "$1" = menu ]; then
 fi
 
 path="/mnt/tftp"
-global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
-global.bootm.initrd="${path}/initramfs"
+bootm.image="${path}/${global.user}-linux-${global.hostname}"
+bootm.initrd="${path}/initramfs"
 bootargs-root-initrd
-#global.bootm.oftree=<path to oftree>
+#bootm.oftree=<path to oftree>
 
 global.linux.bootargs.dyn.root="root=/dev/ram0"
 
diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
index 922bef1..5cc9823 100644
--- a/defaultenv-2/base/boot/net
+++ b/defaultenv-2/base/boot/net
@@ -7,8 +7,8 @@ fi
 
 path="/mnt/tftp"
 
-global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
-#global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
+bootm.image="${path}/${global.user}-linux-${global.hostname}"
+#bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
 nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
diff --git a/defaultenv-2/base/data/boot-template b/defaultenv-2/base/data/boot-template
index 1cacf18..d57c852 100644
--- a/defaultenv-2/base/data/boot-template
+++ b/defaultenv-2/base/data/boot-template
@@ -5,9 +5,9 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-global.bootm.image=<path to image>
-#global.bootm.oftree=<path to oftree>
-#global.bootm.initrd=<path to initrd>
+bootm.image=<path to image>
+#bootm.oftree=<path to oftree>
+#bootm.initrd=<path to initrd>
 
 #bootargs-ip
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2012-09-24 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24 15:27 [RFC PATCH 0/5] switch globalvar to it's own bus Jean-Christophe PLAGNIOL-VILLARD
2012-09-24 15:40 ` [PATCH 1/5] globalvar: add " Jean-Christophe PLAGNIOL-VILLARD
2012-09-24 15:40   ` [PATCH 2/5] globalvar: allow to register multiple device Jean-Christophe PLAGNIOL-VILLARD
2012-09-24 15:40   ` [PATCH 3/5] net: switch to global device Jean-Christophe PLAGNIOL-VILLARD
2012-09-24 15:40   ` [PATCH 4/5] dhcp: switch globalvar to it's own device Jean-Christophe PLAGNIOL-VILLARD
2012-09-24 15:40   ` Jean-Christophe PLAGNIOL-VILLARD [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348501228-23083-5-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox