NetBSD-mac68k under qemu
qemu m68k emulation has come a long way, and can now boot and run NetBSD mac68k successfully, albeit with a few limitations. The below was run on a NetBSD amd64 box, with all the needed pkgsrc tools and libraries.
Clone qemu github repo fork & build
Update As of QEMU 8.2, the necessary patches have been merged into QEMU git master.
git clone -b q800.upstream3 https://github.com/mcayland/qemu.git q800-upstream3 cd q800-upstream3 ./configure --target-list=m68k-softmmu --enable-gtk --enable-sdl gmake
I'm not sure why, but there are also gitlab repos with the same path, but while there appear to be more recent changes to other code, the q800.upstream3 branch is missing.
It's also required to disable PaX mprotect(2) restrictions:
paxctl +m build/qemu-system-m68k
Grab the Apple Macintosh Quadra 800 ROM image
The emulation specifically targets the Quadra 800, so you need that specific ROM. It is available in a ROM collection at macintoshrepository.org.
Configure host networking
I chose to use a tap(4) device via a bridge(4) since that is what I have been using for other various emulators. You may wish to use something else. From my /etc/ifconfig.bridge0:
ifconfig tap0 create up brconfig bridge0 add alc0 add tap0 up
Create PRAM & disk images
PRAM must be exactly 256 bytes. Size the disk(s) as you wish, I've opted for 1GiB raw.
dd if=/dev/zero of=pram.img bs=256 count=1 dd if=/dev/zero of=MacHD8.1.img bs=64k count=$((16*1024)) dd if=/dev/zero of=netbsd-10.img bs=64k count=$((16*1024))
Through trial and error, I've found that the maximum memory that qemu will support for the emulated machine is 355MiB, any more and the ROM fails to initialise. Furthermore, NetBSD fails to recognise more than 256MiB.
I have also found that while graphical console output works fine, I am unable to have the NetBSD kernel recognise keystrokes (ADB issue?). However, serial console works fine, and was sufficient for completing the NetBSD installation.
Note that the mac address of the ethernet must also have the prefix 08:00:07 to be recognised - this is enforced by qemu, and anything else is overwritten.
qemu-system-m68k \ -M q800 -cpu m68040 -m 256 -bios Quadra800.rom \ -rtc base=localtime \ -g 1152x870x8 \ -boot d \ -drive file=pram-macos.img,format=raw,if=mtd \ -device scsi-hd,scsi-id=0,drive=hd0 \ -drive id=hd0,file=MacHD8.1.img,media=disk,format=raw,if=none \ -device scsi-hd,scsi-id=1,drive=hd1 \ -drive id=hd1,file=netbsd-10.img,media=disk,format=raw,if=none \ -device scsi-cd,scsi-id=3,drive=cd1 \ -drive id=cd1,file=MacOS_81.toast,media=cdrom,if=none \ -nic tap,model=dp83932,ifname=tap0,script=no,downscript=no,mac=08:00:07:12:34:56 \ -serial mon:stdio
Install MacOS 8.1. I've also tried MacOS 7.6, but it does not appear to recognise configured SCSI hard disks. I chose to create a 1GiB file to use as a raw hard disk image.
Copy in the netbsd booter and INSTALL kernel
I was already running netatalk, so this was the easiest way to copy files to MacOS. It is also possible to build disk images, configure TCP/IP networking (eg, fetch), etc. Getting enough initial tools into MacOS is the first hurdle.