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

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:You can save vm's, but raw format is not supported. QCOW2 and QED are supported.
So if you install on a qcow2 image, in OSX you can use the compat-monitor to create and load states:

Documentation ( http://wiki.qemu.org/download/qemu-doc. ... t_005fmode ) says that these commands are available:
savevm "imagename"
loadvm "imagename"
delvm "imagename"
info snapshots

I tested in OSX with mac os 9.1 running on a qcow2 image and savevm and loadvm worked.

Best,
Cat_7
If the save state feature actually works, maybe it is time to add save state menu items to QEMU's interface.
User avatar
Cat_7
Expert User
Posts: 6145
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 »

@programmingkid:

I noticed that the latest qemu master (06 okt) doesn't boot classic CD's/HD's anymore, not even with -cpu G3. Could you verify that I'm not going crazy?

I'll write a message to the developer list when you confirm.

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:@programmingkid:

I noticed that the latest qemu master (06 okt) doesn't boot classic CD's/HD's anymore, not even with -cpu G3. Could you verify that I'm not going crazy?

I'll write a message to the developer list when you confirm.

Best,
Cat_7
This is my most recent commit my repo is using:

commit e902754e3d0890945ddcc1b33748ed73762ddb8d
Merge: 0bdb12c 3daa4a9
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Oct 6 13:34:00 2016 +0100

I was able to boot Mac OS 9.2 and Mac OS 10.4.0. I have the -cpu G3 option on. Let me know if there is anything else I can do.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

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

Post by adespoton »

Actually, you can use any image format you want for the original HDD, including raw. The snapshots, however, have to be in QCOW2 or QED format. You can create a snapshot at any time by switching to the monitor. See http://wiki.qemu.org/Features/Snapshots -- but know that that's for using KVM; I found that fsfreeze-thaw wasn't working for me, so instead I'd close everything down that I could on the VM, after booting with caching disabled. Then I run "snapshot_blkdev <blockX> snapshot<x>.qcow2 QCOW2" in the monitor, after first using the monitor to look up the block device ID for the currently loaded image using "info block". See https://en.wikibooks.org/wiki/QEMU/Monitor#Devices for more info on monitor commands.

[edit] but if savevm and loadvm are actually working on OS X now, that's a much better solution! It does require QCOW2 or QED format images be used however, unlike the block-based snapshotting.
User avatar
Cat_7
Expert User
Posts: 6145
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,
Sorry, I have little knowledge about git, but it is the source after this commit today:
> Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-10-04 14:25:08 +0100)
>
> are available in the git repository at:
>
> git://github.com/dgibson/qemu.git tags/ppc-for-2.8-20161006
>
> for you to fetch changes up to 3daa4a9f9580ffda47df93c7c53371af226bf970:
>
> hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine (2016-10-06 16:15:53 +1100)
>
> ----------------------------------------------------------------
> ppc patch queue 2016-10-06

I just made a fresh clone, and with both G3 and G4 I get a crash on OS 9.0, 9.1 and 9.2 hd's
(sorry, a system error occurred (address error for 9.0) (illegal instruction for 9.1)(spinning beach ball for 9.2) .....

Same is true for all cd images that used to boot for 9.0, 9.1, 9.2

I used this simple command line (interchanging G4 and G3):
qemu-system-ppc -L pc-bios -boot d -M mac99 -cpu G4 -m 256 -prom-env 'auto-boot?=true' -drive file=/Volumes/OSX_Data/Downloads/OSX_ISOs/MacOS9.0.4Cube.iso,format=raw,media=cdrom

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:Hi,
Sorry, I have little knowledge about git, but it is the source after this commit today:
> Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-10-04 14:25:08 +0100)
>
> are available in the git repository at:
>
> git://github.com/dgibson/qemu.git tags/ppc-for-2.8-20161006
>
> for you to fetch changes up to 3daa4a9f9580ffda47df93c7c53371af226bf970:
>
> hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine (2016-10-06 16:15:53 +1100)
>
> ----------------------------------------------------------------
> ppc patch queue 2016-10-06

