summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2013-04-25 14:49:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-04-26 07:27:08 +0200
commit97c636365ec043cdb6ecdb661a8e10dcfec779ba (patch)
treec3ad9589f3662a92a2f447ba82dec142085a3ed1
parent8bafdc1c46caf86546ad11de815cff774526d033 (diff)
downloadbarebox-97c636365ec043cdb6ecdb661a8e10dcfec779ba.tar.gz
barebox-97c636365ec043cdb6ecdb661a8e10dcfec779ba.tar.xz
of: fix how an initrd is passed to Linux
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/of/base.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d22031f32f..5894caf66b 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 to 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;