Emaculation.com

Running qemu-system-m68k in Windows

(Guide last upated July 7th, 2023)

Introduction

Qemu-system-m68k can emulate the Apple Macintosh Quadra 800 machine, which allows running the 68k versions of Mac OS 7.1 up to 8.1, A/UX 3.x and the 68k port of NetBSD.

Status

The status of various guests based on the latest builds available from the forum:

Guest Default build Specific command line arguments Remarks
Mac OS 7.1 OK none none
Mac OS 7.5 OK none none
Mac OS 8.1 OK none none
A/UX 3.0.1 OK none restart fails
A/UX 3.1.1 OK none restart fails
NetBSD 9.2 OK none none

Running qemu-system-m68k with Mac OS 7.1-8.1 guests

Requirements

  • The qemu-system-m68k program
  • An Apple Macintosh Quadra 800 rom file
  • Disk images for the m68k versions of Mac OS you want to install

Assumptions in this guide

This guide assumes you are installing Mac OS 8.0 on a 2gb file that will act as your hard disk for Mac OS.
The CD image you install from is called MacOS8.0.iso and the hard disk is called MacOS8.0.img

Installations of other versions of Mac OS from CD images (roughly) follow the same path.
If you want to install System 7.1, see further below.

Preparing to install Mac OS

Note: Qemu emulating the Quadra 800 cannot boot from floppy images.

  • Go to https://www.emaculation.com/forum/viewtopic.php?t=11727 and download our latest build.
  • Create a folder for Qemu-related files and unpack the download. Put your Mac OS disk images in this folder.
  • Create an empty disk image to install Mac OS on.
  • Create a pram disk image to hold information about the system, such as screen resolution, scsi boot order.

Open a command prompt and navigate to your Qemu folder.

Note: If you create a disk image larger than 2Gb, you will have to partition the disk so the first partition is 2Gb or less in size. Otherwise Mac OS will not boot after installation.

qemu-img.exe create -f raw -o size=2G MacOS8.0.img 
qemu-img.exe create -f raw pram-macos.img 256b

Open your favorite text editor and create a batch file called qemu-m68k-macos.bat with the following content:

qemu-system-m68k.exe ^
-M q800 ^
-m 128 ^
-display sdl ^
-bios Quadra800.rom ^
-drive file=pram-macos.img,format=raw,if=mtd ^
-device scsi-hd,scsi-id=0,drive=hd0 ^
-drive file=MacOS8.0.img,media=disk,format=raw,if=none,id=hd0 ^
-device scsi-cd,scsi-id=3,drive=cd0 ^
-drive file=MacOS8.0.iso,media=cdrom,if=none,id=cd0

Note:: To enable using multiple lines in the batch file end all lines except the last one with a ^. Make sure there is one space before the ^ and no space behind it.

Save qemu-m68k-macos.bat

About disks, the scsi-id and boot order

The emulated Quadra uses SCSI to connect hard disks and CD roms. The SCSI controller allows 8 devices (numbered from 0-7) to be connected. However, scsi-id 7 is reserved for the Quadra itself. You can therefore attach a mix of hard disk and cdrom images up to a maximum of 7 entries.

Each scsi-hd or scsi-cd has to have a different scsi-id and a different drive name. See the example above.

When no Startup Disk has been set with the Startup Disk control panel, the Quadra will search for bootable devices from scsi-id 0 upwards and boot from the 1st bootable device it finds.

However, when a Startup Disk has been set, the scsi-id of that device is saved in the pram file and subsequent boots will attempt to boot from that scsi-id.

Each entry for a hard disk in your batch file uses two lines:

–device scsi-hd,scsi-id=0,drive=hd0
–drive file=MacOS8.0.img,media=disk,if=none,id=hd0

The same is true for a cdrom entry in your batch file:

–device scsi-cd,scsi-id=3,drive=cd0
–drive file=MacOS8.0.iso,media=cdrom,if=none,id=cd0

Starting qemu-system-m68k to install Mac OS 8 and run it

  • Double-click qemu-m68k-macos.bat. This starts Qemu and boots the MacOS8.0.iso installation CD image.
  • Partition the hard disk image by using the Drive setup tool from the Utilities folder.
  • Install Mac OS from the CD onto the hard disk image.
  • Use the Startup Disk control panel to set Mac OS to boot from the new hard disk.
  • Use Special/Restart to boot from the freshly installed Mac OS.

To remove the cdrom entry from the batch file, edit qemu-m68k-macos.bat and remove the lines:

—device scsi-cd,scsi-id=3,drive=cd0 ^
—drive file=MacOS8.0.iso,media=cdrom,if=none,id=cd0

Making sure the last line does not end with a ^. Save qemu-m68k-macos.bat and run it.

Display options

There are 3 resolutions available: vga 640×480, supervga 800×600 and 1152×870.

When nothing is set on the command line 640×480 and 800×600 up to 24 bit colour/greyscale are available through the monitors control panel. Once set, the setting is preserved on reboot.

To use the 1152×870 resolution, add

-g 1152x870x8

to your batch file. This adds the Apple 21 monitor with that resolution.
Due to the vram limitations of the Quadra 800, it only supports up to 8 bit colour depth with this resolution.

Note: in this case the other resolutions are not available.

Tablet driver support

Note: the use of this driver does not allow restarting Mac OS. Instead, shut down and start again.
To enable tablet driver support download the latest version of the required declrom file here: https://github.com/elliotnunn/classicvirtio/releases/tag/latest and add the following to your command line:

—device nubus-virtio-mmio,romfile=declrom ^
—device virtio-tablet-device

Network options

Note: By default Qemu-system-m68k enables SLiRP networking when running the Quadra emulation.

Networking using SliRP

SLiRP provides a DHCP server and NAT to the guest. While sufficient for web browsing, this does not expose any possible services running on your Mac to your network or the internet.

Networking using a Tap device

To expose network services such as Appletalk to your local network, you can use TAP networking. TAP networking allows you to connect to e.g. real Macs, but also to BasiliskII and SheepShaver who can also use TAP networking. First install one (or more) tap device(s) from openvpn. Give them a sensible name, such as TapQemu1 (and TapQemu2). Next, bridge the device(s) with your default Windows network device. Then add the following to your batch file:

—nic tap,model=dp83932,mac=08:00:07:12:34:56,ifname=TapQemu1

Mac OS will then get an IP address from your router's DHCP server.
If you want to run two instances of Qemu using different tap devices you need to use both a different mac address and a different tap device name in the batch file to start the second instance:

—nic tap,model=dp83932,mac=08:00:07:12:34:57,ifname=TapQemu2

Networking by redirecting individual TCP/IP ports to your host

To forward only some services running in Mac OS to your host machine, such as a FTP server and a web server to ports 2121 and 8080 on your host, add:

—nic user,hostfwd=tcp::2121-:21,hostfwd=tcp::8080-:80

You can access e.g. the web server with http://localhost:8080

Apple File Sharing over TCP/IP connections

Mac OS 8 and earlier for the Quadra require the installation of e.g., ShareWay IP 3.0.2 Personal to allow Apple File Sharing over TCP/IP connections. You can find it at the macintoshgarden site.

Exposing your Mac to the internet

You can also expose services running on your Mac to the internet. For that you need to open the required ports on your router and redirect the ports to the IP address of your emulated Quadra.
Be careful!

Starting qemu-system-m68k to install Mac OS 7.1

Mac OS 7.1 comes on floppy disk images. The disk tools image contains the Apple HD SC Setup tool to initialise and partition hard disks. This tool cannot initialise disks it does not recognise.

However, you can use the Apple HD SC v3.0 (A/UX) tool to initialise and partition disks. For your convenience we provide a hard disk image containing that tool and the installation floppy disk images to install System 7.1.

Download it here: https://surfdrive.surf.nl/files/index.php/s/YXu300nyb9ERjrE/download

  • Create a new disk with qemu-img of size 2Gb.
—qemu-img.exe create -f raw -o size=2G MacOS7.1.img
  • Add the disk and the downloaded disk image to your qemu bat file:
qemu-system-m68k.exe ^
-M q800 ^
-bios Quadra800.rom ^
-display sdl ^
-drive file=pram-macos.img,format=raw,if=mtd ^
-device scsi-hd,scsi-id=0,drive=hd0 ^
-drive file=MacOS7.1.img,media=disk,format=raw,if=none,id=hd0 ^
-device scsi-hd,scsi-id=1,drive=hd1 ^
-drive file=macos71_Install.img,media=disk,if=none,id=hd1 

And start Qemu. Once on the desktop:

  • Start the Apple HD SC v3.0 (A/UX) tool and initialise your disk. Verification can take a long time. When finished give the disk a name.
  • Next, click Partition and then Custom. You'll notice a partition of 20Mb was created with the name you entered.
  • Click the name and click Remove, OK.
  • Click in the gray area to create a new partition. Click Macintosh Volume and then manually enter the desired partition size, not exceeding the maximum size indicated. Click OK.
  • The partition will be created. Click Done, then Quit to have the disk available on the desktop.
  • Open the InstallMeFirst folder and start the installer.

If you want CD Rom support, open the corresponding folder and install it. This will also install QuickTime 1.5.

Use the Startup Disk control panel to set Mac OS to boot from the new disk and restart.

Running qemu-system-m68k with A/UX 3.x guests in Windows

Assumptions in this guide

This guide assumes you are installing A/UX 3.x on a 2gb file that will act as your hard disk for A/UX.
The CD image you install from is called AUX301.iso and the hard disk is called AUX301.img

Preparing to install A/UX

You need:

  • The qemu-system-m68k program
  • An Apple Macintosh Quadra 800 rom file
  • A disk image with the A/UX 3.x boot floppy content (but also see below)
  • A disk image of the A/UX installation CD Rom
  • A disk image of the A/UX 3.1 update.

The A/UX related files can all be found here: http://www.cilinder.be/archive/aux_3.0.1/ but the files have to be unpacked with e.g. 7-zip and renamed to fit this guide. You'll have to source a rom file yourself.

Download the Qemu program here: https://www.emaculation.com/forum/viewtopic.php?p=74972
Download a boot floppy image named AUXBootfloppy.img from here: https://surfdrive.surf.nl/files/index.php/s/ZcJMgrSBqFAqfQA/download
This boot floppy also contains the AWS Tune-up 2.0 software that can be applied after upgrading the initial installation of A/UX 3.0.1 to 3.1

Create the required disk images:

qemu-img.exe create -f raw -o size=2G AUX3.img 
qemu-img.exe create -f raw pram-aux.img 256b

Open your favorite text editor and create a file called qemu-m68k-aux.bat with the following content:

qemu-system-m68k.exe ^
-m 128 ^
-M q800 ^
-display sdl ^
-serial stdio ^
-bios Quadra800.rom ^
-g 800x600x8 ^
-drive file=pram-aux.img,format=raw,if=mtd ^
-device scsi-hd,scsi-id=0,drive=fd0 ^
-drive file=AUXBootfloppy.img,media=disk,format=raw,if=none,id=fd0 ^
-device scsi-hd,scsi-id=1,drive=hd0 ^
-drive file=AUX3.img,media=disk,format=raw,if=none,id=hd0 ^
-device scsi-cd,scsi-id=3,drive=cd0 ^
-drive file=AUX301.iso,format=raw,media=cdrom,if=none,id=cd0  

Save and run qemu-m68k-aux.bat

When you run qemu-m68k-aux.bat, qemu boots from the bootfloppy image, which in turn starts the A/UX installation.

For more information about adding scsi disk drives and scsi cdrom drives, see the section “About disks, the scsi-id and boot order” earlier in this guide.

Actual installation

For the actual installation and initial configuration you can follow this guide: http://www.aux-penelope.com/aux_3.0.htm

When you get to the networking part of that guide, use the steps outlined below!

More in-depth information about configuring A/UX can be found here:
https://wiki.preterhuman.net/Newbie_Guide_To_A/UX_(Apple_UNIX)

Note: You'll have to reboot several times during installation, update, enabling network.
Reboot will not work, so you need to shut down A/UX and restart Qemu.

To install A/UX alongside Mac OS, you can refer to this guide: http://www.floodgap.com/retrotech/os/aux/

