From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hf2J4-0000UL-Bn for qemu-devel@nongnu.org; Fri, 20 Apr 2007 19:14:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hf2J3-0000U9-OW for qemu-devel@nongnu.org; Fri, 20 Apr 2007 19:14:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hf2J3-0000U6-G9 for qemu-devel@nongnu.org; Fri, 20 Apr 2007 19:14:21 -0400 Received: from zimbra.mindcentric.com ([216.98.159.230] helo=zimbra1.mindcentric.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hf2Dw-00030r-4c for qemu-devel@nongnu.org; Fri, 20 Apr 2007 19:09:04 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra1.mindcentric.com (Postfix) with ESMTP id D9DC9317C14A for ; Fri, 20 Apr 2007 16:12:19 -0700 (PDT) Received: from zimbra1.mindcentric.com ([127.0.0.1]) by localhost (zimbra1.mindcentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7WXRjTG0Hlfe for ; Fri, 20 Apr 2007 16:12:18 -0700 (PDT) Received: from [172.27.201.191] (unknown [69.64.204.50]) by zimbra1.mindcentric.com (Postfix) with ESMTP id 60CAA317C11D for ; Fri, 20 Apr 2007 16:12:18 -0700 (PDT) From: Ed Swierk Date: Fri, 20 Apr 2007 16:08:56 -0700 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_IgUKGxDCKal7ASm" Message-Id: <200704201608.56320.eswierk@arastra.com> Subject: [Qemu-devel] OpenHackWare hacking Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Boundary-00=_IgUKGxDCKal7ASm Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline The attached patch addresses a few problems in OpenHackWare: - The return value from the OpenFirmware read function should not exceed the actual file size by more than one block; otherwise the Linux kernel's initramfs routines get confused by the extra junk and reject the initramfs. - The OpenFirmware nextprop function should return 1 when a property is found, not the length of the property's name. Otherwise Linux fails to find any properties when unflattening the device tree. - If the boot file's checksum is unknown, OpenHackWare should assume it's a Linux or OpenBSD boot script rather than barfing. - The linker script requires Daniel Jacobowitz's fix to build on Fedora 6. These changes get me a few steps closer to booting an unmodified Fedora 6 PowerPC boot.iso. Outstanding issues include: - The Fedora 6 version of yaboot looks for a "conf=" parameter in the bootargs to tell it where to find yaboot.conf; OHW needs to read this parameter from the boot script and pass it along. - After the kernel finally boots, it complains about unhandled interrupts for the CD device. I assume this is a Qemu issue. Comments welcome. --Ed --Boundary-00=_IgUKGxDCKal7ASm Content-Type: text/x-diff; charset="us-ascii"; name="ohw2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ohw2.patch" [5~[5~[5~[5~diff -BurN OpenHackWare-release-0.4/src/libexec/chrp.c OpenHackWare-release-0.4.mine/src/libexec/chrp.c --- OpenHackWare-release-0.4/src/libexec/chrp.c 2005-03-30 23:23:33.000000000 -0800 +++ OpenHackWare-release-0.4.mine/src/libexec/chrp.c 2007-04-19 13:06:53.000000000 -0700 @@ -243,9 +243,8 @@ DPRINTF("Boot file embedded at the end of boot script\n"); break; default: - ERROR("XML error: unknown Forth script: %08x\n%s\n", - crc, (char *)tag->data); - goto out; + script_type = CHRP_SCRIPT_LOAD_BOOT; + goto do_script; } break; diff -BurN OpenHackWare-release-0.4/src/libfs/core.c OpenHackWare-release-0.4.mine/src/libfs/core.c --- OpenHackWare-release-0.4/src/libfs/core.c 2005-03-30 23:23:33.000000000 -0800 +++ OpenHackWare-release-0.4.mine/src/libfs/core.c 2007-04-20 15:50:02.000000000 -0700 @@ -421,13 +421,15 @@ int fs_read (inode_t *inode, void *buffer, int len) { - uint32_t bsize, total; + uint32_t bsize, total, max; int done, tmp; bsize = part_blocsize(inode->fs->part); total = 0; if (fs_seek(inode, inode->vbloc, inode->vpos) < 0) return -1; + max = inode->size.bloc * bsize + inode->size.offset + - inode->vbloc * bsize + inode->vpos; for (; len != 0; len -= done) { tmp = bsize - inode->vpos; if (len < tmp) @@ -444,6 +446,8 @@ total += done; } + if (total > max) + return max; return total; } diff -BurN OpenHackWare-release-0.4/src/main.ld OpenHackWare-release-0.4.mine/src/main.ld --- OpenHackWare-release-0.4/src/main.ld 2005-03-30 23:23:33.000000000 -0800 +++ OpenHackWare-release-0.4.mine/src/main.ld 2007-04-19 13:01:25.000000000 -0700 @@ -49,7 +49,7 @@ _sdata_end = . ; . = ALIGN(4) ; _ro_start = . ; - .rodata : { *(.rodata) } > bios + .rodata : { *(.rodata*) } > bios _ro_end = . ; . = ALIGN(4) ; _RTAS_start = .; diff -BurN OpenHackWare-release-0.4/src/of.c OpenHackWare-release-0.4.mine/src/of.c --- OpenHackWare-release-0.4/src/of.c 2007-04-20 15:46:23.000000000 -0700 +++ OpenHackWare-release-0.4.mine/src/of.c 2007-04-20 14:56:56.000000000 -0700 @@ -4058,7 +4058,7 @@ OF_DPRINTF("Return property name [%s]\n", next->name); OF_sts(next_name, (void *)(next->name)); OF_DUMP_STRING(OF_env, next_name); - pushd(OF_env, strlen(next->name) + 1); + pushd(OF_env, 1); } } } --Boundary-00=_IgUKGxDCKal7ASm--