Wednesday, June 25, 2014

Netbooting my iMac G3

I recently inherited an iMac G3 from a friend moving away and wanted to get Debian Wheezy on it via network boot. Here's how. My original resource was http://blog.jardinmagique.info/2009/05/net-install-and-setup-debian-ppc-on-new.html. This post distills those instructions to the bare minimum.

Preparing a Netboot Server

Fully automatic netboot requires a TFTP server to provide a boot image and a BOOTP server to advertise the image's availability. The Open Firmware boot command allows us to directly specify a TFTP server address and image, so we can skip the BOOTP part. So we'll just need a TFTP server with the right Debian netboot image.

I'm using a Debian wheezy installation in a virtual machine for my tftpd server.


Setting up tftpd

Most guides suggest using the "tftpd-hpa" package. The version in Debian wheezy seems to be broken, so I'm going for "tftpd". Run:
sudo apt-get install tftpd tftp
sudo mkdir /srv/tftpd

Next edit /etc/inetd.conf. Find the line specifying the command to start the tftpd server as "/usr/sbin/in.tftpd /srv/tftp" and add an argument "-s" before the directory name; that section of the line should read "/usr/sbin/in.tftpd -s /srv/tftp". This tells tftpd that when it receives a request for an absolute path like "/vmlinuz", it should serve the file "/srv/tftp/vmlinuz" instead of indicating that access is denied for the real absolute path, which is important to make the standard Debian netboot image work without modification.

Finally restart inetd:
sudo service openbsd-inetd restart


Preparing the Debian netboot image

Next we need to download the contents of the powerpc netboot image folder to /srv/tftpd. For wheezy, here's the command:
lftp -c mirror ftp://http.us.debian.org/debian/dists/wheezy/main/installer-powerpc/current/images/powerpc/netboot /srv/tftp

Let's test and see if we can download something:
tftp 127.0.0.1
tftp> get boot.msg
tftp> exit

If the "get boot.msg" command terminates, you've set tftp up correctly.

Netbooting the Mac

Boot the Mac, holding Command-Option-O-F. At the Open Firmware prompt, enter:
boot enet:<your tftpd server ip address>, yaboot

Once you get to the yaboot prompt, hit enter. From there you should be in the standard Debian installer.