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
- You are interested in exploring the PowerPC architecture, without investing in a physical system.
- You'd like to experiment with or help develop NetBSD/macppc.
- You want to have another option for small lightweight VMs.
Notes:
- I assume that you are installing this on a MacOS host system. That said, the process for other systems will be roughly the same. The only differences will be in command syntax and file paths.
- I assume that you have installed qemu with proper PowerPC support. I use MacPorts, but other package managers will have all necessary packages as well. See QEMU's installation page for further details.
- If you have
qemu-system-ppcin your $PATH then you are good to go! (Note: the focus here is only on 32-bit systems. Do not useqemu-system-ppc64.) - I will show installation of a fairly minimal system. A fuller installation is certainly possible! You may need to adjust qemu settings for, say, better audio or graphics support though.
- NetBSD-9.4 is the latest version of NetBSD/macppc I have been able to successfully install in a qemu VM. If/when progress is made in installing more recent versions I will update this blog.
Setup
- Create a working folder.
mkdir netbsd-9.4-qemu.cdinto this folder. You will be working in this folder here on out. - Download the installer .iso. I used this one. Move it into your working directory.
- 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 g3beige 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
- 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
#
Execute the
pdiskcommand:pdisk /dev/rwd0. Keep in mind that this is the same drive referred to ashdin Open Firmware. Unlike installing on real hardware we can be certain about what devices QEMU is providing us.You can experiment with
pdiskand partitioning schemes but for simplicity's sake let's say you initialize a new partition map with theicommand and then, for the bootloader, create a small 1MB partition with theCcommand, setting the type to Apple_HFS. You then create another partition with theccommand 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 completepdisksession 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
- Run
newfson the partitions you just created. Here this is only our single Root partitionnewfs /dev/rwd0a. You can confirm this by runningdisklabel. If we had created other partitions we'd runnewfson them as well. The labelais confirmed in thedisklabeloutput. 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,
...............................................................................
#
- Write an
/etc/fstabfile. 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 theapartition, 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.
- Now type
exitand 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
- 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 │
└─────────────────────────────────────────────┘
- 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 │
└─────────────────────────┘
- 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.
We're going to copy it to a temporary folder and make a bootable iso. This method is attributable to Reddit user Kernigh.
# mount /dev/wd0a /mnt
# chroot /mnt
# 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/wd0d
The partition /dev/wd0d 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
- A current project developing open source PowerPC based computers.
- A vendor selling POWER9 systems.
- A vendor selling PowerPC systems for perpetuating AmigaOS.
- The main page of the NetBSD/macppc port.
- The official NetBSD installation guide.
- A helpful Reddit thread.
- A previous entry in this blog which covers installing NetBSD/macppc 9.1 on a physical G4 system.
- A summary of commonly used Open Firmware commands.
- A tutorial for PowerPC Assembly Language.
posted at: 23:48 by: Adam Russell | path: /netbsd | permanent link to this entry
2020-11-30
NetBSD/MacPPC 9.1 Installation on a Power Macintosh G4
Summary
A Power Macintosh G4 system is so named because it is powered by a PowerPC G4 CPU. The G4 chip powered several Apple systems for roughly a five year period (1999 - 2004). After the G4 era Apple used another PowerPC chip, the G5, and then transitioned to Intel based chips until 2020 with the introduction of ARM based systems. The history of the PowerPC family of chips and the collaboration between IBM, Motorola, and Apple is well worth reading up on if you are a fan of computing history.
In any event, Apple’s G4 based product line was very popular and there are many available cheaply on the second hand market. A PowerPC based Apple computer running NetBSD is a nice low cost platform for hobby and research projects!
Using some rough benchmarks my G4 system is about 15 times slower than a modern (lower end) dual core Windows 10 computer I have. Still, for computers which are roughly twenty years old (as of this writing) they are surprisingly performant. NetBSD is as lean and mean of an Operating System as you can get and you can be assured you are getting about as much computational horsepower as possible out of these machines.
An outline of what follows:
- The NetBSD installer can be booted from a variety of media. Here I describe using a USB drive. If you use a CD or other installation media these steps will still mostly be the same, albeit it with minor modifications.
- The target system had no OS on it at the time of installation. I do not describe the use of Mac OS X based tools on the target system. That is certainly a viable option but not one I am as familiar with.
- I assume that you will be using this system exclusively for NetBSD. Multibooting will either require either a different partitioning scheme than what I describe here or separate drives for each OS.
- Disk partitioning was done using pdisk in the installer.
- Once the installation is completed several steps still need to be done in order to have NetBSD boot normally. These systems boot using Open Firmware v3.0 which requires slightly different steps than systems with older Open Firmware versions.
- Make sure you do some reading and understand pdisk and Open Firmware before proceeding.
- You should absolutely expect to start/stop this process a few times as you hit snags and deepen your knowledge of the process. Consider this a good thing! You are getting a valuable experience in hardware and processes known to only a relatively small number of people!
Creating Bootable Media
I did not happen to have any CD-R media available so I decided to boot the installer off of a USB drive. Surprisingly this method is not covered at all in the official docs but I eventually found something done for FreeBSD which described the necessary process.
- Download the installer .iso. I used this one.
- Write this to a USB drive. On Linux or OS X you would use the
ddcommand. On Windows there is a tool called rufus for doing this. I used an OS X computer for creating the installation media. - In the Terminal I used
diskutilto confirm the device for my USB drive. In the output below you can see that/dev/disk8is the USB drive I want to use.
$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 121.0 GB disk0s2
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +121.0 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD 37.9 GB disk1s1
2: APFS Volume Preboot 44.1 MB disk1s2
3: APFS Volume Recovery 512.3 MB disk1s3
4: APFS Volume VM 2.1 GB disk1s4
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk2
1: EFI EFI 209.7 MB disk2s1
2: Apple_HFS FantomHD 2.0 TB disk2s2
/dev/disk3 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: CD_partition_scheme Audio CD *590.9 MB disk3
1: CD_DA 43.7 MB disk3s1
2: CD_DA 45.1 MB disk3s2
3: CD_DA 40.0 MB disk3s3
4: CD_DA 55.0 MB disk3s4
5: CD_DA 37.4 MB disk3s5
6: CD_DA 26.5 MB disk3s6
7: CD_DA 21.8 MB disk3s7
8: CD_DA 41.7 MB disk3s8
9: CD_DA 30.9 MB disk3s9
10: CD_DA 151.3 MB disk3s10
11: CD_DA 36.7 MB disk3s11
12: CD_DA 60.9 MB disk3s12
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk4
1: EFI EFI 209.7 MB disk4s1
2: Apple_APFS Container disk6 2.0 TB disk4s2
/dev/disk5 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: CD_partition_scheme *7.2 MB disk5
1: Apple_partition_scheme 6.2 MB disk5s0
2: Apple_partition_map 32.3 KB disk5s0s1
3: Apple_HFS magicJack 165.9 KB disk5s0s2
/dev/disk6 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +2.0 TB disk6
Physical Store disk4s2
1: APFS Volume LaCie - Data 644.0 GB disk6s1
2: APFS Volume Preboot 81.0 MB disk6s2
3: APFS Volume Recovery 529.0 MB disk6s3
4: APFS Volume VM 6.4 GB disk6s4
5: APFS Volume LaCie 11.3 GB disk6s5
/dev/disk7 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: Apple_partition_scheme +18.0 MB disk7
1: Apple_partition_map 32.3 KB disk7s1
2: Apple_HFS Flash Player 18.0 MB disk7s2
/dev/disk8 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *4.0 GB disk8
1: EFI EFI 209.7 MB disk8s1
2: Apple_HFS Untitled 1 3.7 GB disk8s2
- The next step is to use the
ddcommand to write the installer .iso to the USB drive.
$ sudo diskutil unmountDisk /dev/disk8
Password:
Unmount of all volumes on disk8 was successful
$ sudo dd if=NetBSD-9.1-macppc.iso of=/dev/disk8 bs=1m conv=sync
382+1 records in
383+0 records out
401604608 bytes transferred in 162.164966 secs (2476519 bytes/sec)
$ sudo diskutil eject /dev/disk8
Disk /dev/disk8 ejected
- Remove the USB drive, it is now ready to boot the installer.
Booting the installer
Ok, this is perhaps the trickiest part because the information anyone reading this might need most likely will vary!
Put the USB drive into one of the Mac’s USB ports. Power on the system and hold down the CMD+Option+O+F keys until you are dropped into the Open Firmware prompt.
Now you need to identify a few things using the
devaliascommand. Typedevaliasand hit enter and inspect the output. Can you see the USB devices? You might see two, one for your keyboard and the other is your drive. Can you see one namedhd? That is your harddrive. You might havew multiple harddrives installed though. Which one do you plan on installing the system on? In the References section at the end of this article check out and read the Open Firmware pages I link to. Consider this required homework for a successful NetBSD/MacPPC installation!After understanding the device IDs for your USB drive with the installer and the drive you will be installing to you can boot with a command that looks like this:
boot usb1/disk:,\ofwboot.xcf netbsd.macppc
If this is successful you should see a bunch of boot messages and then the initial installer screen.
If you’ve made it this far, to a booted installer, savor your success before moving on to the next step.
Partitioning
In the installer menu choose the option to drop to a shell. Alternatively you could have chosen to drop to a shell immediately before the installer fully loads. Either one is fine. If you chose to drop to a shell instead of the installer you will need to run the
sysinstcommand when you are done partitioning to get back to the installer.Execute the
pdiskcommand. Your command will look something likepdisk /dev/rwd0c. In fact that might be exactly it, but to be sure you can look through the output ofdmesgorls /dev. Keep in mind that this is the same drive referred to ashdin Open Firmware and that the partitions you create here will map to, for example,hd:2orhd:3when you get around to the final boot configurations.You can experiment with
pdiskand partitioning schemes but for simplicity’s sake let’s say you initialize a new partition map with theicommand and then create a small 4MB partition with theCcommand, setting the type to Apple_HFS. You then create another partition with theccommand that uses up the rest of the disk. You can see the length of the unused space and just set the partitition size to match. If done this way on a system with a single hard drive you can refer to the first small Apple_HFS partition ashd:2in Open Firmware and the rest of the disk where your system installs ashd:3. Be sure to read a more detailed description of this step here. You can also create other parititions. See here for another example.Run
newfson the partitions you just created. You get the letters from pdisk. In my case of just one partition I just needednewfs /dev/rwd0abut be sure to do them all if you create others. The Apple_HFS partition will be handled later. That is your boot partition and requires more work.Write an /etc/fstab file. Here is what I did but you will need more if you created other partitions. This also assumes that your root partition is the a partition, which it almost surely is!
$ mount /dev/wd0a /mnt $ mkdir /mnt/etc $ ed /mnt/etc/fstab a /dev/wd0a / ffs rw 1 1 . wq $ umount /mntIf you started out in the installer then
exitwill get you back in. If you initially dropped into a shell executesysinstto get the installer screen.I did a network install. I went into the utilities menu and set a static IP for the ethernet interface. The installer does not seem to have a dhcp option. If you do not know the name of your ethernet interface inspecting
ifconfigoutput in the shell would help here. A few times during this I used the installer’s utilities menu to drop to a shell to get additional information.Most instructions say to go straight to the Re-install or install additional sets option but this did not work for me. I got an error saying that no root partition could be found. I resolved this by choosing the first “install” option and making sure that my root partition had a proper mount point of
/set and then saved and exited, ignoring the warnings about overlapping sectors. I then went back to Re-install or install additional sets and did a Full Installation via FTP.Assuming the installation exits OK (and it really should unless you run out of disk space or lose your network connection or something else similarly catastrophic) you are now able to proudly say you are about 75% of the way done. Savor the milestone! Take a break if needed.
Setting up a bootable system
You will still need to boot from the USB drive. Assuming you are still in the installer, exit and reboot the system. Do the four fingered salute of CMD+Option+O+F and get revisit our new friend Open Firmware.
In Open Firmware let’s get back into our system with boot usb1/disk:,\ofwboot.xcf hd:3,/netbsd. hd:3 is our newly installed NetBSD system which we are booting using our installer. We want to boot off that Apple_HFS partition instead!
This initial boot of your new system will be in Single User/Read Only mode.
You may need to export TERM=vt100 before using the shell
For whatever reason the Full Installation did not install pkgsrc which is necessary to get some required utilities for completing the process.
The pkgsrc installations steps are here but to summarize what I did:
- Mount the filesystem in read/write
mount -uw / - Make sure that my network interface was still configured as before.
- Manually ftp and install pkgsrc as described in the previous link.
- Install hfsutils.
# cd /usr/pkgsrc/sysutils/hfsutils # make # make install # make clean - manually ftp the bootloader ofwboot.xcf
# ftp https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/macppc/installation/ofwboot.xcf
# hformat /dev/wd0d # hcopy ofwboot.xcf :- In that last step you can use
disklabelto confirm the Apple_HFS partition.
You can now get your system out of single user mode and set up networking with dhcp.
# cd /etc
# vi rc.conf
Add the following to your rc.conf. Come up with whatever creative hostname you like!
rc_configured=YES
wscons=YES
hostname=G4
dhcpcd=YES
Finally, reboot and enter Open Firmware and set the following:
reset-nvram
setenv auto-boot? false
setenv boot-device hd:2,ofwboot.xcf
setenv boot-file hd:3,/netbsd
reset-all
And from now on you will be sent straight to the Open Formware prompt when you reboot your system. From there just type boot and your NetBSD system will come up!
Next Steps
Some suggested things to do with your new installation:
- Read the The Guide! (Ignore anything non-MacPPC specific when it comes to booting though.)
- Read the afterboot manpage.
- In particular, if you are new to NetBSD make sure you know how to install software with pkgsrc!
- Add additional users
- Set up sshd to remotely connect
- Configure a GUI Environment
At this point you now have a NetBSD system perfectly designed to foster any professional, hobby, or research activity you wish. Enjoy!
References
- The official installation guide.
- A summary of commonly used Open Firmware commands.
- Installation review for a similar G4 system.
- The best MacPPC installation report I’ve seen yet.
- An excellent tutorial on installing on Power Macintosh G4s.
posted at: 14:59 by: Adam Russell | path: /netbsd | permanent link to this entry