mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] bootm: add global bootm.{image/initrd}.loadaddr support
@ 2013-09-01  6:04 Jean-Christophe PLAGNIOL-VILLARD
  2013-09-02  9:08 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-09-01  6:04 UTC (permalink / raw)
  To: barebox

To be able to pass the loadaddr of the image and the initrd.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/bootm.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index 6ce2ca9..60c2ece 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -241,6 +241,19 @@ static char *bootm_image_name_and_no(const char *name, int *no)
 #define BOOTM_OPTS BOOTM_OPTS_COMMON
 #endif
 
+unsigned long long getenv_loadaddr(const char *name)
+{
+	const char *valstr = getenv(name);
+
+	if (!valstr)
+		return UIMAGE_SOME_ADDRESS;
+
+	if (valstr[0] == '\0')
+		return UIMAGE_SOME_ADDRESS;
+
+	return simple_strtoull(valstr, NULL, 0);
+}
+
 static int do_bootm(int argc, char *argv[])
 {
 	int opt;
@@ -260,6 +273,8 @@ static int do_bootm(int argc, char *argv[])
 
 	oftree = getenv("global.bootm.oftree");
 	os_file = getenv("global.bootm.image");
+	data.os_address = getenv_loadaddr("global.bootm.image.loadaddr");
+	data.initrd_address = getenv_loadaddr("global.bootm.initrd.loadaddr");
 	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD))
 		initrd_file = getenv("global.bootm.initrd");
 
@@ -436,9 +451,12 @@ static int bootm_init(void)
 {
 
 	globalvar_add_simple("bootm.image");
+	globalvar_add_simple("bootm.image.loadaddr");
 	globalvar_add_simple("bootm.oftree");
-	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD))
+	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) {
 		globalvar_add_simple("bootm.initrd");
+		globalvar_add_simple("bootm.initrd.loadaddr");
+	}
 
 	return 0;
 }
@@ -470,7 +488,9 @@ 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_image_loadaddr, global.bootm.image.loadaddr, "bootm default boot image loadaddr");
 BAREBOX_MAGICVAR_NAMED(global_bootm_initrd, global.bootm.initrd, "bootm default initrd");
+BAREBOX_MAGICVAR_NAMED(global_bootm_initrd_loadaddr, global.bootm.initrd.loadaddr, "bootm default initrd loadaddr");
 
 static struct binfmt_hook binfmt_uimage_hook = {
 	.type = filetype_uimage,
-- 
1.8.4.rc1


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

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 1/1] bootm: add global bootm.{image/initrd}.loadaddr support
@ 2012-08-13  7:07 Jean-Christophe PLAGNIOL-VILLARD
  2012-08-13 18:45 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-13  7:07 UTC (permalink / raw)
  To: barebox

To be able to pass the loadaddr of the image and the initrd.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/bootm.c |   24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index 5f858e8..331e777 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -254,6 +254,16 @@ static char *bootm_image_name_and_no(const char *name, int *no)
 #define BOOTM_OPTS BOOTM_OPTS_COMMON
 #endif
 
+unsigned long long getenv_loadaddr(const char *name)
+{
+	const char *valstr = getenv(name);
+
+	if (!valstr)
+		return UIMAGE_SOME_ADDRESS;
+
+	return simple_strtoull(valstr, NULL, 0);
+}
+
 static int do_bootm(int argc, char *argv[])
 {
 	int opt;
@@ -273,8 +283,11 @@ static int do_bootm(int argc, char *argv[])
 
 	oftree = getenv("global.bootm.oftree");
 	os_file = getenv("global.bootm.image");
-	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD))
+	data.os_address = getenv_loadaddr("global.bootm.image.loadaddr");
+	data.initrd_address = getenv_loadaddr("global.bootm.initrd.loadaddr");
+	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) {
 		initrd_file = getenv("global.bootm.initrd");
+	}
 
 	while ((opt = getopt(argc, argv, BOOTM_OPTS)) > 0) {
 		switch(opt) {
@@ -446,9 +459,12 @@ static int bootm_init(void)
 {
 
 	globalvar_add_simple("bootm.image");
+	globalvar_add_simple("bootm.image.loadaddr");
 	globalvar_add_simple("bootm.oftree");
-	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD))
+	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) {
 		globalvar_add_simple("bootm.initrd");
+		globalvar_add_simple("bootm.initrd.loadaddr");
+	}
 
 	return 0;
 }
@@ -479,8 +495,10 @@ 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_image_loadaddr, global.bootm.image, "bootm default boot image");
+BAREBOX_MAGICVAR_NAMED(global_bootm_image, global.bootm.image.loadaddr, "bootm default boot image loadaadr");
 BAREBOX_MAGICVAR_NAMED(global_bootm_initrd, global.bootm.initrd, "bootm default initrd");
+BAREBOX_MAGICVAR_NAMED(global_bootm_initrd_loadaddr, global.bootm.initrd.loadaddr, "bootm default initrd loadaadr");
 
 static struct binfmt_hook binfmt_uimage_hook = {
 	.type = filetype_uimage,
-- 
1.7.10.4


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-02  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-01  6:04 [PATCH 1/1] bootm: add global bootm.{image/initrd}.loadaddr support Jean-Christophe PLAGNIOL-VILLARD
2013-09-02  9:08 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2012-08-13  7:07 Jean-Christophe PLAGNIOL-VILLARD
2012-08-13 18:45 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox