From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] of: fix how an initrd is passed to Linux
Date: Thu, 25 Apr 2013 14:49:47 +0200 [thread overview]
Message-ID: <1366894187-25299-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
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
next reply other threads:[~2013-04-25 12:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 12:49 Uwe Kleine-König [this message]
2013-04-25 21:00 ` Uwe Kleine-König
2013-04-26 5:27 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366894187-25299-1-git-send-email-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox