GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

It seems some interesting progress has been made during my holidays ;-)
I'll create a new build for OSX in the next few days.

Best,
Cat_7
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by sentient06 »

kataetheweirdo wrote:That's something tricky to catch there. I might want to look into some of the other troublesome parts of PowerPC Mac emulation. I wonder if there are still any issues involving OpenTransport though. Searching up OTRunPortScanners isn't turning up much, if at all, even in the documents sentient provided.
Hi kataetheweirdo,

I suppose you saw this one?

http://web.archive.org/web/200101212224 ... nners.html

Is this the kind of stuff you need more info about? Let me know, so I will keep an eye open. o/
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

Hi,

An OSX build of Qemu pre 2.7 with patched OpenBios is now able to boot unaltered 9.1 and 9.2 images. 9.0 still seems to be a no-no ;-)
Pick up the download in the forum http://www.emaculation.com/forum/viewto ... =34&t=8848

Best,
Cat_7
PeterHolbrook
Apple Corer
Posts: 273
Joined: Fri Oct 26, 2007 7:56 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by PeterHolbrook »

Cat_7 wrote:An OSX build of Qemu pre 2.7 with patched OpenBios is now able to boot unaltered 9.1 and 9.2 images.
When you mention 9.2, do you mean the 9.2 itself, or just its installer? If it's the former, have all the Open Transport issues been ironed out?
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by mcayland »

Cat_7 wrote:Hi,

An OSX build of Qemu pre 2.7 with patched OpenBios is now able to boot unaltered 9.1 and 9.2 images. 9.0 still seems to be a no-no ;-)
Pick up the download in the forum http://www.emaculation.com/forum/viewto ... =34&t=8848

Best,
Cat_7
Which branch did you build from? git master is missing a vital TLB fix and the latest set of DBDMA patches (http://lists.nongnu.org/archive/html/qe ... 00297.html) which are required in order to boot with OpenTransport installed (as is the default). Otherwise you can boot from CDROM and run the installer, but when rebooting into the installed image you'll see a hang/crash.

The most functional branch at the moment is David's queued ppc-for-2.7 branch at https://github.com/dgibson/qemu/commits/ppc-for-2.7 which should be merged into master soon, but otherwise reports to be able to run OS 9.0-9.2 without any obvious issues.
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

Hi,

Yes, I read up on the progress ;-) I built from the dgibson 2.7 pre branch and applied your line-feed patch to latest openbios from github (which still builds nicely in OSX).

This allowed booting unaltered Mac OS 9.1 and 9.2 install CDs, install the OS and boot the resulting hard disks. This success was already reported on the relevant mailing lists.
I believe I had an issue the first time installing, when I allowed the installer to update the apple hard disk drivers after partitioning/formatting the hard disk image. I'll have to double-check this, however.

So the opentransport boot issue seems fixed.
But I couldn't get networking going with 9.1 or 9.2, using the realtek provided rlt8139 driver for Mac OS 9.1/9.2, neither with slirp nor the tap networking solution I came up with some time ago.

My 9.0 image still bombs out. I''ll check the image.

Best,
Cat_7
Last edited by Cat_7 on Tue Jul 12, 2016 3:51 pm, edited 1 time in total.
Reason:  
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by mcayland »

Cat_7 wrote:Hi,

Yes, I read up on the progress ;-) I built from the dgibson 2.7 pre branch and applied your line-feed patch to latest openbios from github (which still builds nicely in OSX).

This allowed booting unaltered Mac OS 9.1 and 9.2 install CDs, install the OS and boot the resulting hard disks. This success was already reported on the relevant mailing lists.
I believe I had an issue the first time installing, when I allowed the installer to update the apple hard disk drivers after partitioning/formatting the hard disk image. I'll have to double-check this, however.

So the opentransport boot issue seems fixed.
But I couldn't get networking going with 9.1 or 9.2, using the realtek provided rlt8139 driver for Mac OS 9.1/9.2, neither with slirp nor the tap networking solution I came up with some time ago.

My 9.0 image still bombs out. I''ll check the image.

Best,
Cat_7
Okay just making sure you're running with the latest and greatest :) For networking, first of all does rtl8139 still work in OS X? Given that we're in a dev cycle it's not unheard of for there to be a regression so eliminate that possibility first.

If that works, what do you mean by the NIC not working? Is the NIC not visible in OS 9? Is it visible but the driver doesn't find it? Or is it visible, the driver finds it, but no traffic appears across the interface? If it's the final option, you can try building with DEBUG_RTL8139 enable in hw/net/rtl8139.c and posting the logs somewhere.
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

Hi,

The rtl8139 still works in OSX when using 10.3 as guest. 10.3 has a driver for this nic.
9.1/9.2 do not, and so I installed the one from realtek. Without it, the options to set tcp/ip manually or through dhcp do not show up as choices in the TCP/IP Control Panel.
I booted 9.2 with a tap device and bridged it to my ethernet connection.

Networking for qemu: -netdev tap,id=network0,script=no,downscript=no -device rtl8139,netdev=network0
And then bridge the connections with:
sudo ifconfig bridge0 create
sudo ifconfig bridge0 up
sudo ifconfig bridge0 addm en0
sudo ifconfig bridge0 addm tap0

This works in 10.3, in 9.22 however, I see no dhcp or dns requests when I use tcpdump on my tap0 device. Only some "Null information, send seq 0, rcv sec 0"

I read some reports that the realtek driver might not be working for 9.1/9.22 at all. We should at least first confirm that this driver can work. ;-)

Best,
Cat_7
User avatar
celebi23
Granny Smith
Posts: 101
Joined: Wed Jun 18, 2008 5:53 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by celebi23 »

Cat_7 wrote:Hi,

An OSX build of Qemu pre 2.7 with patched OpenBios is now able to boot unaltered 9.1 and 9.2 images. 9.0 still seems to be a no-no ;-)
Pick up the download in the forum http://www.emaculation.com/forum/viewto ... =34&t=8848

Best,
Cat_7
Awesome! Thanks! Will mess around with this a bit today.
raidenii
Student Driver
Posts: 13
Joined: Tue Jun 24, 2014 2:06 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by raidenii »

Anyone tried to use Windows as host? I tried the latest sources from both official QEMU git and the one by David Gibson, and cross-compiled it for Windows x64 under Fedora 24, used the patched OpenBIOS image from Cat_7's package, however I still cannot boot the installer, neither with 9.2 or 9.2.2.

QEMU simply stuck at "MacOS: unable to find a usable NVRAM partition - using offset 0x1400".

Here's the command I used to fire up QEMU:

qemu-system-ppcw.exe -M mac99 -cpu G3 -g 1024x768x32 -m 256 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -g 1024x768x32 -net none -drive file=MacOS922.iso,format=raw,media=cdrom -drive file=MacOS922.img,format=raw,media=disk -boot d

Any suggestions?

BTW, the command I used to configure and compile QEMU:

./configure --target-list=ppc-softmmu --cross-prefix=x86_64-w64-mingw32- && make
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by mcayland »

raidenii wrote:Anyone tried to use Windows as host? I tried the latest sources from both official QEMU git and the one by David Gibson, and cross-compiled it for Windows x64 under Fedora 24, used the patched OpenBIOS image from Cat_7's package, however I still cannot boot the installer, neither with 9.2 or 9.2.2.

QEMU simply stuck at "MacOS: unable to find a usable NVRAM partition - using offset 0x1400".

Here's the command I used to fire up QEMU:

qemu-system-ppcw.exe -M mac99 -cpu G3 -g 1024x768x32 -m 256 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -g 1024x768x32 -net none -drive file=MacOS922.iso,format=raw,media=cdrom -drive file=MacOS922.img,format=raw,media=disk -boot d

Any suggestions?

BTW, the command I used to configure and compile QEMU:

./configure --target-list=ppc-softmmu --cross-prefix=x86_64-w64-mingw32- && make
I'm afraid I don't use Windows but your command line is overly complex with some unnecessary repetition. I'd expect that you should be able to get away with the equivalent of this:

./qemu-system-ppc -M mac99 -hda MacOS922.img -cdrom MacOS922.iso -boot d -m 256 -g 1024x768x32

I'm wondering if you're getting stuck with the -drive declarations, since MacOS 9 was very picky about which drives were on which IDE controllers and so without specifying the bus/id as part of the syntax you may well be inadvertently generating an invalid hardware combination.

If that doesn't work, try booting with just the cdrom device to see if its something related to HD which causes boot to fail.
raidenii
Student Driver
Posts: 13
Joined: Tue Jun 24, 2014 2:06 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by raidenii »

mcayland wrote:
raidenii wrote:Anyone tried to use Windows as host? I tried the latest sources from both official QEMU git and the one by David Gibson, and cross-compiled it for Windows x64 under Fedora 24, used the patched OpenBIOS image from Cat_7's package, however I still cannot boot the installer, neither with 9.2 or 9.2.2.

QEMU simply stuck at "MacOS: unable to find a usable NVRAM partition - using offset 0x1400".

Here's the command I used to fire up QEMU:

qemu-system-ppcw.exe -M mac99 -cpu G3 -g 1024x768x32 -m 256 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -g 1024x768x32 -net none -drive file=MacOS922.iso,format=raw,media=cdrom -drive file=MacOS922.img,format=raw,media=disk -boot d

Any suggestions?

BTW, the command I used to configure and compile QEMU:

