From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbyK8-0007E4-NJ for qemu-devel@nongnu.org; Wed, 08 Oct 2014 16:59:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbyK1-0002y0-DQ for qemu-devel@nongnu.org; Wed, 08 Oct 2014 16:59:04 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:51068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbyK1-0002x1-6C for qemu-devel@nongnu.org; Wed, 08 Oct 2014 16:58:57 -0400 Received: from mailnull by bh-25.webhostbox.net with sa-checked (Exim 4.82) (envelope-from ) id 1XbyJz-002EaS-E8 for qemu-devel@nongnu.org; Wed, 08 Oct 2014 20:58:55 +0000 From: Guenter Roeck Date: Wed, 8 Oct 2014 13:58:46 -0700 Message-Id: <1412801926-22493-1-git-send-email-linux@roeck-us.net> Subject: [Qemu-devel] [PATCH] target-sh4: Fix initrd initialization for endiannes-mismatched targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Guenter Roeck 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 --- 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