Best, Cat_7
I see. You are using David Gibson's personal git repo. I use the main one. You would use 'git log' to print the first few commits. If you are using QEMU in Mac OS X, in the About QEMU dialog, what is the number after "v2.7.0-"? Mine is 881.
User avatar
Cat_7
Expert User
Posts: 6145
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,

No, I used qemu master:
git clone https://github.com/qemu/qemu qemu-master

commit e902754e3d0890945ddcc1b33748ed73762ddb8d
Merge: 0bdb12c 3daa4a9
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Oct 6 13:34:00 2016 +0100

The about dialogue shows no version number, just the name of the executable

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:Hi,

No, I used qemu master:
git clone https://github.com/qemu/qemu qemu-master

commit e902754e3d0890945ddcc1b33748ed73762ddb8d
Merge: 0bdb12c 3daa4a9
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Oct 6 13:34:00 2016 +0100

Best,
Cat_7
That is the same commit I am at. Do you still have a problem with Mac OS 9 and Mac OS X not booting?
Last edited by Programmingkid on Thu Oct 06, 2016 6:04 pm, edited 1 time in total.
User avatar
Cat_7
Expert User
Posts: 6145
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 »

hsps-iMac:qemu-master hsp$ git log
commit e902754e3d0890945ddcc1b33748ed73762ddb8d
Merge: 0bdb12c 3daa4a9
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Oct 6 13:34:00 2016 +0100

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.8-20161006' into staging

ppc patch queue 2016-10-06

Currently accumulated target-ppc and spapr machine related patches.
- More POWER9 instruction implementations
- Additional test case / enabling of test cases for Power
- Assorted fixes

# gpg: Signature made Thu 06 Oct 2016 07:05:07 BST
# gpg: using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg: aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392
:...skipping...
User avatar
Cat_7
Expert User
Posts: 6145
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 is only 9.x that do not boot. PPC OSX boots OK.

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:It is only 9.x that do not boot. PPC OSX boots OK.

Best,
Cat_7
Could you try using a very minimalistic command line and try to boot a boot CD only? Try this:
qemu-system-ppc -cdrom macos9.iso -boot d

Feel free to replace the file name with your actual file's name.

I think it may be possible your hard drive image file has gone bad. If you have a backup of the image file, maybe it will boot. Or maybe you could try using Disk First-aid to fix any file system corruption.

I am able to boot Mac OS 9.0.4 and Mac OS 9.2. At first I was only seeing a gray screen. After disabling then enabling several hardware devices things started working normally. What I saw was probably just a glitch.
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 »

kikyoulinux wrote:
Arths wrote:
kataetheweirdo wrote: The Pi Zero might run Mac OS 9 slightly less than OK (in comparison to the Power Mac G3/300), though you might have to set the memory to 128 MB at most. OS X might run, but it would be very slow. You can compile from 2.7's branch onward. As for OpenBIOS, can't help you much there.
Thanks for your answer, I'll try that as soon as I can. :smile:
And I tried Mac OS X Panther on my Android phone(4x Cortex-A53) before... it took 10 minutes to start up and 20 seconds or so to open a menu. So you'd better not.
Ben's last patchset before 2.7 contain a set of improvements to the QEMU soft TLB which noticeably improved the performance, plus I still have the unaligned disk IO patchset I hope to fix up soon. So don't write things off too soon ;)
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:@programmingkid:

I noticed that the latest qemu master (06 okt) doesn't boot classic CD's/HD's anymore, not even with -cpu G3. Could you verify that I'm not going crazy?

I'll write a message to the developer list when you confirm.

Best,
Cat_7
There was a regression in the altivec instructions introduced by the Power9 support that should be fixed by dgibson's latest merge - or at least git master was broken for me trying to boot OS 9 until e902754e3d0890945ddcc1b33748ed73762ddb8d if that helps?
User avatar
Cat_7
Expert User
Posts: 6145
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 »