./configure --target-list=ppc-softmmu --cross-prefix=x86_64-w64-mingw32- && make
I'm afraid I don't use Windows but your command line is overly complex with some unnecessary repetition. I'd expect that you should be able to get away with the equivalent of this:

./qemu-system-ppc -M mac99 -hda MacOS922.img -cdrom MacOS922.iso -boot d -m 256 -g 1024x768x32

I'm wondering if you're getting stuck with the -drive declarations, since MacOS 9 was very picky about which drives were on which IDE controllers and so without specifying the bus/id as part of the syntax you may well be inadvertently generating an invalid hardware combination.

If that doesn't work, try booting with just the cdrom device to see if its something related to HD which causes boot to fail.
Thanks for the suggestion, however it still doesn't work. I omitted the hard drive part in the command and changed the rest to the one you provided, but QEMU still behaves the same way.
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

I never got the 64 bit build to work.

I use:
./configure --cross-prefix=i686-w64-mingw32- --target-list="ppc-softmmu ppc64-softmmu"

But this gave me a whole list of errors (on the dgibson 2-7pre branch) such as this:
hw/misc/macio/mac_dbdma.c: In function 'dbdma_cmdptr_load':
hw/misc/macio/mac_dbdma.c:49:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
#define DEBUG_DBDMA_CHANMASK ((1ul << DBDMA_CHANNELS) - 1)
hw/misc/macio/mac_dbdma.c:59:38: note: in expansion of macro 'DEBUG_DBDMA_CHANMASK'
if ((1ul << (ch)->channel) & DEBUG_DBDMA_CHANMASK) { \

gcc version is 5.2.0 20150716 (Fedora MinGW 5.2.0-1.fc23) (GCC)
raidenii
Student Driver
Posts: 13
Joined: Tue Jun 24, 2014 2:06 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by raidenii »

Cat_7 wrote:I never got the 64 bit build to work.

I use:
./configure --cross-prefix=i686-w64-mingw32- --target-list="ppc-softmmu ppc64-softmmu"

But this gave me a whole list of errors (on the dgibson 2-7pre branch) such as this:
hw/misc/macio/mac_dbdma.c: In function 'dbdma_cmdptr_load':
hw/misc/macio/mac_dbdma.c:49:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
#define DEBUG_DBDMA_CHANMASK ((1ul << DBDMA_CHANNELS) - 1)
hw/misc/macio/mac_dbdma.c:59:38: note: in expansion of macro 'DEBUG_DBDMA_CHANMASK'
if ((1ul << (ch)->channel) & DEBUG_DBDMA_CHANMASK) { \

gcc version is 5.2.0 20150716 (Fedora MinGW 5.2.0-1.fc23) (GCC)
Interesting, I'll try to build 32-bit version tomorrow. It is weird that the libftd-devel came with Fedora 24 is version 1.4.1, however QEMU still complains that the version is not high enough, while it requires one > 1.4.0.
User avatar
celebi23
Granny Smith
Posts: 101
Joined: Wed Jun 18, 2008 5:53 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by celebi23 »

Cat_7 wrote:Hi,

An OSX build of Qemu pre 2.7 with patched OpenBios is now able to boot unaltered 9.1 and 9.2 images. 9.0 still seems to be a no-no ;-)
Pick up the download in the forum http://www.emaculation.com/forum/viewto ... =34&t=8848

Best,
Cat_7
I followed the instructions in your post but, Terminal spits this out:
celebi23s-MacBook-Pro:~ celebi23$ /Users/celebi23/Qemu_crap/Qemu_2.7-pre.OSX/qemu.command ; exit;
dyld: Library not loaded: /usr/local/opt/vte3/lib/libvte-2.91.0.dylib
Referenced from: /Users/celebi23/Qemu_crap/Qemu_2.7-pre.OSX/./qemu-system-ppc
Reason: image not found
/Users/celebi23/Qemu_crap/Qemu_2.7-pre.OSX/qemu.command: line 3: 3188 Trace/BPT trap: 5 ./qemu-system-ppc -bios ./openbios-ppc -boot d -M mac99 -m 256 -cpu G3 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -g 1024x768x32 -netdev user,id=network0 -device rtl8139,netdev=network0 -drive file=./MacOS9.2.1.toast,format=raw,media=cdrom -drive file=./empty_disk.raw,format=raw,media=disk
logout
I didn't have this problem with your "Qemu_2.5.0.OSX.zip" archive though. Not sure why the newer version would be giving me this error.
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

It seems I missed at least one library in the list of libraries to relocate.
I'll see if can fix it tomorrow.

Best,
Cat_7
User avatar
celebi23
Granny Smith
Posts: 101
Joined: Wed Jun 18, 2008 5:53 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by celebi23 »

Cat_7 wrote:It seems I missed at least one library in the list of libraries to relocate.
I'll see if can fix it tomorrow.

Best,
Cat_7
Ok, great. Thanks! It's amazing that qemu can even boot 9.2 :D
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by mcayland »

Cat_7 wrote:I never got the 64 bit build to work.

I use:
./configure --cross-prefix=i686-w64-mingw32- --target-list="ppc-softmmu ppc64-softmmu"

But this gave me a whole list of errors (on the dgibson 2-7pre branch) such as this:
hw/misc/macio/mac_dbdma.c: In function 'dbdma_cmdptr_load':
hw/misc/macio/mac_dbdma.c:49:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
#define DEBUG_DBDMA_CHANMASK ((1ul << DBDMA_CHANNELS) - 1)
hw/misc/macio/mac_dbdma.c:59:38: note: in expansion of macro 'DEBUG_DBDMA_CHANMASK'
if ((1ul << (ch)->channel) & DEBUG_DBDMA_CHANMASK) { \

gcc version is 5.2.0 20150716 (Fedora MinGW 5.2.0-1.fc23) (GCC)
Oh that's one of my patches. It looks like on Windows sizeof(long) == 4 so the ul suffix isn't enough. l've flagged this upstream but I think the fix is to increase the constant to ull (unsigned long long) which should be 8 bytes on a 32-bit platform. Can you change the line in hw/misc/macio/mac_dbdma.c from:

#define DEBUG_DBDMA_CHANMASK ((1ul << DBDMA_CHANNELS) - 1)

to:

#define DEBUG_DBDMA_CHANMASK ((1ull << DBDMA_CHANNELS) - 1)

and try again?
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by mcayland »

raidenii wrote:
Cat_7 wrote:I never got the 64 bit build to work.

I use:
./configure --cross-prefix=i686-w64-mingw32- --target-list="ppc-softmmu ppc64-softmmu"

But this gave me a whole list of errors (on the dgibson 2-7pre branch) such as this:
hw/misc/macio/mac_dbdma.c: In function 'dbdma_cmdptr_load':
hw/misc/macio/mac_dbdma.c:49:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
#define DEBUG_DBDMA_CHANMASK ((1ul << DBDMA_CHANNELS) - 1)
hw/misc/macio/mac_dbdma.c:59:38: note: in expansion of macro 'DEBUG_DBDMA_CHANMASK'
if ((1ul << (ch)->channel) & DEBUG_DBDMA_CHANMASK) { \

gcc version is 5.2.0 20150716 (Fedora MinGW 5.2.0-1.fc23) (GCC)
Interesting, I'll try to build 32-bit version tomorrow. It is weird that the libftd-devel came with Fedora 24 is version 1.4.1, however QEMU still complains that the version is not high enough, while it requires one > 1.4.0.
Note that libfdt is slightly strange in that you can either build QEMU with a system libfdt or the one included in the tree as a git submodule. Perhaps you're using an old QEMU git tree and need to update the submodule?
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by mcayland »

Cat_7 wrote:I never got the 64 bit build to work.
Now that definitely is worthy of an upstream bug report :)
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

More an expression of my incompetence. The 32 and 64 bit windows builds by Stefan Weil (https://qemu.weilnetz.de/) do work ;-)

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

Hi,

The Qemu for OSX build should now be fixed. Find it at:
http://www.emaculation.com/forum/viewto ... =34&t=8848

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 6146
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

Oh that's one of my patches. It looks like on Windows sizeof(long) == 4 so the ul suffix isn't enough. l've flagged this upstream but I think the fix is to increase the constant to ull (unsigned long long) which should be 8 bytes on a 32-bit platform. Can you change the line in hw/misc/macio/mac_dbdma.c from:
#define DEBUG_DBDMA_CHANMASK ((1ul << DBDMA_CHANNELS) - 1)
to:
#define DEBUG_DBDMA_CHANMASK ((1ull << DBDMA_CHANNELS) - 1)
and try again?
Yes, that fixes the compilation error ;-)

Thanks,
Cat_7
User avatar
celebi23
Granny Smith
Posts: 101
Joined: Wed Jun 18, 2008 5:53 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by celebi23 »

Cat_7 wrote:Hi,

The Qemu for OSX build should now be fixed. Find it at:
http://www.emaculation.com/forum/viewto ... =34&t=8848

Best,
Cat_7
That worked! Thanks! Successfully booted a 9.2.1 disc image :D Now going to try and see if it will install.
User avatar
24bit
Forum All-Star
Posts: 1424
Joined: Wed Nov 11, 2009 5:47 pm
Location: Germany

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by 24bit »

Thanks a lot, Cat_7!
I´ll dig out my D-9.1 CD soon and try with an image. I did not expect such great progress that soon.
Post Reply