mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: fix how an initrd is passed to Linux
@ 2013-04-25 12:49 Uwe Kleine-König
  2013-04-25 21:00 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2013-04-25 12:49 UTC (permalink / raw)
  To: barebox

Linux expects linux,initrd-end to contain the first unused address. As
this doesn't match the end semantic used by barebox (i.e. end contains
the last used address) adding one is necessary.

Without this change Linux fails for me to correctly extract a gzipped
cpio archive provided as initrd.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/of/base.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index d22031f..6cb5521 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1078,6 +1078,10 @@ int of_device_is_stdout_path(struct device_d *dev)
  *
  * Add initrd properties to the devicetree, or, if end is 0,
  * delete them.
+ *
+ * Note that Linux interprets end differently than Barebox. For Linux end points
+ * to the first address after the memory occupied by the image while barebox
+ * lets end pointing the the last occupied byte.
  */
 int of_add_initrd(struct device_node *root, resource_size_t start,
 		resource_size_t end)
@@ -1092,7 +1096,7 @@ int of_add_initrd(struct device_node *root, resource_size_t start,
 	if (end) {
 		of_write_number(buf, start, 2);
 		of_set_property(chosen, "linux,initrd-start", buf, 8, 1);
-		of_write_number(buf, end, 2);
+		of_write_number(buf, end + 1, 2);
 		of_set_property(chosen, "linux,initrd-end", buf, 8, 1);
 	} else {
 		struct property *pp;
-- 
1.8.2.rc2


_______________________________________________
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-04-26  5:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-25 12:49 [PATCH] of: fix how an initrd is passed to Linux Uwe Kleine-König
2013-04-25 21:00 ` Uwe Kleine-König
2013-04-26  5:27   ` Sascha Hauer

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