Could you try using a very minimalistic command line and try to boot a boot CD only? Try this:
qemu-system-ppc -cdrom macos9.iso -boot d

Feel free to replace the file name with your actual file's name.

I think it may be possible your hard drive image file has gone bad. If you have a backup of the image file, maybe it will boot. Or maybe you could try using Disk First-aid to fix any file system corruption.
I tried with your command line, but without -L pc-bios and -M mac99 that will not boot.

However, it seems I might have had a problem with my command file. Nevertheless strange that I could still boot OSX but not a single of my 6 OS9 images when I only changed the -drive entry. As said, all images failed, both hd and cd images.

All is well now ( I did reboot in between).

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

If the save state feature actually works, maybe it is time to add save state menu items to QEMU's interface.
Well that was an interesting discussion on the mailing list. Case closed ;-)
I see the issues about command line reconstruction and hot-plug history, migration etc.

But why not add a simple way to access what is already there through the compat monitor?
Does adding these options to the gui mean that the user will/can expect more (stability, fail safe?) than what is available now on a command line? Now the discoverability and responsibility are placed at the user end.

If these issues are really holding back inclusion in the GUI, then perhaps the options to save and load vm states should not be in compat monitor (or qemu for that matter) at all.

Just my two cents.

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:
If the save state feature actually works, maybe it is time to add save state menu items to QEMU's interface.
Well that was an interesting discussion on the mailing list. Case closed ;-)
I see the issues about command line reconstruction and hot-plug history, migration etc.

But why not add a simple way to access what is already there through the compat monitor?
What do you mean? The savevm feature can be used in compat monitor already.
Does adding these options to the gui mean that the user will/can expect more (stability, fail safe?) than what is available now on a command line? Now the discoverability and responsibility are placed at the user end.
There would be no change to stability. The feature would be much easier to use if available to the gui.
If these issues are really holding back inclusion in the GUI, then perhaps the options to save and load vm states should not be in compat monitor (or qemu for that matter) at all.

Just my two cents.

Best,
Cat_7
I am sure it should be easy for the user to provide a consistent device state to QEMU between save states. Just don't change anything. I did like another idea that suggested storing command-line arguments to QEMU. That would help indicate if anything changed.
probninalogadam
Space Cadet
Posts: 2
Joined: Tue Sep 06, 2016 3:32 pm

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

Post by probninalogadam »

i guess all that we are missing now, is nice GUI front END, to make it more MAC :) , like Q .
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

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

Post by adespoton »

VirtualBox is open source and has a Mac front end....
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

adespoton wrote:VirtualBox is open source and has a Mac front end....
True, but VirtualBox only does x86 and x86-64. I hope to test out the PowerPC OpenBIOS Forth interpreter soon.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

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

Post by adespoton »

Ah; but I'm saying VirtualBox has an available front end; qemu would be the back end (or, we could have a concerted move to replace the ancient QEMU in VirtualBox with a modern one, and have them go out in one build). But with Oracle holding the reins, just forking the front end makes more sense.
WizKid
Tinkerer
Posts: 72
Joined: Sun Jul 31, 2016 11:58 pm

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

Post by WizKid »

So I tried to get shared folders working with the smb=xxx option, and no luck. The command I used was:

Code: Select all

./qemu-system-ppc -bios ./openbios-ppc.elf -boot c -M mac99p -m 1536 -prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -netdev user,id=network0,smb=/Volumes/Overflow/Shared/SheepShaver\ Shared/ -device sungem,netdev=network0 -drive file=macos9.raw,format=raw,media=disk,cache=writethrough -drive file=/Volumes/Overflow/Downloads/Install\ DAVE\ 4.0.img,format=raw,media=cdrom
I get error #20 - "A NetBIOS Error has occurred."

I left the workgroup field blank, and used the share name "qemu."

Any help?
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

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

Post by adespoton »

I tried everything I could, and couldn't get it working that way. But the smb= flag was for the old -net format; I'm not sure how that's supposed to work with a netdev device. However, you can still do port forwarding of SMB ports, and that works.
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 »

