* [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support
@ 2012-09-12 15:48 Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 14:54 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 20:41 ` Sascha Hauer
0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-12 15:48 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 | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/commands/bootm.c b/commands/bootm.c
index 2d9f7f2..dfd9ac9 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -254,6 +254,19 @@ static char *bootm_image_name_and_no(const char *name, int *no)
#define BOOTM_OPTS BOOTM_OPTS_COMMON
#endif
+static 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;
@@ -273,8 +286,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 +462,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;
}
@@ -480,7 +499,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 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] 5+ messages in thread
* Re: [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support
2012-09-12 15:48 [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-16 14:54 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-17 9:38 ` Renaud Barbier
2012-10-16 20:41 ` Sascha Hauer
1 sibling, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-16 14:54 UTC (permalink / raw)
To: barebox
On 17:48 Wed 12 Sep , Jean-Christophe PLAGNIOL-VILLARD wrote:
> To be able to pass the loadaddr of the image and the initrd.
>
can we have this on master
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> commands/bootm.c | 25 +++++++++++++++++++++++--
> 1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/commands/bootm.c b/commands/bootm.c
> index 2d9f7f2..dfd9ac9 100644
> --- a/commands/bootm.c
> +++ b/commands/bootm.c
> @@ -254,6 +254,19 @@ static char *bootm_image_name_and_no(const char *name, int *no)
> #define BOOTM_OPTS BOOTM_OPTS_COMMON
> #endif
>
> +static 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;
> @@ -273,8 +286,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 +462,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;
> }
> @@ -480,7 +499,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 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] 5+ messages in thread
* Re: [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support
2012-09-12 15:48 [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 14:54 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-16 20:41 ` Sascha Hauer
2012-10-17 6:54 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-10-16 20:41 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Sep 12, 2012 at 05:48:22PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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 | 25 +++++++++++++++++++++++--
> 1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/commands/bootm.c b/commands/bootm.c
> index 2d9f7f2..dfd9ac9 100644
> --- a/commands/bootm.c
> +++ b/commands/bootm.c
> @@ -254,6 +254,19 @@ static char *bootm_image_name_and_no(const char *name, int *no)
> #define BOOTM_OPTS BOOTM_OPTS_COMMON
> #endif
>
> +static 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;
> @@ -273,8 +286,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");
This needs to be in the 'if' below.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support
2012-10-16 20:41 ` Sascha Hauer
@ 2012-10-17 6:54 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-17 6:54 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 22:41 Tue 16 Oct , Sascha Hauer wrote:
> On Wed, Sep 12, 2012 at 05:48:22PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 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 | 25 +++++++++++++++++++++++--
> > 1 file changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/commands/bootm.c b/commands/bootm.c
> > index 2d9f7f2..dfd9ac9 100644
> > --- a/commands/bootm.c
> > +++ b/commands/bootm.c
> > @@ -254,6 +254,19 @@ static char *bootm_image_name_and_no(const char *name, int *no)
> > #define BOOTM_OPTS BOOTM_OPTS_COMMON
> > #endif
> >
> > +static 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;
> > @@ -273,8 +286,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");
>
> This needs to be in the 'if' below.
no need if not present the address as set to SOME_ADDRESS
and this save nearly no space 8 bytes
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support
2012-10-16 14:54 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-17 9:38 ` Renaud Barbier
0 siblings, 0 replies; 5+ messages in thread
From: Renaud Barbier @ 2012-10-17 9:38 UTC (permalink / raw)
To: barebox
On 16/10/12 15:54, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:48 Wed 12 Sep , Jean-Christophe PLAGNIOL-VILLARD wrote:
>> To be able to pass the loadaddr of the image and the initrd.
>> @@ -480,7 +499,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 loadaadr");
Should not "loadaadr" be "loadaddr" at the end of the line above.
>> 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");
Same here.
>>
>> 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
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-17 9:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12 15:48 [PATCH v4] bootm: add global bootm.{image/initrd}.loadaddr support Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 14:54 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-17 9:38 ` Renaud Barbier
2012-10-16 20:41 ` Sascha Hauer
2012-10-17 6:54 ` Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox