GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

About QEMU, 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

kikyoulinux
Tinkerer
Posts: 83
Joined: Sun Sep 28, 2014 11:53 am
Location: China

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

Post by kikyoulinux »

neozeed wrote:So cool. I got 9.1 to install, only a minimal system as the extensions would bomb during install (netcape/ie etc..).

I noticed the mouse only went crazy when a CD was connected. Using GTK+USB emulated mouse was crazy slow but I could copy files off the ISO OK. Then trying to install Stuffit from the 9.1 ISO it just hangs on the installer .. G3 & G4.

Code: Select all

qemu-system-ppc.exe -bios openbios-ppc -M mac99 -m 256 -cpu G3 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -g 1024x768x32  -drive file=MacOS91.qcow2,format=qcow2,media=disk -sdl -boot c 
Try sdl and use the sdl.dll v1.2.14 or v1.2.13 from its official site. Also, the Command key is missing under GTK output mode.
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

I'm curious if anyone has used HFVExplorer to manually move across files to the guest hard drive, particularly for programs like Stuff-It Expander. I'd also suggest getting an IDE in of some sort, particularly one where you can write and compile a program that writes out a file that takes up 4096 sectors of a Mac hard disk.

NVRAM issues seem to be the next big thing, as that seems to be preventing Mac OS 8.x and older versions of Mac OS 9.x from booting.

Before I forget, I originally posted a compatibility list here, but that's now in another topic. Do post there if you have any results for software running.
neozeed
Apple Corer
Posts: 289
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

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

Post by neozeed »

kataetheweirdo wrote:I'm curious if anyone has used HFVExplorer to manually move across files to the guest hard drive, particularly for programs like Stuff-It Expander. I'd also suggest getting an IDE in of some sort, particularly one where you can write and compile a program that writes out a file that takes up 4096 sectors of a Mac hard disk.

NVRAM issues seem to be the next big thing, as that seems to be preventing Mac OS 8.x and older versions of Mac OS 9.x from booting.

Before I forget, I originally posted a compatibility list here, but that's now in another topic. Do post there if you have any results for software running.
I use my mutilated Basilisk II build, Cockatrice III, which I've hacked to support SCSI disk images when using the Quadra 800 ROM/CPU config. That way I can mount a 'raw' disk image formatted with regular HFS, and copy files in between.

I tried Sim City 2000 version 1.3, and it gives me an error -13 on trying to launch. SoftAT locks the system when attempting to run. I'll shuffle some quicktime videos. I also installed a realtek rtl8139 driver but it looks like it doesn't receive any packets.
don't do today what you can put off until tomorrow.
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

Error -13? That usually only shows up when the extensions are disabled or if the color manager can't allocate memory to the palette. I'm going to try booting Mac OS 9 in 256 color mode, because it's possible there are issues allocating the color lookup tables/palettes and switching between resolutions on the fly. Keep this in mind, since Sim City 2000 does require 8-bit color mode to be set.

No idea about SoftAT though, since I haven't used that much, though this is worth looking into.

Realtek's driver not working makes sense, since we can't get OpenTransport working yet and thus cannot get any connections.
neozeed
Apple Corer
Posts: 289
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

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

Post by neozeed »

kataetheweirdo wrote:Error -13? That usually only shows up when the extensions are disabled or if the color manager can't allocate memory to the palette. I'm going to try booting Mac OS 9 in 256 color mode, because it's possible there are issues allocating the color lookup tables/palettes and switching between resolutions on the fly. Keep this in mind, since Sim City 2000 does require 8-bit color mode to be set.
Well this is strange, I go to re-run it, and now it works.

Image


The 256 colour mode is all messed up, and this is the greyscale that you can at least see something. But it's running now.

MacOS 9.1 running...

Code: Select all

qemu-system-ppc.exe -bios openbios-ppc -M mac99 -m 256 -cpu G3 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -g 800x600x8  -drive file=MacOS91.qcow2,format=qcow2,media=disk -sdl -boot c -hdb xx.disk
xx.disk is a raw disk Image I use to transfer data between Qemu and Basilisk II/Cockatrice III
don't do today what you can put off until tomorrow.
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

I suspect this may also be why Eric's Solitaire Sample(r) doesn't boot up, as that too requires the 8-bit color mode. So, it does seem that QEMU is lacking on-the-fly resolution changes, although I still need to test out the installation process for 9.2.x.

As for the corrupted-ish palettes, that may be because of the lack of handling of CLUT entries, although this too needs to be tested out.

