mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] bootm: update os_entry from uimage
@ 2013-09-20  5:06 Jean-Christophe PLAGNIOL-VILLARD
  2013-09-20  7:06 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-09-20  5:06 UTC (permalink / raw)
  To: barebox

if not uimage set 0 by default

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

diff --git a/commands/bootm.c b/commands/bootm.c
index a4004df..7acf341 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -104,6 +104,7 @@ static int do_bootm(int argc, char *argv[])
 
 	data.initrd_address = UIMAGE_INVALID_ADDRESS;
 	data.os_address = UIMAGE_SOME_ADDRESS;
+	data.os_entry = UIMAGE_SOME_ADDRESS;
 	data.verify = 0;
 	data.verbose = 0;
 
diff --git a/common/bootm.c b/common/bootm.c
index 1987a09..da2b85d 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -46,6 +46,7 @@ static struct image_handler *bootm_find_handler(enum filetype filetype,
 static int bootm_open_os_uimage(struct image_data *data)
 {
 	int ret;
+	int update_ep = 0;
 
 	data->os = uimage_open(data->os_file);
 	if (!data->os)
@@ -70,8 +71,10 @@ static int bootm_open_os_uimage(struct image_data *data)
 		return -EINVAL;
 	}
 
-	if (data->os_address == UIMAGE_SOME_ADDRESS)
+	if (data->os_address == UIMAGE_SOME_ADDRESS) {
 		data->os_address = data->os->header.ih_load;
+		update_ep = 1;
+	}
 
 	if (data->os_address != UIMAGE_INVALID_ADDRESS) {
 		data->os_res = uimage_load_to_sdram(data->os, 0,
@@ -80,6 +83,13 @@ static int bootm_open_os_uimage(struct image_data *data)
 			uimage_close(data->os);
 			return -ENOMEM;
 		}
+
+	}
+
+	if (update_ep && data->os_entry == UIMAGE_SOME_ADDRESS) {
+		data->os_entry = data->os->header.ih_ep;
+		if (data->os_address != UIMAGE_INVALID_ADDRESS)
+			data->os_entry -= data->os_address;
 	}
 
 	return 0;
@@ -232,6 +242,9 @@ int bootm_boot(struct image_data *data)
 		}
 	}
 
