mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Fix uInitrd handling
@ 2013-05-02  9:07 Uwe Kleine-König
  2013-05-02  9:07 ` [PATCH RFC 1/2] bootm: Simplify initrd address handling Uwe Kleine-König
  2013-05-02  9:07 ` [PATCH RFC 2/2] Don't honor initrd load address Uwe Kleine-König
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2013-05-02  9:07 UTC (permalink / raw)
  To: barebox

Hello,

U-Boot doesn't honor the load address of uInitrd images but just places it
somewhere in RAM. So it's sensible to let barebox not being more strict
than U-Boot.

This makes it possible to boot a Debian system on an i.MX53 Loco board
with the setup prepared by flash-kernel. That uInitrd uses a load
address of 0x0 where there is nothing on i.MX53.

This series contains an additional cleanup. I'm not 100% sure it's ok
though. Is it intended that UIMAGE_SOME_ADDRESS being passed to bootm
not being used literally? Should I squash the cleanup in the other
commit? Also a similar simplification might be possible for the load
address of the uImage.

Sascha Hauer (1):
  Don't honor initrd load address

Uwe Kleine-König (1):
  bootm: Simplify initrd address handling

 commands/bootm.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

-- 
1.8.2.rc2


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

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

* [PATCH RFC 1/2] bootm: Simplify initrd address handling
  2013-05-02  9:07 [PATCH RFC 0/2] Fix uInitrd handling Uwe Kleine-König
@ 2013-05-02  9:07 ` Uwe Kleine-König
  2013-05-03  4:24   ` Sascha Hauer
  2013-05-02  9:07 ` [PATCH RFC 2/2] Don't honor initrd load address Uwe Kleine-König
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2013-05-02  9:07 UTC (permalink / raw)
  To: barebox

	data.initrd_address = UIMAGE_SOME_ADDRESS;
	...
	if (-L was given to bootm)
		data.initrd_address = address_provided_to_-L;
	...
	if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_SOME_ADDRESS)
		data.initrd_address = load_address_from_uInitrd;
	...
	if (data.initrd_address == UIMAGE_SOME_ADDRESS)
		data.initrd_address = UIMAGE_INVALID_ADDRESS;

can be simplified to:

	data.initrd_address = UIMAGE_INVALID_ADDRESS;
	...
	if (-L was given to bootm)
		data.initrd_address = address_provided_to_-L;
	...
	if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_INVALID_ADDRESS)
		data.initrd_address = load_address_from_uInitrd;
	...

The only change introduced by this simplification is for cases where the
user passes -L UIMAGE_SOME_ADDRESS or -L UIMAGE_INVALID_ADDRESS to
bootm. (-L UIMAGE_SOME_ADDRESS is now used literally instead of ignored
before. -L UIMAGE_INVALID_ADDRESS used to skip getting the
initrd-address from the uInitrd, now the uInitrd address is honored.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 commands/bootm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index e5dfc6a..bb44776 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -127,7 +127,7 @@ static int bootm_open_initrd_uimage(struct image_data *data)
 		data->initrd = data->os;
 	}
 
-	if (data->initrd_address == UIMAGE_SOME_ADDRESS)
+	if (data->initrd_address == UIMAGE_INVALID_ADDRESS)
 		data->initrd_address = data->initrd->header.ih_load;
 
 	return 0;
@@ -256,7 +256,7 @@ static int do_bootm(int argc, char *argv[])
 
 	memset(&data, 0, sizeof(struct image_data));
 
-	data.initrd_address = UIMAGE_SOME_ADDRESS;
+	data.initrd_address = UIMAGE_INVALID_ADDRESS;
 	data.os_address = UIMAGE_SOME_ADDRESS;
 	data.verify = 0;
 	data.verbose = 0;
@@ -408,8 +408,6 @@ static int do_bootm(int argc, char *argv[])
 #endif
 	if (data.os_address == UIMAGE_SOME_ADDRESS)
 		data.os_address = UIMAGE_INVALID_ADDRESS;
-	if (data.initrd_address == UIMAGE_SOME_ADDRESS)
-		data.initrd_address = UIMAGE_INVALID_ADDRESS;
 
 	handler = bootm_find_handler(os_type, &data);
 	if (!handler) {
-- 
1.8.2.rc2


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

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

* [PATCH RFC 2/2] Don't honor initrd load address
  2013-05-02  9:07 [PATCH RFC 0/2] Fix uInitrd handling Uwe Kleine-König
  2013-05-02  9:07 ` [PATCH RFC 1/2] bootm: Simplify initrd address handling Uwe Kleine-König
@ 2013-05-02  9:07 ` Uwe Kleine-König
  1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2013-05-02  9:07 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

U-Boot doesn't honor the load address specified in an initrd. Barebox
shouldn't be more strict here. This unbreaks booting an uInitrd
generated by Debian's flash-kernel that uses 0 as entry address where
there is nothing on the i.MX53 that was used.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 commands/bootm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index bb44776..5dd1703 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -127,9 +127,6 @@ static int bootm_open_initrd_uimage(struct image_data *data)
 		data->initrd = data->os;
 	}
 
-	if (data->initrd_address == UIMAGE_INVALID_ADDRESS)
-		data->initrd_address = data->initrd->header.ih_load;
-
 	return 0;
 }
 
-- 
1.8.2.rc2


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

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

* Re: [PATCH RFC 1/2] bootm: Simplify initrd address handling
  2013-05-02  9:07 ` [PATCH RFC 1/2] bootm: Simplify initrd address handling Uwe Kleine-König
@ 2013-05-03  4:24   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-05-03  4:24 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Thu, May 02, 2013 at 11:07:11AM +0200, Uwe Kleine-König wrote:
> 	data.initrd_address = UIMAGE_SOME_ADDRESS;
> 	...
> 	if (-L was given to bootm)
> 		data.initrd_address = address_provided_to_-L;
> 	...
> 	if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_SOME_ADDRESS)
> 		data.initrd_address = load_address_from_uInitrd;
> 	...
> 	if (data.initrd_address == UIMAGE_SOME_ADDRESS)
> 		data.initrd_address = UIMAGE_INVALID_ADDRESS;
> 
> can be simplified to:
> 
> 	data.initrd_address = UIMAGE_INVALID_ADDRESS;
> 	...
> 	if (-L was given to bootm)
> 		data.initrd_address = address_provided_to_-L;
> 	...
> 	if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_INVALID_ADDRESS)
> 		data.initrd_address = load_address_from_uInitrd;
> 	...
> 
> The only change introduced by this simplification is for cases where the
> user passes -L UIMAGE_SOME_ADDRESS or -L UIMAGE_INVALID_ADDRESS to
> bootm. (-L UIMAGE_SOME_ADDRESS is now used literally instead of ignored
> before. -L UIMAGE_INVALID_ADDRESS used to skip getting the
> initrd-address from the uInitrd, now the uInitrd address is honored.)

And now I remember why I did that in the first place. It was to be able
to explicitly ignore a uInitrd load address from an image. Anyway, since
we ignore this address in any case with the next patch these patches are
ok.


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

end of thread, other threads:[~2013-05-03  4:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-02  9:07 [PATCH RFC 0/2] Fix uInitrd handling Uwe Kleine-König
2013-05-02  9:07 ` [PATCH RFC 1/2] bootm: Simplify initrd address handling Uwe Kleine-König
2013-05-03  4:24   ` Sascha Hauer
2013-05-02  9:07 ` [PATCH RFC 2/2] Don't honor initrd load address Uwe Kleine-König

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