Programmingkid wrote:
mcayland wrote:
Programmingkid wrote:I just wanted to let everyone know the progress I have made with the sound problem in QEMU. After replacing all the calls to the floating point instruction fmadds with a c language equivalent in the AppleUSBAudio kernel extension, audio played without that crackling sound. It sound almost perfect. The audio was from an mpeg file. MP3 files probably go thru a decoder that uses floating point instructions, so that's probably why they still play poorly.
This does seem like an extremely long way around the problem, particularly as it would be a huge amount of work on the QEMU side. Why not simply do what Ben did with sungem, i.e. reverse engineer a QEMU sound device from one of the many hardware open source drivers available?
The driver will only tell us the interface to the device, it won't tell us what goes on behind the scenes. I tried this with the screamer sound chip used by Apple. It was just too hard to succeed.

One sound chip that is well documented is the SoundBlaster. There is a Mac OS 9 driver available for it. If someone were to port the SoundBlaster ISA card in QEMU to PCI, it might be possible to make sound play thru it.
Bear in mind that Mac-On-Linux (MOL) already has AWACS emulation so all you need to do is port the virtual device to QEMU, add the device node to OpenBIOS and you should be there. This is compared to having to implement a complete set of floating point TCG ops for all the targets that QEMU supports which I promise you will be a lot more work ;)
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:
If the save state feature actually works, maybe it is time to add save state menu items to QEMU's interface.
Well that was an interesting discussion on the mailing list. Case closed ;-)
I see the issues about command line reconstruction and hot-plug history, migration etc.

But why not add a simple way to access what is already there through the compat monitor?
Does adding these options to the gui mean that the user will/can expect more (stability, fail safe?) than what is available now on a command line? Now the discoverability and responsibility are placed at the user end.

If these issues are really holding back inclusion in the GUI, then perhaps the options to save and load vm states should not be in compat monitor (or qemu for that matter) at all.

Just my two cents.

Best,
Cat_7
Yeah there's quite a bit of history here... basically the newer QEMU-internal QOM APIs allow you to create a "blank" machine and then plug in devices using -device on the command line to add virtual hardware, and the concept of a machine e.g. mac99 was to preconfigure a default set of devices from a file.

Now the QEMU mac emulation still uses several legacy APIs, e.g. for serial ports which means it isn't possible to represent the entire machine in this way would be the requirement for this to work. Then again I'd much prefer to have a warning stating the user is responsible for using a compatible machine to least make the functionality available which should work just fine as long as you don't start adding extra -device options other than the defaults onto the command line.

Also I did work on this before and the loadvm/savevm code isn't quite right for the PPC mac machines yet - I posted a patch set at https://github.com/mcayland/qemu/commit ... advm-cpu-3 which fixes up Darwin/OS X but wasn't able to get agreement on how to migrate the timebase which is why I wasn't able to upstream it.
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 »

mcayland wrote:
Programmingkid wrote:
mcayland wrote:
This does seem like an extremely long way around the problem, particularly as it would be a huge amount of work on the QEMU side. Why not simply do what Ben did with sungem, i.e. reverse engineer a QEMU sound device from one of the many hardware open source drivers available?
The driver will only tell us the interface to the device, it won't tell us what goes on behind the scenes. I tried this with the screamer sound chip used by Apple. It was just too hard to succeed.

One sound chip that is well documented is the SoundBlaster. There is a Mac OS 9 driver available for it. If someone were to port the SoundBlaster ISA card in QEMU to PCI, it might be possible to make sound play thru it.
Bear in mind that Mac-On-Linux (MOL) already has AWACS emulation so all you need to do is port the virtual device to QEMU, add the device node to OpenBIOS and you should be there. This is compared to having to implement a complete set of floating point TCG ops for all the targets that QEMU supports which I promise you will be a lot more work ;)
What if the AWACS driver or some decoder uses floating point operations? The sound would still not play correctly.
Post Reply