I think QEMU may also have problems correctly getting the CLUT entries for 8-bit display modes. I've noticed that up until now, everyone so far has been only testing in 32-bit color mode. I think we should also test the 1-bit, 4-bit and 15/16-bit display modes.
User avatar
Cat_7
Expert User
Posts: 5103
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 »

On the qemu ppc developer list I read that a new video driver is in the making that will benefit running ppc OSX, so perhaps OS9 benefits as well.

Best,
Cat_7
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

I'm not seeing the discussion on the video driver yet. I did see this from Mark though...
The OS 9 issue is a bit tricky, the OS 9 bootloader is buggy in that it fiddles with the r-stack which means it corrupts its own return address.
The emphasis is mine, but yikes, you never want that to happen under any circumstances. I want to say it's an anti-emulation routine, but I doubt it. I did read up on how Mac OS 9 does crazy things with the MSR, but it might also be worth looking into any issues with SPR 0, as it seems SimCity 3000 does rely on this register (and possibly a couple of apps I might not be aware of).
mcayland
Granny Smith
Posts: 113
Joined: Sun Nov 01, 2015 10:33 pm

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

Post by mcayland »

kataetheweirdo wrote:I'm not seeing the discussion on the video driver yet. I did see this from Mark though...
The OS 9 issue is a bit tricky, the OS 9 bootloader is buggy in that it fiddles with the r-stack which means it corrupts its own return address.
The emphasis is mine, but yikes, you never want that to happen under any circumstances. I want to say it's an anti-emulation routine, but I doubt it. I did read up on how Mac OS 9 does crazy things with the MSR, but it might also be worth looking into any issues with SPR 0, as it seems SimCity 3000 does rely on this register (and possibly a couple of apps I might not be aware of).
No need to worry about this anymore - the solution was to implement a pseudo r-stack in Forth that worked in interpret mode, which after a bit of poking around Sun's OpenBOOT is exactly what the official firmware did. Note that this was only the first stage bootloader which pulls the Toolbox ROM from the disk (so no effect once you've started executing Toolbox itself) and now all relevant fixes have been merged upstream :)
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

Good to hear that the bug fix for bootloader has been fixed.

Since Cat7 mentioned it, are there any plans for the video? I've noticed that 8-bit color mode in Mac OS 9.x is quite badly corrupted too, with the incorrect palettes being loaded in for greyscale and color. When doing 8-bit color mode, QEMU should base it on a stored palette (3 * 256 byte table). The 256 greys table should start at black then gradually become whiter, but QEMU currently has it the opposite way, plus numerous incorrect entries (including too many null color entries). Check out the Monitors and Sound control panel to see this in action.

A weird thing I noticed in QEMU is that you can select millions of greys in the monitor extension, which is normally not allowed by Mac OS. Only one option is available too and that option is the one the user specifically input with the command line (or a 3rd party GUI). Also, I can't seem to boot Mac OS up when I set the color mode to either 15 or 16-bit for some reason.

I presume that anything that isn't 8-bit or 32-bit color mode means that the Mac desktop does not properly show up, which is a bug that does need some looking into.

I'm curious what else from Mac-on-Linux could be used, since there does appear to be sound support, networking and Old World Mac support too. The problem with the networking though is that it's heavily dependent on Linux. I'll be testing out 10.2 or 10.3 soon too, seeing whatever discrepancies I can find between using Classic and running Mac OS 9.x naturally.
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

It seems a little strange that Mac OS 9.0.4 does boot, but only versions with ROM versions 4.6.1-5.5.1 installed. These include versions shipped for iBooks and iMacs in 2000 and Power Mac G4s like the Cube. There seems to be issues booting anything with a ROM version older than 4.6.1. This might be linked to the fact that people are using mac99 instead of g3beige, since mac99 does emulate the Power Mac G4. Indeed, most Power Mac G4s can't boot the retail version of Mac OS 9.0.4.
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

