From: Ed Swierk <eswierk@arastra.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] OpenHackWare hacking
Date: Fri, 20 Apr 2007 16:08:56 -0700 [thread overview]
Message-ID: <200704201608.56320.eswierk@arastra.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]
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
[-- Attachment #2: ohw2.patch --]
[-- Type: text/x-diff, Size: 2711 bytes --]
[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);
}
}
}
next reply other threads:[~2007-04-20 23:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-20 23:08 Ed Swierk [this message]
2007-04-23 5:10 ` [Qemu-devel] OpenHackWare hacking Ed Swierk
2007-04-25 12:13 ` David Woodhouse
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=200704201608.56320.eswierk@arastra.com \
--to=eswierk@arastra.com \
--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).