qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] fix PPC OpenHackWare for Linux 2.6


From: René Rebe
Subject: [Qemu-devel] [PATCH] fix PPC OpenHackWare for Linux 2.6
Date: Tue, 06 May 2008 18:00:11 +0200
User-agent: Thunderbird 2.0.0.9 (X11/20080105)

Hi all,

after quite some debugging thru the early startup code of Linux 2.6
I fixed some issues in the OpenHackWare "BIOS" for PPC emulation.

The diff below is against the Qemu pc-bios/ohw.diff, I can also
provide the resulting binary if interested.

First I fixed the linker script to actually work at all (actually
I also installed an old toolchain, just to find out that even that
one would not link OHW, ...

Second, Linux 2.6 flatten_device_tree stuff in arch/powerpc/kernel/prom_init.c
check for a return value of 1, as I do not have the IEEE spec on my desk
I assumed it means success, and with the change the flattened device
tree is no longer empty, helping a great deal continuing to boot ...

Third, when selecting a core99 machine, Linux assumes to find an NVRAM,
and panics in some init_timer if there isn't one. Though a core99 machine
does not yet work perfectly, further investigation to be done.

Linewise the FB CLUT is with Linux 2.6 has some issue and the FB thus
shows false colors, but good enough to work with for now.

Oh, and last but not least with a self built prom, I hit this
"error booting from CD-ROM bug, that Jocelyn hacked around in
r3309. As that was just a binary only blob fix and there is no
newer version of OHW I just commented out the "return on error"
which allowed to boot CD images on my side.

As this is the first nightly track thru the guts of Qemu any
comment welcome:

--- qemu-svn/pc-bios/ohw.diff   (revision 4353)
+++ qemu-svn/pc-bios/ohw.diff   (working copy)
@@ -1,3 +1,19 @@
+Make it link at al.
+
+  - Rene Rebe <address@hidden>
+
+--- OpenHackWare-release-0.4/src/main.ld       2005-03-31 09:23:33.000000000 
+0200
++++ OpenHackWare-release-0.4-hacked/src/main.ld        2008-05-06 
11:23:29.000000000 +0200
+@@ -49,7 +49,7 @@
+         _sdata_end = . ;
+         . = ALIGN(4) ;
+         _ro_start = . ;
+-        .rodata    : { *(.rodata) } > bios
++        .rodata    : { *(.rodata*) } > bios
+         _ro_end = . ;
+         . = ALIGN(4) ;
+         _RTAS_start = .;
+
 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' 
--exclude mkdiff OpenHackWare-release-0.4.org/src/bios.h 
OpenHackWare-release-0.4/src/bios.h
 --- OpenHackWare-release-0.4.org/src/bios.h    2005-04-06 23:20:22.000000000 
+0200
 +++ OpenHackWare-release-0.4/src/bios.h        2005-07-07 01:10:20.000000000 
+0200
@@ -748,24 +764,14 @@
          {
              /* Hack taken 'as-is' from PearPC */
              unsigned char info[] = {
-@@ -1596,7 +1627,9 @@
-         OF_node_put(OF_env, brom);
+@@ -1596,6 +1627,7 @@
          OF_node_put(OF_env, rom);
      }
-+#if 0
      /* From here, hardcoded hacks to get a Mac-like machine */
-+    /* XXX: Core99 does not seem to like this NVRAM tree */
++    /* XXX: Not yet perfect, but Linux 2.6 does oops on boot on Core99 
without NVRAM node */
      /* "/address@hidden" node */
      {
          OF_regprop_t regs;
-@@ -1617,6 +1650,7 @@
-         OF_prop_int_new(OF_env, chs, "nvram", OF_pack_handle(OF_env, nvr));
-         OF_node_put(OF_env, nvr);
-     }
-+#endif
-     /* "/pseudo-hid" : hid emulation as Apple does */
-     {
-         OF_node_t *hid;
 @@ -1663,7 +1697,27 @@
          }
          OF_node_put(OF_env, hid);
@@ -1841,3 +1847,40 @@
      case ARCH_MAC99:
          /* We are supposed to have 3 host bridges:
           * - the uninorth AGP bridge at 0xF0000000
+
+
+The 2.6 Linux kernel checks for 1, as I do not have the IEEE spec on
+my desk I can only guess it should return 1 on success, not the
+string length.
+
+  - Rene Rebe <address@hidden>
+
+--- OpenHackWare-release-0.4/src/of.c  2005-04-06 23:17:26.000000000 +0200
++++ OpenHackWare-release-0.4-hacked/src/of.c   2008-05-06 14:50:48.000000000 
+0200
+@@ -3841,7 +4061,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); /* ReneR: Linux 2.6 flatten_device_tree */
+         }
+     }
+ }
+
+
+In qemu r3309 j_mayer did some "Quickly hack PowerPC BIOS able to boot
+on CDROM again.", as I did not feel like disassemble to find out this
+worked for me for now.
+
+  - Rene Rebe <address@hidden>
+
+--- OpenHackWare-release-0.4/src/bloc.c        2005-04-06 23:21:00.000000000 
+0200
++++ OpenHackWare-release-0.4-hacked/src/bloc.c 2008-05-06 14:20:10.000000000 
+0200
+@@ -1021,7 +1038,7 @@
+         status = ide_port_read(bd, 0x07);
+         if (status != 0x08) {
+             ERROR("ATAPI TEST_UNIT_READY : status %0x != 0x08\n", status);
+-            return -1;
++            /*return -1;*/ /* fails to boot from cdrom? */
+         }
+         for (i = 0; i < 3; i++) {


--
  René Rebe - ExactCODE GmbH - Europe, Germany, Berlin
  http://exactcode.de | http://t2-project.org | http://rene.rebe.name




reply via email to

[Prev in Thread] Current Thread [Next in Thread]