+	if (data.os_entry == UIMAGE_SOME_ADDRESS)
+		data.os_entry = 0;
+
 	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data->initrd_file) {
 
 		initrd_type = file_name_detect_type(data->initrd_file);
-- 
1.8.4.rc1


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

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

* Re: [PATCH 1/1] bootm: update os_entry from uimage
  2013-09-20  5:06 [PATCH 1/1] bootm: update os_entry from uimage Jean-Christophe PLAGNIOL-VILLARD
@ 2013-09-20  7:06 ` Sascha Hauer
  2013-09-20  7:57   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2013-09-20  7:06 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Sep 20, 2013 at 07:06:24AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> if not uimage set 0 by default

Can you elaborate more what this patch does and in which situations it
helps?

Sascha

> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  commands/bootm.c |  1 +
>  common/bootm.c   | 15 ++++++++++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/commands/bootm.c b/commands/bootm.c
> index a4004df..7acf341 100644
> --- a/commands/bootm.c
> +++ b/commands/bootm.c
> @@ -104,6 +104,7 @@ static int do_bootm(int argc, char *argv[])
>  
>  	data.initrd_address = UIMAGE_INVALID_ADDRESS;
>  	data.os_address = UIMAGE_SOME_ADDRESS;
> +	data.os_entry = UIMAGE_SOME_ADDRESS;
>  	data.verify = 0;
>  	data.verbose = 0;
>  
> diff --git a/common/bootm.c b/common/bootm.c
> index 1987a09..da2b85d 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -46,6 +46,7 @@ static struct image_handler *bootm_find_handler(enum filetype filetype,
>  static int bootm_open_os_uimage(struct image_data *data)
>  {
>  	int ret;
> +	int update_ep = 0;
>  
>  	data->os = uimage_open(data->os_file);
>  	if (!data->os)
> @@ -70,8 +71,10 @@ static int bootm_open_os_uimage(struct image_data *data)
>  		return -EINVAL;
>  	}
>  
> -	if (data->os_address == UIMAGE_SOME_ADDRESS)
> +	if (data->os_address == UIMAGE_SOME_ADDRESS) {
>  		data->os_address = data->os->header.ih_load;
> +		update_ep = 1;
> +	}
>  
>  	if (data->os_address != UIMAGE_INVALID_ADDRESS) {
>  		data->os_res = uimage_load_to_sdram(data->os, 0,
> @@ -80,6 +83,13 @@ static int bootm_open_os_uimage(struct image_data *data)
>  			uimage_close(data->os);
>  			return -ENOMEM;
>  		}
> +
> +	}
> +
> +	if (update_ep && data->os_entry == UIMAGE_SOME_ADDRESS) {
> +		data->os_entry = data->os->header.ih_ep;
> +		if (data->os_address != UIMAGE_INVALID_ADDRESS)
> +			data->os_entry -= data->os_address;
>  	}
>  
>  	return 0;
> @@ -232,6 +242,9 @@ int bootm_boot(struct image_data *data)
>  		}
>  	}
>  
> +	if (data.os_entry == UIMAGE_SOME_ADDRESS)
> +		data.os_entry = 0;
> +
>  	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data->initrd_file) {
>  
>  		initrd_type = file_name_detect_type(data->initrd_file);
> -- 
> 1.8.4.rc1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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] 3+ messages in thread

* Re: [PATCH 1/1] bootm: update os_entry from uimage
  2013-09-20  7:06 ` Sascha Hauer
@ 2013-09-20  7:57   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-09-20  7:57 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 09:06 Fri 20 Sep     , Sascha Hauer wrote:
> On Fri, Sep 20, 2013 at 07:06:24AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > if not uimage set 0 by default
> 
> Can you elaborate more what this patch does and in which situations it
> helps?

today we do not see the issue as the kernel entry point is the same as the
load_addr but on other binary its not necessary the case

as today we ignore the entry point set in the uimage and just assume it's the
same as the load_addr
> 
> Sascha
> 
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  commands/bootm.c |  1 +
> >  common/bootm.c   | 15 ++++++++++++++-
> >  2 files changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/commands/bootm.c b/commands/bootm.c
> > index a4004df..7acf341 100644
> > --- a/commands/bootm.c
> > +++ b/commands/bootm.c
> > @@ -104,6 +104,7 @@ static int do_bootm(int argc, char *argv[])
> >  
> >  	data.initrd_address = UIMAGE_INVALID_ADDRESS;
> >  	data.os_address = UIMAGE_SOME_ADDRESS;
> > +	data.os_entry = UIMAGE_SOME_ADDRESS;
> >  	data.verify = 0;
> >  	data.verbose = 0;
> >  
> > diff --git a/common/bootm.c b/common/bootm.c
> > index 1987a09..da2b85d 100644
> > --- a/common/bootm.c
> > +++ b/common/bootm.c
> > @@ -46,6 +46,7 @@ static struct image_handler *bootm_find_handler(enum filetype filetype,
> >  static int bootm_open_os_uimage(struct image_data *data)
> >  {
> >  	int ret;
> > +	int update_ep = 0;
> >  
> >  	data->os = uimage_open(data->os_file);
> >  	if (!data->os)
> > @@ -70,8 +71,10 @@ static int bootm_open_os_uimage(struct image_data *data)
> >  		return -EINVAL;
> >  	}
> >  
> > -	if (data->os_address == UIMAGE_SOME_ADDRESS)
> > +	if (data->os_address == UIMAGE_SOME_ADDRESS) {
> >  		data->os_address = data->os->header.ih_load;
> > +		update_ep = 1;
> > +	}
> >  
> >  	if (data->os_address != UIMAGE_INVALID_ADDRESS) {
> >  		data->os_res = uimage_load_to_sdram(data->os, 0,
> > @@ -80,6 +83,13 @@ static int bootm_open_os_uimage(struct image_data *data)
> >  			uimage_close(data->os);
> >  			return -ENOMEM;
> >  		}
> > +
> > +	}
> > +
> > +	if (update_ep && data->os_entry == UIMAGE_SOME_ADDRESS) {
> > +		data->os_entry = data->os->header.ih_ep;
> > +		if (data->os_address != UIMAGE_INVALID_ADDRESS)
> > +			data->os_entry -= data->os_address;
> >  	}
> >  
> >  	return 0;
> > @@ -232,6 +242,9 @@ int bootm_boot(struct image_data *data)
> >  		}
> >  	}
> >  
> > +	if (data.os_entry == UIMAGE_SOME_ADDRESS)
> > +		data.os_entry = 0;
> > +
> >  	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data->initrd_file) {
> >  
> >  		initrd_type = file_name_detect_type(data->initrd_file);
> > -- 
> > 1.8.4.rc1
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> 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] 3+ messages in thread

end of thread, other threads:[~2013-09-20  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-20  5:06 [PATCH 1/1] bootm: update os_entry from uimage Jean-Christophe PLAGNIOL-VILLARD
2013-09-20  7:06 ` Sascha Hauer
2013-09-20  7:57   ` 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