From: Guenter Roeck <linux@roeck-us.net>
To: qemu-devel@nongnu.org
Cc: Guenter Roeck <linux@roeck-us.net>
Subject: [Qemu-devel] [PATCH] target-sh4: Fix initrd initialization for endiannes-mismatched targets
Date: Wed, 8 Oct 2014 13:58:46 -0700 [thread overview]
Message-ID: <1412801926-22493-1-git-send-email-linux@roeck-us.net> (raw)
If host and target endianness does not match, loding an initrd does not
work, but results in a kernel log message similar to the following.
... MOUNT_ROOT_RDONLY - 00000000
... RAMDISK_FLAGS - 00000000
... ORIG_ROOT_DEV - 00000000
... LOADER_TYPE - 01000000
... INITRD_START - 00008001
... INITRD_SIZE - 00a01b00
Booting machvec: RTS7751R2D
initrd must be page aligned
initrd disabled
Fix by writing boot parameters with appropriate endianness conversion.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
hw/sh4/r2d.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index 321379e..d86eb12 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -336,9 +336,9 @@ static void r2d_init(MachineState *machine)
}
/* initialization which should be done by firmware */
- boot_params.loader_type = 1;
- boot_params.initrd_start = INITRD_LOAD_OFFSET;
- boot_params.initrd_size = initrd_size;
+ boot_params.loader_type = tswap32(1);
+ boot_params.initrd_start = tswap32(INITRD_LOAD_OFFSET);
+ boot_params.initrd_size = tswap32(initrd_size);
}
if (kernel_cmdline) {
--
1.9.1
reply other threads:[~2014-10-08 20:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1412801926-22493-1-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).