NetBSD on Mac mini (PPC)

Here’re a few quick and dirty notes that describe how to install NetBSD on a Mac mini machine.

NetBSD 3.1 / macppc

Sources:
http://www.netbsd.org/Ports/macppc/models.html#macmini
http://www.schmonz.com/2006/06/29/installing-netbsd-on-powerpc-mac-mini
http://mail-index.netbsd.org/port-macppc/2001/09/02/0002.html

The disk will only contain NetBSD ; no Mac OS X installed.

Grab iso/macppccd-3.1.iso and burn it.

Extract ofwboot.xcf for macppccd-3.1.iso and build a “special” boot image

$ vnconfig vnd0 ./macppccd-3.1.iso
$ mount -t cd9660 -o ro /dev/vnd0a /mnt/cdrom
$ cd /mnt/cdrom
$ mkisofs -r -apple -o /tmp/macppccd-3.1-ofwboot.iso ofwboot.xcf

Boot the Mac, go to OF prompt and boot the NetBSD 3.1 CD-ROM.
Key strokes are “command+option+O+F”, which means “(Left) Win + (Left) Alt + o + f” on my Logitech PC keyboard 🙂

0 > boot cd:,ofwboot.xcf netbsd.macppc

Escape to a shell (press Ctrl-C when asked “Terminal type?“)

Configure the network interface (gem0) and mount the NFS share (where the “special” iso file was previouslt created ;). Write the “special” iso file to the disk:

$ cd /mnt/nfs/ptijo/iso
$ dd if=macppccd-3.1-ofwboot.iso of=/dev/wd0c
$ exit

Proceed to the normal NetBSD installation.

“Choose your installation”: Set sizes of NetBSD partitions

In the disklabel summary, select “Show unused partitions”.
Remember to set a 1MB partition at the beginning of the disk:

a:  31456656      3024     4.2BSD   2048 16384 28088  # (Cyl.      3 -  31209)
b:   4194288  31459680       swap                     # (Cyl.  31210 -  35370)
c: 156301488         0     unused      0     0        # (Cyl.      0 - 155060)
h: 120647520  35653968     4.2BSD   1024  8192 46624  # (Cyl.  35371 - 155060)
o:      3024         0    ISO9660       0             # (Cyl.      0 -      2)

Finish the install, reboot the computer and get back to OF.

Configure OF to boot NetBSD:

0 > setenv boot-command " screen" output boot
0 > setenv boot-device hd:OFWBOOT.XCF;1
0 > setenv auto-boot? true
0 > reset-all

Watch NetBSD booting… 🙂
Enjoy !!!

Upgrade to NetBSD 4.0_BETA2 / macppc

Grab a daily binary from your local mirror and install the new kernel:

$ mv /netbsd /onetbsd
$ tar xvzpf kern-GENERIC.tgz -C /

Build a “special” iso file for 4.0_BETA2 and replace the previous ofwboot:

$ cd macppc/installation
$ mkisofs -r -apple -o ../macppccd-4.0_BETA2-ofwboot.iso ofwboot.elf ofwboot.xcf
$ disklabel wd0 > /root/disklabel.wd0
$ dd if=../macppccd-4.0_BETA2-ofwboot.iso of=/dev/wd0c seek=32 skip=32
$ disklabel wd0		# check if it still ok ;p

Cross your finger and reboot…

Install the rest of the distribution:

$ cd macppc/binary/sets
$ for i in base comp games man misc text xbase xcomp xetc xfont xserver; do
tar xzpvf $i.tgz -C /
done
$ mkdir /tmp/tmproot
$ tar xzpvf etc.tgz -C /tmp/tmproot
$ postinstall -s /tmp/tmproot check
# run the "postinstall" command as described by the previous command
$ etcupdate -s /tmp/tmproot

Cross your finger and reboot…

NetBSD 4.0 / macppc

Source: http://www.netbsd.org/ports/macppc/partitioning.html#pdisk

Grab the 4.0 iso file and burn it.

Use Win+Alt+O+F on boot to drop to OBP and boot on the CD:

 0 > boot cd:,ofwboot.xcf netbsd.macppc
 [...]
 erase ^H, werase ^W, kill ^U, intr ^C, status ^T
 Terminal type? [vt100]
 Erase is backspace.
 (I)nstall, (S)hell or (H)alt ?

Start a (S)hell.

Initialize the disk:

 # pdisk /dev/wd0c
 Command (? for help): i
 map already exists
 do you want to reinit? [n/y]: y
 Command (? gor help): P

 Partition map (with 512 byte block) on '/dev/wd0c'
  #:                type name      length   base       ( size )
  1: Apple_Partition_map Apple         63 @ 1
  2:          Apple_Free Extra  156301424 @ 64         ( 74.5G)

 Device block size=512, Number of Blocks=156301488 (74.5G)
 DeviceType=0x0, DeviceId=0x0

Partition the disk:

 Command (? gor help): P

 Partition map (with 512 byte blocks) on '/dev/wd0c'
  #:                type name      length   base      ( size )
  1: Apple_partition_map Apple         63 @ 1
  2:           Apple_HFS boot      204800 @ 64        (100.0M)
  3:     Apple_UNIX_SVR2 root     2097152 @ 204864    (  1.0G) S0 RUFS k0  /
  4:     Apple_UNIX_SVR2 swap      524288 @ 2302016   (256.0M) S1  SFS k0  (swap)
  5:     Apple_UNIX_SVR2 usr      8388608 @ 2826304   (  4.0G) S2  UFS k0  /usr
  6:     Apple_UNIX_SVR2 home   145086576 @ 11214912  ( 69.2G) S2  UFS k0  /home

 Device block size=512, Number of Blocks=156301488 (74.5G)
 DeviceType=0x0, DeviceId=0x0

Write the partition map and quit.

Create the FS:

 # newfs /dev/wd0a
(...)

Prepare the root filesystem:

 # mount /dev/wd0a /mnt
 # mkdir mnt/etc
 # cat >> mnt/etc/fstab
 /dev/wd0a / ffs rw 1 1
 /dev/wd0b none swap sw 0 0
 ^D
 # umount /mnt
 # exit

In the sysinstall menu, select “Re-install sets or install additional sets” and proceed to install as usual.

Finish the install manually, using [Utility menu]/[Run /bin/sh]:

 # mount /dev/wd0a /mnt
 # cd /mnt/dev
 # sh MAKEDEV all
 # cd /mnt/etc
 # cat >> rc.conf
rc_configured=YES
^D
 # cd /
 # umount /mnt
 # exit

Reboot the computer and use Win+Alt+O+F on boot to drop to OBP.

Boot on the CD:

0 > boot cd:,ofwboot.xcf netbsd.macppc

Open a shell, configure the network and mount wd0a as a chroot.

Install sysutils/hfsutils from a public FTP server:

# pkg_add ftp://ftp2.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/macppc/4.0_2008Q2/sysutils/hfsutils-3.2.6nb1.tgz

Prepare the HFS (boot) partition:

# hformat -l boot /dev/wd0d
# hmount /dev/wd0d
# hcopy /usr/mdec/ofwboot.xcf :
# hcopy /netbsd :
# humount /dev/wd0d

Quit chroot, unmount every partition and reboot.

Use Win+Alt+O+F on boot to drop to OBP:

0> boot hd:2,ofwboot.xcf netbsd

Now that NetBSD booted correctly, save the parameters in OBF.
Reboot and Win+Alt+O+F on boot to drop to OBP:

 0 > setenv auto-boot? true
 0 > setenv boot-device hd:2,ofwboot.xcf
 0 > setenv boot-file /netbsd
 0 > setenv boot-command " screen" output boot
 0 > reset-all

NetBSD 4.99.x / macppc

The NetBSD/macppc 4.99.72 iso doesn’t boot on my Mac Mini G4. I’ll use netbsd-4 iso file to install -CURRENT.

Grab and burn a netbsd-4 iso file.

Grab hfs-utils for netbsd-4, extract the binaries and make them available to the mini (USB, NFS…)

# ftp ftp://ftp2.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/macppc/4.0_2008Q2/sysutils/hfsutils-3.2.6nb1.tgz

Power-on the Mac Mini and issue Win+Alt+O+F on boot to drop to OBP.
Boot on the CD:

0 > boot cd:,ofwboot.xcf netbsd.macppc

Enter the (S)hell, initialize and partition the disk:

# pdisk /dev/wd0c
 Command (? for help): i
 map already exists
 do you want to reinit? [n/y]: y
(...)
 Command (? gor help): P

 Partition map (with 512 byte blocks) on '/dev/wd0c'
  #:                type name      length   base      ( size )
  1: Apple_partition_map Apple         63 @ 1
  2:           Apple_HFS boot      204800 @ 64        (100.0M)
  3:     Apple_UNIX_SVR2 root     2097152 @ 204864    (  1.0G) S0 RUFS k0  /
  4:     Apple_UNIX_SVR2 swap      524288 @ 2302016   (256.0M) S1  SFS k0  (swap)
  5:     Apple_UNIX_SVR2 usr      8388608 @ 2826304   (  4.0G) S2  UFS k0
  6:     Apple_UNIX_SVR2 home   145086576 @ 11214912  ( 69.2G) S2  UFS k0

 Device block size=512, Number of Blocks=156301488 (74.5G)
 DeviceType=0x0, DeviceId=0x0

 Command (? gor help): W
 Writing the map destroys what was there before. Is that okay? [n/y]: y
 Command (? gor help): Q

Create the usr and home partition:

 # disklabel -i wd0
 partition> P
 (...)

Create the filesystems and mount them:

# newfs -O 2 /dev/wd0a
# newfs -O 2 /dev/wd0e
# newfs -O 2 /dev/wd0g
# mkdir /mnt/root
# mount /dev/wd0a /mnt/root
# mkdir /mnt/root/usr
# mount /dev/wd0g /mnt/root/usr
# mkdir /mnt/root/home
# mount /dev/wd0e /mnt/root/home

Mount the NFS share where release and hfs-utils lies:

# mkdir /mnt/nfs
# mount -t nfs filer:/release /mnt/nfs

Install the files to root:

 # cd /mnt/nfs/release
 # for FIC in base etc man misc text; do tar xzpf $FIC.tgz -C /mnt/root/; done
 # cd /mnt/root/dev && sh MAKEDEV all

Configure the HFS boot partition:

# cd /mnt/nfs/hfs-utils
To be continued…

No Comments

Leave a Reply

%d bloggers like this: