RabbitFarm

2026-04-12

NetBSD/MacPPC 9.4 Installation on a QEMU emulated PowerPC Macintosh

Summary

Apple last used PowerPC chips about twenty years ago, then transitioned to Intel based chips until 2020 with the introduction of ARM based systems. For many years the older PowerPC based systems could be inexpensively purchased on the used market. As time continues to pass these are increasingly rare to find at all, much less in good working order. For the time in which they could be easily obtained cheaply they were a good source of reasonably powerful systems that could be leveraged for research and hobby usage via open source operating systems, mainly NetBSD and Debian Linux. These operating systems continue to support the PowerPC architecture. Indeed the platform is far from dead and continues to see advancement and usage, albeit it mostly in niche contexts. QEMU supports PowerPC emulation of a nice representative variety of systems. For our purposes we will only focus on emulation of PowerPC Apple Macintosh systems.

Reasons to keep reading

Notes:

Setup

  1. Create a working folder. mkdir netbsd-9.4-qemu. cd into this folder. You will be working in this folder here on out.
  2. Download the installer .iso. I used this one. Move it into your working directory.
  3. Create your QEMU VM's virtual disk. Again, this is a minimal installation so I'll go with a 512MB disk. You can name it whatever you want, of course. Some people choose a future hostname and use that. Here I just keep it generic.
  
% qemu-img create -f qcow2 netbsd.qcow2 0.512G

Booting the installer

I put the following into a shell script.

 
#!/bin/sh

MEM=1g
qemu-system-ppc \
        -M g3beige \
        -m $MEM  \
        -nographic \
        -drive id=hda,format=qcow2,file=netbsd.qcow2 \
        -netdev user,id=net0,hostfwd=tcp::3333-:22,ipv6=off \
        -net nic,model=rtl8139,netdev=net0 \
        -cdrom NetBSD-9.4-macppc.iso  

The choice of mac99 tells QEMU to emulate one of these. Another option would be mac99, for G4 emulation. The choice of memory is the most fragile option here! Anything other than exactly 1G or 2G results in installer crashes or, upon installation, kernel panics. So far it seems the cause of this is still undetermined. Also, we are telling QEMU to forward port 22 to 3333 for ssh access and to have only a console environment. The choice of emulated network interface is somewhat arbitrary. At one time I chose rtl8139 and it always seems to work without issue. Finally, notice that we are mounting the installer .iso in the emulated cdrom drive.

Suppose we saved that script in a file called boot. Execute it like this.

 
% chmod +x boot
% ./boot 

and now you'll be greeted with an Open Firmware prompt.

 
% ./boot

>> =============================================================
>> OpenBIOS 1.1 [Sep 24 2024 19:56]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 1
>> Memory: 1024M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,750
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Sep 24 2024 19:56
Trying hd:,\\:tbxi...
Trying hd:,\ppc\bootinfo.txt...
Trying hd:,%BOOT...
No valid state has been set by load or init-program

0 > 

The system doesn't know to boot the installer from the emulated CD. All we need to do is tell it where the boot file ofwboot.xcf is located. After we do that we can see the installer boot the system.

 
0 > boot cd:,ofwboot.xcf >> switching to new context:

>> NetBSD/macppc OpenFirmware Boot, Revision 1.13 (Sat Apr 20 13:32:22 UTC 2024)
open /netbsd: No such file or directory
open /netbsd.gz: No such file or directory
6587420+126944=0x6677c0
 start=0x100000
[   1.0000000] mem region 0 start=0 size=40000000
[   1.0000000] avail region 0 start=0x4000 size=0x3ffc000
[   1.0000000] avail region 1 start=0x4800000 size=0x3b458000
[   1.0000000] avail region 2 start=0x3fe10000 size=0xda000
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[   1.0000000]     2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[   1.0000000]     2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[   1.0000000]     2024
[   1.0000000]     The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights reserved.
.
.
.

After much more output we are now booted into the installer.

Installation

  1. In the installer menu choose the option to drop to a shell.
 
[   4.2304060] wd0 at atabus0 drive 0
[   4.2304060] wd0: 
[   4.2304060] wd0: 524 MB, 1065 cyl, 16 head, 63 sec, 512 bytes/sect x 1073742 sectors
[   4.2304060] atapibus0 at atabus1: 2 targets
[   4.2304060] cd0 at atapibus0 drive 0:  cdrom removable
[  11.4229100] wskbd0 at adbkbd0 mux 1
[  11.4229100] nadb0: ADB relative pointing device not configured
[  11.4416050] boot device: grackle0
[  11.4416050] root on md0a dumps on md0b
[  11.4416050] root file system type: ffs
[  11.4416050] kern.module.path=/stand/macppc/9.4/modules
erase ^H, werase ^W, kill ^U, intr ^C, status ^T
Terminal type? [vt100] 
Erase is backspace.                                                     
(I)nstall, (S)hell or (H)alt ? s
# 

  1. Execute the pdisk command: pdisk /dev/rwd0. Keep in mind that this is the same drive referred to as hd in Open Firmware. Unlike installing on real hardware we can be certain about what devices QEMU is providing us.

  2. You can experiment with pdisk and partitioning schemes but for simplicity's sake let's say you initialize a new partition map with the i command and then, for the bootloader, create a small 1MB partition with the C command, setting the type to Apple_HFS. You then create another partition with the c command that uses up the rest of the disk. You can see the length of the unused space and just set the partition size to match. Alternatively, as I usually do, I just set the length to the first block (e.g. 3p) and that uses up all the remaining space. The complete pdisk session is below. I do a couple of extra prints of the partition map for clarity.

 
# pdisk /dev/rwd0
pdisk: No valid block 1 on '/dev/rwd0'
Edit /dev/rwd0 -
Command (? for help): p
No partition map exists
Command (? for help): i
Command (? for help): p

Partition map (with 512 byte blocks) on '/dev/rwd0'
 #:                type name    length   base    ( size )
 1: Apple_partition_map Apple       63 @ 1      
 2:          Apple_Free Extra  1073678 @ 64      (524.3M)

Device block size=512, Number of Blocks=1073742 (524.3M)
DeviceType=0x0, DeviceId=0x0

Command (? for help): C
First block: 2p
Length in blocks: 1m
Name of partition: Boot
Type of partition: Apple_HFS
Command (? for help): c
First block: 3p
Length in blocks: 3p
Name of partition: Root
Available partition slices for Apple_UNIX_SVR2:
  a   root partition
  b   swap partition
  c   do not set any bzb bits
  g   user partition
Other lettered values will create user partitions
Select a slice for default bzb values: a
Command (? for help): p

Partition map (with 512 byte blocks) on '/dev/rwd0'
 #:                type name    length   base    ( size )
 1: Apple_partition_map Apple       63 @ 1      
 2:           Apple_HFS Boot      2048 @ 64      (  1.0M)
 3:     Apple_UNIX_SVR2 Root   1071630 @ 2112    (523.3M) S0 RUFS k0  /

Device block size=512, Number of Blocks=1073742 (524.3M)
DeviceType=0x0, DeviceId=0x0

Command (? for help): w
Writing the map destroys what was there before. Is that okay? [n/y]: y
Command (? for help): q

  1. Run newfs on the partitions you just created. Here this is only our single Root partition newfs /dev/rwd0a. You can confirm this by running disklabel. If we had created other partitions we'd run newfs on them as well. The label a is confirmed in the disklabel output. The Apple_HFS partition will be handled later. That is your boot partition and requires more work.
 
# disklabel wd0
# /dev/rwd0:
type: ESDI
disk: wd0
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 1065
total sectors: 1073742
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0       # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   1071630      2112     4.2BSD      0     0     0  # (Cyl.      2*-   1065*)
 c:   1073742         0     unused      0     0        # (Cyl.      0 -   1065*)
 d:      2048        64        HFS                     # (Cyl.      0*-      2*)
disklabel: boot block size 0
disklabel: super block size 0
# newfs /dev/rwd0a
/dev/rwd0a: 523.3MB (1071630 sectors) block size 8192, fragment size 1024
    using 12 cylinder groups of 43.61MB, 5582 blks, 10880 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 89344, 178656, 267968, 357280, 446592, 535904, 625216, 714528, 803840,
...............................................................................
#

  1. Write an /etc/fstab file. Here is what I did but, again, you will need more if you created other partitions. For the record, this also assumes that your root partition is the a partition, which it surely is!
  
$ mount /dev/wd0a /mnt
$ mkdir /mnt/etc
$ ed /mnt/etc/fstab
a
/dev/wd0a / ffs rw 1 1
.
wq
$ umount /mnt

Notice that for writing this small simple file we use the classic ed editor! You can always research it more deeply on your own, but for now just follow the commands as shown.

  1. Now type exit and go back to the installer.
 
# exit
erase ^H, werase ^W, kill ^U, intr ^C, status ^T
Terminal type? [vt100] 
Erase is backspace.                                                     
(I)nstall, (S)hell or (H)alt ? i

  1. You are now back in the main installer.

 NetBSD/macppc 9.4

 This menu-driven tool is designed to help you install NetBSD to a hard disk,
 or upgrade an existing NetBSD system, with a minimum of work.
 In the following menus type the reference letter (a, b, c, ...) to select an
 item, or type CTRL+N/CTRL+P to select the next/previous item.
 The arrow keys and Page-up/Page-down may also work.
 Activate the current selection from the menu by typing the enter key.



                ┌─────────────────────────────────────────────┐
                │>a: Installation messages in English         │
                │ b: Messages d'installation en fran?ais      │
                │ c: Installation auf Deutsch                 │
                │ d: Komunikaty instalacyjne w jezyku polskim │
                │ e: Mensajes de instalacion en castellano    │
                └─────────────────────────────────────────────┘

  1. Continue along and you'll come to this screen.
 
 You have chosen to install NetBSD on your hard disk.  This will change
 information on your hard disk.  You should have made a full backup before
 this procedure!  This procedure will do the following things:
                 a) Partition your disk
                 b) Create new BSD file systems
                 c) Load and install distribution sets
                 d) Some initial system configuration

 (After you enter the partition information but before your disk is changed,
 you will have the opportunity to quit this procedure.)   

 Shall we continue?
                               ┌───────────────┐
                               │ Yes or no?    │
                               │               │
                               │ a: No         │
                               │>b: Yes        │
                               └───────────────┘

Enter Yes and then on the next screen choose your virtual disk.


 On which disk do you want to install NetBSD?


                          ┌──────────────────────────┐
                          │ Available disks          │
                          │                          │
                          │>a: wd0 (524M)            │
                          │ b: Extended partitioning │                          
                          │ x: Exit                  │
                          └──────────────────────────┘

On the next screen choose Use existing disklabel partitions. We've already done the work of partitioning.


 If you do not want to use the existing partitions, you can use a simple
 editor to set the sizes of the NetBSD partitions, or remove existing ones and
 apply the default partition sizes.

 You will then be given the opportunity to change any of the partition
 details.

 The NetBSD (or free) part of your disk (wd0) is 524M.

 A full installation requires at least 988M without X and at least 1244M if
 the X sets are included.

                    ┌──────────────────────────────────────┐
                    │ What would you like to do?           │
                    │                                      │
                    │>a: Use existing disklabel partitions │
                    │ b: Set sizes of NetBSD partitions    │
                    │ c: Use default partition sizes       │
                    │ x: Cancel                            │
                    └──────────────────────────────────────┘

