Qemu virtio drivers for Mac OS 9.x

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

Post Reply
elliotnunn
Student Driver
Posts: 17
Joined: Sun Sep 11, 2016 6:35 am

Qemu virtio drivers for Mac OS 9.x

Post by elliotnunn »

Hello all,

I am working on Mac OS 9 drivers for Qemu's suite of Virtio devices (video, file sharing, sound, input etc). The driver for guest-host file sharing is ready for a demonstration.

File Sharing:
Currently there are two options:
-You can add a driver to your Mac OS 9.x extensions folder which gives access to a shared folder on your host.
-You can boot Mac OS 9 from a local folder on your host.

For macOS hosts, these options work without the need for a special Qemu build.
To try any of this in Windows, for now you need a 9p enabled qemu windows build: https://surfdrive.surf.nl/files/index.p ... Z/download

Access from Mac OS 9.x to a shared folder on your host:
Download the 9p.ndrv.hqx driver from here: https://surfdrive.surf.nl/files/index.p ... d/download
and move it into your Mac OS 9.x image. Then expand the driver so you end up with a file named 9p.ndrv. Put this file in your Mac OS 9.x System/Extensions folder

macOS hosts:
Add the following to your qemu arguments and adjust the path to the folder you want to share:

Code: Select all

-virtfs local,security_model=none,mount_tag=doesntmatter,path=path to folder on host
Windows hosts:
Use the 9p enabled build available for download above.
Add the following to your qemu arguments and adjust the path to the folder you want to share:

Code: Select all

-virtfs local,security_model=none,mount_tag=doesntmatter,path=path to folder on host
Note: currently access to the shared folder from within Mac OS 9.x is read-only!
Note: It might be best to start by pointing to an empty folder on your host as the driver might choke on folders with a large amount of files in it.

Booting from a local folder on your host:
Download and expand the attachments. There is a tiny bootable disk image (bootstrap.img) and a folder (os9test) with a cut-down copy of Mac OS 9.2.2. The disk image loads the Virtio driver then continues booting from the folder.
https://surfdrive.surf.nl/files/index.p ... j/download
https://surfdrive.surf.nl/files/index.p ... P/download

macOS hosts:
Best run qemu with -M mac99. Running with -M mac99,via=pmu might leave your mouse hanging in the upper left corner.
Add the following to your qemu start arguments (adjust the paths to bootstrap.img and os9test folder as needed):

Code: Select all

-drive format=raw,media=disk,file=bootstrap.img
-virtfs local,security_model=none,mount_tag=doesntmatter,path=os9test
Windows hosts:
Use the 9p enabled build available for download above.
Best run qemu with -M mac99. Running with -M mac99,via=pmu might leave your mouse hanging in the upper left corner.
Expanding the os9test file might give you some errors related to characters in the file names.
Add the following to your qemu start arguments (adjust the paths to bootstrap.img and os9test folder as needed):

Code: Select all

-drive format=raw,media=disk,file=bootstrap.img
-virtfs local,security_model=none,mount_tag=doesntmatter,path=os9test
Note: this is best seen as a proof-of-concept as it boots a very limited version of Mac OS 9.2

I am very grateful to my friends at #mac68k on Libera for their help and support. Help is very welcome: the code is at https://github.com/elliotnunn/QemuMacDrivers. The biggest bugs are:
  • Read-only
  • Booting from a local folder is slow
  • Weird custom format for resource forks and Finder info (bootable folder attached)
  • Needs a minimal "bootstrap" disk image (attached)
– Elliot/edited by Cat_7

Update 2023-08-12
Debug output is available, but slow because there is a page fault per character.

Code: Select all

-serial stdio -prom-env 'nvramrc=dev /pci/pci1af4,1009 1 encode-int " debug" property'
Last edited by elliotnunn on Sat Aug 12, 2023 7:17 am, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 4009
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Virtio drivers

Post by adespoton »

Thanks, Elliot! Can't wait to try this out!
User avatar
robin-fo
Space Cadet
Posts: 5
Joined: Fri Mar 31, 2023 6:07 pm

Re: Qemu virtio drivers for Mac OS 9.x

Post by robin-fo »

This is just... WOW! It even works with UTM! Tested with UTM 4.1.6 running on Mac OS 12.6. I Just had to install the extension and choose VirtFS in directory share mode. Not even some additional command-line parameters were required!
User avatar
robin-fo
Space Cadet
Posts: 5
Joined: Fri Mar 31, 2023 6:07 pm

Re: Qemu virtio drivers for Mac OS 9.x

Post by robin-fo »

Do you have any plans for an 68k version?
User avatar
adespoton
Forum All-Star
Posts: 4009
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Qemu virtio drivers for Mac OS 9.x

Post by adespoton »

I've got another request: any chance it could be hosted somewhere with http:// ? I've been having a bit of a headache shoehorning it into one of my existing images (eventually I'll have to convert my qcow2 image back to raw, mount it on the host and copy over -- attempts to use smb, afp, ftp and ssh between guest and host have all been failing since macOS 13 and I haven't had the time to figure out why).
User avatar
Cat_7
Expert User
Posts: 5956
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Qemu virtio drivers for Mac OS 9.x

Post by Cat_7 »

I'm sorry, I have no other option.

You say you can no longer get Qemu to forward the ftp port to your host?

Best,
Cat_7
User avatar
adespoton
Forum All-Star
Posts: 4009
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Qemu virtio drivers for Mac OS 9.x

Post by adespoton »

Cat_7 wrote: Fri Sep 15, 2023 9:21 pm I'm sorry, I have no other option.

You say you can no longer get Qemu to forward the ftp port to your host?

Best,
Cat_7
Yes; not sure what's going on; it's either a UTM thing or a macOS 13 thing or a combination. I've done the "convert qcow2 to raw, mount, write the driver, unmount, convert to qcow2, launch emulator" dance now, and it's all working, other than being read-only.

I haven't attempted doing a raw qemu-x86_64 run to see if that works; I expect it would, but I'm specifically attempting to test UTM 4.4.1 right now :)
Post Reply