I tried running Doom 2 on Mac OS 9.0.4. Everytime a dialog appears asking me if it is ok to change the color settings to 256 colors. Everytime I click yes the screen goes completely black except for the control strip. The only thing I can do is reboot. :(

I am glad to see a game like SimCity 2000 running under QEMU.
neozeed
Apple Corer
Posts: 289
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

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

Post by neozeed »

Programmingkid wrote:I tried running Doom 2 on Mac OS 9.0.4. Everytime a dialog appears asking me if it is ok to change the color settings to 256 colors. Everytime I click yes the screen goes completely black except for the control strip. The only thing I can do is reboot. :(

I am glad to see a game like SimCity 2000 running under QEMU.
It may be running, I've found the 256 colour mode gave me a black screen in simcity, try it in grayscale.
don't do today what you can put off until tomorrow.
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

neozeed wrote:
Programmingkid wrote:I tried running Doom 2 on Mac OS 9.0.4. Everytime a dialog appears asking me if it is ok to change the color settings to 256 colors. Everytime I click yes the screen goes completely black except for the control strip. The only thing I can do is reboot. :(

I am glad to see a game like SimCity 2000 running under QEMU.
It may be running, I've found the 256 colour mode gave me a black screen in simcity, try it in grayscale.
Tried it using '-g 800x600x8'. I see the same results. Just a black screen. If the color palette is the problem, it might explain why so many Linux distros boot to a black screen.
User avatar
Cat_7
Expert User
Posts: 5103
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 a little strange that Mac OS 9.0.4 does boot, but only versions with ROM versions 4.6.1-5.5.1 installed. These include versions shipped for iBooks and iMacs in 2000 and Power Mac G4s like the Cube. There seems to be issues booting anything with a ROM version older than 4.6.1. This might be linked to the fact that people are using mac99 instead of g3beige, since mac99 does emulate the Power Mac G4. Indeed, most Power Mac G4s can't boot the retail version of Mac OS 9.0.4.
Thanks for that info ;-) I did indeed finally find a cd image of 9.0.4 that boots and installs (for the Cube). It seems, however, that there are some things not quite OK. The system profiler crashes.

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 5103
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 »

This is the info about the video driver currently proposed on the qemu development list:

This adds a native MacOS driver in ROM (which can be picked up
by MacOS once OpenBIOS has been updated if Mark accepts
the patches I sent him) which allows MacOS classic
(tested 9.2.1) and MacOS X (tested 10.1.4 and 10.4)
to properly use QEMU std VGA (10.1.x doesn't work at all
without it, the others get the ability to change resolution
and color depth).

Best,
Cat_7
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

"Building the ROM is tricky and requires CodeWarrior for MacOS so I include a pre-built binary."

:shock: That seems a little surprising and probably doesn't seem like the best idea.

I wonder if there are any extension problems with 8.5 or 8.6 that prevent it from booting. I'll be testing this out once I can boot up Mac OS with G3Beige. I did see a post on Apple's own forums about this, but that was a long time ago and written in Japanese (around 2002).

Keep in mind that since we're stuck with being able to boot it up with mac99, I think it will be quite some time before booting it up in g3beige works. In the mean time, the oldest version of Mac OS that can be booted is a variant of Mac OS 9.0.4 bundled with Power Mac G4s and some models of the iBook or iMac made in 2000.
gtxaspec
Tinkerer
Posts: 62
Joined: Mon Oct 19, 2015 7:32 pm

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

Post by gtxaspec »

The problem with MacOS 8.6 or below, OS complains early boot about missing /RTAS node. I believe we need more work within OpenBIOS.
LightBulbFun
Tinkerer
Posts: 49
Joined: Mon Jul 13, 2015 11:32 am

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

Post by LightBulbFun »

Well I was just playing with the latest version of QEMU on git at the time of this post and I discovered that the 604 CPU option/emulation is now working with OS X guests. it no longer kernel panics the platform expert like it used to (before today the 604 option would only work in OS X if i was using KVM with QEMU on say a G5)

on a side note the new VGA stuff sounds very interesting indeed.

Image
kataetheweirdo
Apple Corer
Posts: 288
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

That's pretty unusual to see, though I do know there are hacks to run Mac OS X on 603's and 604's. I will say that Mac OS X emulation seems to be rapidly catching up with PearPC.

There are quite a few patches a developer made that haven't been incorporated into the main branch yet, mainly as 2.7.0 is in the testing stage right now. These patches could appear in 2.8 and apparently includes a speed-up for dcbz that would be nice to include. It doesn't seem that the new video driver for the Macs is there yet either, so you may have to wait a while before you can boot up 10.1.

I'm curious if anyone has attempted Slirp with QEMU for networking in any version of Mac OS 9 or X.

Before I forget, 2.7.0-rc1 just got released, so I'll be testing for any potential regressions.
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

WE NOW HAVE DOOM II RUNNING IN QEMU :shock:
Image
Mac OS 9.2.1 was used to run Doom II. Mac OS 9.0.4 dies at a black screen when I tried it with Doom II.

Mac OS 9.0.4 with the changeable resolutions and colors.
Image

Mac OS 10.4.0 with changeable resolutions and colors.
Image

This is all thanks to Benjamin Herrenschmidt open firmware driver.
User avatar
Cat_7
Expert User
Posts: 5103
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'm curious if anyone has attempted Slirp with QEMU for networking in any version of Mac OS 9 or X.
Please check some pages up this thread. The logging of network traffic from 9.x is available. The need for logging might suggest it is not working... And it doesn't.
There is a realtek driver available, it installs in 9.x and provides ethernet connection. But somehow traffic is blocked.

10.3 and early 10.4 work with slirp.

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 5103
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 »

Mac OS 9.0.4 with the changeable resolutions and colors.
That is awesome! I applied Benjamin's patches this afternoon to the 2.8 source and downloaded the qemu_vga.ndrv from his repository, but haven't been able to get Mac OS to use it. Is there anything else needed beside his patch and the driver?
Does OpenBios need changes? Or command line options perhaps?

Best,
Cat_7
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

Cat_7 wrote:
Mac OS 9.0.4 with the changeable resolutions and colors.
That is awesome! I applied Benjamin's patches this afternoon to the 2.8 source and downloaded the qemu_vga.ndrv from his repository, but haven't been able to get Mac OS to use it. Is there anything else needed beside his patch and the driver?
Does OpenBios need changes? Or command line options perhaps?

Best,
Cat_7
Ben sent me another patch that patches OpenBIOS. He said he sent it to Mark Cave-Ayland already. He sent it to me because I requested it. Here it is, but expect to have to apply it by hand.


Subject: [PATCH 2/2] pci: Fix locating Mac driver from PCI rom

The ROM is not on BAR 1 but BAR 6, I'm not sure what that code ever
did, Qemu uses BAR 6, and I think MOL does too.

Additionally, support using a raw PEF binary without a made up
header.

Eventually we need to support f-code from the ROM but that is not
for today.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
drivers/pci.c | 54 +++++++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 25 deletions(-)

diff --git a/drivers/pci.c b/drivers/pci.c
index 2cffa2f..c748f20 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -774,41 +774,45 @@ int macio_keylargo_config_cb (const pci_config_t *config)
int vga_config_cb (const pci_config_t *config)
{
unsigned long rom;
- uint32_t rom_size, size, mask;
- int flags, space_code;
+ uint32_t rom_size, size, bar;
phandle_t ph;

if (config->assigned[0] != 0x00000000) {
setup_video();

- pci_decode_pci_addr(config->assigned[1],
- &flags, &space_code, &mask);
-
- rom = pci_bus_addr_to_host_addr(space_code,
- config->assigned[1] & ~0x0000000F);
-
- rom_size = config->sizes[1];
-
- ph = get_cur_dev();
-
- if (rom_size >= 8) {
- const char *p;
-
- p = (const char *)rom;
- if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') {
- size = *(uint32_t*)(p + 4);
- set_property(ph, "driver,AAPL,MacOS,PowerPC", p + 8, size);
- }
+ if (config->assigned[6]) {
+ rom = pci_bus_addr_to_host_addr(MEMORY_SPACE_32,
+ config->assigned[6] & ~0x0000000F);
+ rom_size = config->sizes[6];
+
+ bar = pci_config_read32(config->dev, PCI_ROM_ADDRESS);
+ bar |= PCI_ROM_ADDRESS_ENABLE;
+ pci_config_write32(config->dev, PCI_COMMAND, bar);
+ ph = get_cur_dev();
+
+ if (rom_size >= 8) {
+ const char *p;
+
+ p = (const char *)rom;
+ if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') {
+ size = *(uint32_t*)(p + 4);
+ set_property(ph, "driver,AAPL,MacOS,PowerPC",
+ p + 8, size);
+ } else if (p[0] == 'J' && p[1] == 'o' &&
+ p[2] == 'y' && p[3] == '!') {
+ set_property(ph, "driver,AAPL,MacOS,PowerPC",
+ p, rom_size);
+ }
+ }
}
-
- /* Currently we don't read FCode from the hardware but execute it directly */
+ /* Currently we don't read FCode from the hardware but execute
+ * it directly */
feval("['] vga-driver-fcode 2 cells + 1 byte-load");

#ifdef CONFIG_MOL
- /* Install special words for Mac On Linux */
- molvideo_init();
+ /* Install special words for Mac On Linux */
+ molvideo_init();
#endif
-
}

return 0;
User avatar
Cat_7
Expert User
Posts: 5103
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 »

Success ;-)
And 10.0 can even use the realtek driver to get networking going! 10.1 gets an IP address from slirp but traffic seems blocked.

Image

Image


Thanks!

Cat_7
Last edited by Cat_7 on Sun Jul 31, 2016 7:37 am, edited 1 time in total.
Reason: added images and networking info
Post Reply