The
EasyPeasy distribution is a nice choice for a netbook. The normal
install methods depend on either a Linux or Windows computer to copy the distribution to a USB drive and use the
unetbootin tool to prep the drive to be bootable.
I thought about porting unetbootin to Mac, but decided I didn't want to after looking at its source. I found that the architecture of the app is little bits and pieces of useful functionality farmed out to system utilities like
syslinux, all scattered throughout a bunch of
Tk UI code. Indeed, the options that I would expect to find enumerated in nice constants are instead examined as the raw strings presented in the UI. Without a good separation of UI and functionality, I decided that it wouldn't be worth the pain to do a port.
Instead, I opted to put together the pieces to install EasyPeasy over the network, with my MacBook Pro as the host.
The tools we need are:
- CPIO to manipulate the initrd so we can boot
- squashfs tools to extract files from the live image
- PXE boot environment for bootstrapping, consisting of a DHCP server and a TFTP server, as well as a binary from syslinux.
- NFS server to make the live image available as a root filesystem.
Alright, let's get started...
Download the easypeasy image
The
easypeasy site has you get a
.img.iso file by default, but to mount it on the Mac you'll need to get the plain
.iso file from
sourceforge. This can take a while, so might as well get it started now and setup some other stuff before you need to use the image. As of this writing, 1.5 is the latest version.
Setup the TFTP server
A PXE network boot uses TFTP to get the kernel and initrd for early boot. I've
written about that before, but you don't really need to do anything since Apple has provided a TFTP server in OS X 10.5. We just need to make its directory writable to avoid using sudo all the time:
sudo chmod 777 /private/tftpboot
Setup the DHCP server
Follow my
instructions for setting up the DHCP server.
Get and setup the PXE netboot binary
The PXE binary comes precompiled as part of the syslinux package, so we just need to download and extract it:
curl -O http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.84.tar.gz
tar xzvf syslinux-3.84.tar.gz syslinux-3.84/core/pxelinux.0
sudo cp syslinux-3.84/core/pxelinux.0 /private/tftpboot/
The PXE code looks for a config file based on the eee PC's MAC address, or falls back to a "default" config if that's not found. PXE allows for boot menus with various config options, but we'll just use a simple default config that's just suitable for loading Easy Peasy. (you could just edit
/private/tftpboot/pxelinux.cfg/default in-place if you prefer):
mkdir -p -m 777 /private/tftpboot/pxelinux.cfg
cat > /private/tftpboot/pxelinux.cfg/default <<END
prompt 1
default easypeasy
timeout 100
label easypeasy
kernel casper/vmlinuz
append boot=casper ip=dhcp root=/dev/nfs netboot=nfs nfsroot=192.168.1.50:/private/tftpboot initrd=initrd.gz --
END
Copy the files from the ISO
We need to mount the easypasy image file and copy the live CD files to a place we can share them. The live CD files are in the
casper directory in the EasyPeasy ISO, so we'll copy that whole directory to
/private/tftpboot. You could probably do this in Finder, but since we're already doing a bunch in Terminal, here's a recipe to do it from the command line (replace the path to the ISO with wherever you downloaded it to):
hdiutil mount -mountpoint /Volumes/easypeasy ~/Downloads/easypeasy-1.5.iso
cp -R "/Volumes/easypeasy/casper" /private/tftpboot/
chmod 777 /private/tftpboot/casper
Fixup the initrd for the eee PC 900
The initrd that's in the image is missing the ethernet network driver needed for the eee PC 900, so we'll grab it out of the squashfs root filesystem. To do that we need the
squashfs tools to extract the file, and an updated version of
CPIO to manipulate the initrd image. Follow those links and build the two tools, then come back here.
Figure out which driver you needBoot your netbook with whatever Linux it already has, and in a terminal use modprobe to get a list of all possible network drivers, and lsmod to figure out which of them is being used.
modprobe -l -t drivers/net > /tmp/netdrivers
for d in $(lsmod|cut -d' ' -f1); do grep $d /tmp/netdrivers; done
For my eee 900 running easypeasy 1.0, I get:
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/wan/hdlc_cisco.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/wireless/ath5k/ath5k.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/atlx/atl2.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/hamradio/6pack.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/acenic.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/macvlan.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/irda/act2001-sir.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/irda/actisys-sir.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/hamachi.ko
/lib/modules/2.6.27-8-eeepc/kernel/drivers/net/wireless/b43legacy.ko
It's not obvious which of those is the ethernet driver, but you can rule out the wan, wireless, hamradio, and irda stuff. With some trial and error, it turns out that it's the atl2 driver I need, so that's the one I'm sticking in the initrd for the netboot.
Figure out the path to the driver in the imageThe kernel version your netbook is currently running is probably different than what you're installing, so just grep for the driver in the listing of the contents of the live image.
cd /private/tftpboot
unsquashfs -n -l casper/filesystem.squashfs | grep atl2.ko
reveals that it's at:
squashfs-root/lib/modules/2.6.30.5-ep0/kernel/drivers/net/atlx/atl2.koCopy the ethernet driver into the initrdNow that you have the tools, and know which driver you need, it's a simple matter to update the initrd:
Get the driver out of the squashfs
cd /private/tftpboot
unsquashfs -n casper/filesystem.squashfs lib/modules/2.6.30.5-ep0/kernel/drivers/net/atlx/atl2.ko
Extract the contents of initrd
mkdir initrd-root
cd initrd-root
gunzip -c ../casper/initrd.gz | sudo cpio -imdv
Copy the extracted driver
sudo cp -R ../squashfs-root/ .
Put the initrd back together
find . | cpio -ov -H newc | gzip > ../initrd.gz
Setup a NFS share
OS X 10.5 has everything you need to export a NFS share, so we just need to set up the export. The init script will look for the live filesystem in the "casper" directory of the network root, so we'll share
/private/tftpboot which is its parent directory. If you already have NFS running, just edit the exports file. If this is your first NFS share, make a new exports file (you could just edit the
/etc/exports file if you prefer):
echo "/private/tftpboot -mapall=nobody -ro" > exports
sudo mv exports /etc/exports
Take the NFS server down and bring it back up (sure, you could just use the 'update' verb, but this works even if it wasn't already running):
sudo nfsd disable
sudo nfsd enable
After several seconds you can check that
/private/tftpboot is exported:
showmount -e
Setup the eee PC BIOS for network boot- Hit F2 while booting
- Right arrow to "Boot"
- Down arrow to "OnBoard LAN Boot"
- Enter and select "Enabled"
- F10 to save and exit
- Next reboot, hit F2 again
- Right arrow to "Boot"
- Enter on "Boot Device Priority" and set:
1st: Removable
2nd: Network
3rd: HDD
4th: CD-ROM - F10 to save and exit
Boot the Easypeasy ISO via netbootIn case you left them stopped above, now is the time to start all the servers:
sudo ifconfig en0 192.168.1.50
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
sudo /usr/sbin/dhcpd
sudo nfsd enable
Plug an ethernet cable between the eee PC and the Mac, and boot the eee PC.
At the
boot: prompt, just wait or hit enter for the default.
Be patient when it seems to hang at any of these boot messages:
[12.345678] sd 2:0:0:0: Attached scsi generic sg1 type 0
[16.324864] eth0: no IPv6 routers present
[32.109876] ACPI: Battery Slot [BAT0] (battery present)
Follow the instructions on screen to install EasyPeasy. You might have to manually run the install app (on the desktop) if it doesn't auto-start after booting. The install will take about 45 minutes, 30 minutes of which is copying files over NFS.
When you're done, you can shut down all the servers
sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist
sudo killall dhcpd
sudo nfsd disable