There is a trick to the next screen! If you've been following along then you'll see this.


 We now have your disklabel partitions for wd0 below.  This is your last
 chance to change them.

 Flags: (I)nstall, (N)ewfs.  Total size: 524M, free: 0B

     Start (sec)    End (sec)   Size (sec)  FS type Flag Filesystem
    ------------ ------------ ------------ -------- ---- ----------------
 a:         2112      1073741      1071630      FFS I    /mnt
 b:            0      1073741      1073742 Whole disk
 c:           64         2111         2048      HFS
    ------------ ------------ ------------ -------- ---- ----------------
 e: Add a partition
 f: Change input units (sectors/cylinders/MB/GB)
 g: Edit name of the disk
 h: Clone external partition(s)
 i: Cancel          
>x: Partition sizes ok

You must change the Filesystem on your a partition to /. It is still set to /mnt from a previous step.


We now have your disklabel partitions for wd0 below.  This is your last
 chance to chan┌────────────────────────────────────────────────────────────┐
               │ The current values for this partition are                  │
 Flags: (I)nsta│ displayed below.                                           │
               │                                                            │
     Start (sec│ Select the field you wish to change:                       │
    -----------│                                                            │
>a:         211│ a:             type : FFS                                  │
 b:            │ b:            start : 2112 sec                             │
 c:           6│ c:             size : 1071630 sec                          │
    -----------│ d:              end : 1073742 sec                          │
 e: Add a parti│ e:          install : Yes                                  │
 f: Change inpu│ f:            newfs : No                                   │
 g: Edit name o│ g:            mount : Yes                                  │
 h: Clone exter│ h:    mount options :                                      │
 i: Cancel     │>i:      mount point : /mnt                                 │
 x: Partition s│ j:    avg file size : 4 fragments                          │
             ┌────────────────────────────────────────────────────┐         │
             │mount point (or 'none') [/mnt]: /                   │         │
             └────────────────────────────────────────────────────┘         │
               │ n: Restore original values                                 │
               │ <: page up, >: page down                                   │
               └────────────────────────────────────────────────────────────┘

Continue along until this screen.


 The NetBSD distribution is broken into a collection of distribution sets.
 There are some basic sets that are needed by all installations and there are
 some other sets that are optional.  You may choose to install a core set       
 (Minimal installation), all of them (Full installation), or a custom group of
 sets (Custom installation).






                        ┌─────────────────────────────┐
                        │ Select your distribution    │
                        │                             │
                        │>a: Full installation        │
                        │ b: Installation without X11 │
                        │ c: Minimal installation     │
                        │ d: Custom installation      │
                        │ x: Abandon installation     │
                        └─────────────────────────────┘

We're just going to choose c for a minimal installation. If you want a bigger installation you'll want to redo the virtual disk sizes the next time around. Remember, we're just working with 512MB here.

On the next screen you can choose to install from the virtual CD-ROM drive.


Your disk is now ready for installing the kernel and the distribution sets.
 As noted in your INSTALL notes, you have several options.  For ftp or nfs,
 you must be connected to a network with access to the proper machines.         

 Sets selected 4, processed 0, Next set kern-GENERIC.

                          ┌─────────────────────────┐
                          │ Install from            │
                          │                         │
                          │>a: CD-ROM / DVD         │
                          │ b: HTTP                 │
                          │ c: FTP                  │
                          │ d: NFS                  │
                          │ e: Floppy               │
                          │ f: Unmounted fs         │
                          │ g: Local directory      │
                          │ h: Skip set             │
                          │ i: Skip set group       │
                          │ j: Abandon installation │
                          └─────────────────────────┘

  1. Assuming the installation exits OK (and it really should unless you run out of disk or something else similarly catastrophic) you are now almost all done. All that remains is to set up the bootloader. When you see this message do not believe that you are able to boot properly!

 The extraction of the selected sets for NetBSD-9.4 is complete.  The system
 is now able to boot from the selected hard disk.  To complete the
 installation, sysinst will give you the opportunity to configure some         
 essential things first.                                                       





                           ┌───────────────────────┐
                           │>Hit enter to continue │
                           └───────────────────────┘

The next screen allows you to prepare some system settings. You'll want to at least set a root password and add a non-root user. For the sake of brevity I am not going to go into these settings into any details. Doing so will part of the fun of administering a NetBSD system!


 Configure the additional items as needed.


 a: Configure network                                  configure               
 b: Timezone                                           UTC
 c: Root shell                                         /bin/sh
 d: Change root password                               ***EMPTY***
 e: Enable installation of binary packages             install
 f: Fetch and unpack pkgsrc                            install
 g: Enable sshd                                        NO
 h: Enable ntpd                                        NO
 i: Run ntpdate at boot                                NO
 j: Enable mdnsd                                       NO
 k: Enable xdm                                         NO
 l: Enable cgd                                         YES
 m: Enable lvm                                         NO
 n: Enable raidframe                                   YES
 o: Add a user  
>x: Finished configuring

After this you will go back to the installer main menu and choose Utility menu


 NetBSD/macppc 9.4

 This menu-driven tool is designed to help you install NetBSD to a hard disk,   
 or upgrade an existing NetBSD system, with a minimum of work.                  
 In the following menus type the reference letter (a, b, c, ...) to select an
 item, or type CTRL+N/CTRL+P to select the next/previous item.
 The arrow keys and Page-up/Page-down may also work.
 Activate the current selection from the menu by typing the enter key.

 If you booted from a floppy, you may now remove the disk.
 Thank you for using NetBSD!
               ┌───────────────────────────────────────────────┐
               │ NetBSD-9.4 Install System                     │
               │                                               │
               │ a: Install NetBSD to hard disk                │
               │ b: Upgrade NetBSD on a hard disk              │
               │ c: Re-install sets or install additional sets │
               │ d: Reboot the computer                        │
               │>e: Utility menu                               │
               │ f: Config menu                                │
               │ x: Exit Install System                        │
               └───────────────────────────────────────────────┘

On the screen after this choose Run /bin/sh. We're going to use the shell to configure the bootloader.

Setting up a bootable system

Let's make this sytem ready to boot on its own. The bootloader, which we used to boot the installer from the virtual cd-rom, is now also located in /usr/mdec.


$ ls -l /usr/mdec
total 1092
-r--r--r--  1 root  wheel    1824 Apr 20  2024 bootxx
-r--r--r--  1 root  wheel   63658 Apr 20  2024 ofwboot
-r--r--r--  1 root  wheel   64600 Apr 20  2024 ofwboot.elf
-r--r--r--  1 root  wheel  409450 Apr 20  2024 ofwboot.xcf

We're going to copy it to a temporary folder and make a bootable iso. This method is attributable to Reddit user Kernigh.


# mkdir /tmp/boot
# cp /usr/mdec/ofwboot.xcf /tmp/boot
# makefs -t cd9660 /tmp/boot.iso /tmp/boot
# dd if=/tmp/boot.iso of=/dev/wd0c

The partition /dev/wd0c can be confirmed from your earlier disklabel output.

The bootloader is now at hd:,ofwboot.xcf;1. Halt the system with halt -p and return to your MacOS command line. Create a new boot script for launching the completed system.


#!/bin/sh
exec qemu-system-ppc -m 1024 \
    -M g3beige \
    -nographic \
    -net nic,model=rtl8139,netdev=net0 \
    -netdev user,id=net0,hostfwd=tcp::3333-:22,ipv6=off \
    -prom-env 'boot-device=hd:,ofwboot.xcf;1' \
    -hda netbsd.qcow2

And from now on your QEMU NetBSD/macppc system will boot automatically. Check out the NetBSD Guide for what you can do as you begin to explore your new system. Virtually (no pun intended!) anything you can do on a physical NetBSD system you can do in your QEMU VM.

For further information on NetBSD/macppc systems check out some of the following links,

References

posted at: 23:48 by: Adam Russell | path: /netbsd | permanent link to this entry