Networking

Note: By default Qemu-system-m68k enables SLiRP networking when running the Quadra emulation. SLiRP provides a DHCP server and NAT to the guest.
A/UX cannot be configured through DHCP, therefore you have to set the network settings manually. Use these settings:

IP address 10.0.2.15
Netmask 255.255.255.0
Nameserver 10.0.2.3
Default route 10.0.2.2

Open a command shell and run “newconfig”. Enter the data required:

configure this interface: yes
hostname: (enter some unique name)
nis domain name: (can be left empty when not using nis)
ao0 internet address: 10.0.2.15
netmask: 255.255.255.0 
OK?: yes

Set the default route with:

echo /usr/etc/route add default 10.0.2.2 1 >> /etc/rc

Note: the addititional “1” behind the ip address

Set the name server with:

echo nameserver 10.0.2.3 > /etc/resolv.conf

Next, enable networking by editing the following lines in /etc/inittab:

nfs0:2:wait:/etc/portmap	#Set to "wait" for networking
net9:2:respawn:/etc/inetd	#Set to "respawn" for networking
net6:2:wait:/etc/syslogd	#Set to "wait" to run a syslog daemon

and save the file.

Then reboot.

To change the IP configuration later on, edit the files /etc/rc, /etc/resolv.conf and /etc/NETADDRS

After the installation

After the installation, you can remove the boot floppy and installation iso from your qemu-m68k-aux.bat file, so the lines

-device scsi-hd,scsi-id=0,drive=fd0 ^
-drive file=AUXBootfloppy.img,media=disk,format=raw,if=none,id=fd0 ^
-device scsi-cd,scsi-id=3,drive=cd0 ^
-drive file=AUX301.iso,format=raw,media=cdrom,if=none,id=cd0 

can be removed, making sure your last line in the file does NOT end with a ^

Upgrade to A/UX 3.1

To start the upgrade to A/UX 3.1, you first need to add the disk image containing the upgrade to your qemu-aux.bat file:

-device scsi-cd,scsi-id=3,drive=cd0 ^
-drive file=AUX_3.1_Update.iso,format=raw,media=cdrom,if=none,id=cd0

Save the file and start qemu-aux.bat

After boot has completed, the CD image with the updater appears on the desktop.

Upgrade to A/UX 3.1.1

For your convenience, the AWS Tune-up 2.0 has been included on the boot floppy you used before.
So re-add the bootfloppy to the command line and boot A/UX, then follow the steps in the readme to install the update.

Running qemu-system-m68k with NETBSD guests in macOS

The traditional way of installing NETBSD takes place from inside Mac OS, so to use this guide you need an already running system. The guide assumes you have Mac OS 8.1 installed and you are installing NetBSB 9.3
So create an additional disk image onto which you can install NetBSD.

qemu-img create -f raw -o size=4G netbsd93.img

Add the image and the NetBSD installation iso to the command line:

qemu-system-m68k ^
-M q800 ^
-m 128 ^
-bios Quadra800.rom ^
-drive file=pram-netbsd.img,format=raw,if=mtd ^
-display cocoa ^
-g 800x600x8 ^
-device scsi-hd,scsi-id=1,drive=hd1 ^
-drive file=system8.1.img,media=disk,format=raw,if=none,id=hd1 ^
-device scsi-hd,scsi-id=0,drive=hd0 ^
-drive file=netbsd93.img,media=disk,format=raw,if=none,id=hd0 ^
-device scsi-cd,scsi-id=3,drive=cd0 ^
-drive file=NetBSD-9.3-mac68k.iso,media=cdrom,if=none,id=cd0

Remember the scsi-id of the NetBSD drive and boot Mac OS 8.1

Preparing the hard disk image for NetBSD

Intitialise the 4 Gb target disk you just created with the Mac OS 8 drive setup program. Create one Mac partition of 400 Mb to hold a minimal Mac OS 8 installation, leaving the rest of the disk free for the NetBSD installation. You now have 3 options:

1. Install Mac OS 8 onto the new 400 Mb partition and boot from that installation before continuing with this guide 
2. Install Mac OS 8 onto the 400 Mb partition later 
3. Do not install a new Mac OS 8 and continue with this guide

Options 1 and 2 have the benefit of having all required files to boot NetBSD on one disk image, while option 3 requires you to always have to use two disk images.

Installation

(adapted from: https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.2/mac68k/INSTALL.html#Installing%20the%20NetBSD%20System%20(Sysinst%20Method) )

Create a new folder on the HD with your Mac OS installation. From the NetBSD installation CD copy

BOOTER2_0_0_0.SEA from the Mac68K/Installation/misc folder
NETBSD_INSTALL.GZ from Mac68K/Installation/instkernel folder

into that folder. Then extract the BOOTER2_0_0_0.SEA by double clicking it. This should give you the BSD/Mac68k Booter program in a Booter 2.0.0 folder. You can remove the BOOTER2_0_0_0.SEA after extraction.

Before starting the BSD/Mac68k Booter program select the program and use File/Get info to set the preferred amount of memory to e.g. 20000. Then start the program. Click Options/Booting and set:

1. Kernel Location-> Mac OS file and use the Set button to select the NETBSD_INSTALL.GZ file you copied earlier.
2. BSD Root Device -> SCSI disk, ID: and enter the scsi id you remembered earlier.

Click OK.

Click Options/Monitors and select:

1. Change Monitor Depth
2. B&W

Click OK.

Click Options/Boot now. After boot accept the vt220 as your preferred terminal type. An installation menu appears.

Choose a. install netbsd to hard disk. You’ll enter the disk partitioner.

Choose b. continue

Choose the correct disk from the available disks. In our example that is option 2, disk sd1

Choose “only part of the disk” (remember there is a 400 Mb partition for Mac 8 already present)

At the disk partition map use option a: Select next partition to select the partition “Free”

Once selected choose option d: split selected partition.

Next, determine the size of the swap file (Apple_Scratch). A good choice is the same size as the amount of memory you gave Qemu. In our example that is 128 Mb, so some 270.000 blocks.

Back at Edit partition map, select the partition “Scratch” and choose b. Change selected partition, then choose type b. NetBSD Swap.

Back at Edit partition map, select the partition Free and choose b. Change selected partition, choose type d. NetBSD Root&Usr, then choose x: Exit

This finalises the partitioning and allows you to continue with the installation. So choose b: Yes

The disk is then formatted, after which you get to choose the installation type.

Choice a: allows full installation, but you can change the type if you want to.

Next, choose the installation media: a: CD-ROM / DVD. The installation then commences, which will take some time.

Once ready, hit enter to continue.

Configuring the system

Choose a: Configure network to configure the network.

Select a: sn0

Enter nothing at Network media type, and select a: Yes at Perform autoconfiguration.

Enter your host name.

Enter nothing at Your DNS domain, then accept the network configuration with a: Yes, and again a: Yes.

Booting NetBSD after installation

Once rebooted, start the BSD / Mac68k Booter again and select Options→ Booting

At Kernel location select BSD device and at a Kernel name enter “netbsd”, at Partition, enter “/” (without quotes).

Then save the options with File/ Save options and select Options/Boot now to boot NetBSD

The first thing you might want to do is to install a decent text editor, so run “pkgin install nano”

Getting X to run

For now, the X server will not run with the default 9.3 Kernel. However, you can download the Beta 10.0 kernel.

First check the availability of the latest kernel (then change the url below)

As root, use: ftp http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/202310140930Z/mac68k/binary/kernel/netbsd-WSFB.gz to download the kernel. Then copy the kernel to the root directory.

At next boot, use the booter to point to the new kernel name “netbsd-WSFB.gz” instead of “netbsd”.

If you opted to run xdm at boot during configuration of the system, you will boot into the X login screen. If not you can run startx to get to the graphical desktop after you logged in.

Installing the CDE desktop

If you want, you can install the Common Desktop Environment (CDE). Just follow this guide: http://45.76.81.249/NetBSD/m68k/

After you installed the prerequisites you run CDE with: startx /usr/dt/bin/Xsession

m68k-qemu-on-windows.txt · Last modified: 2024/04/28 03:20