PXE booting with OpenWRT Kamikaze

As a small appliance fan, I really like OpenWRT. I use it almost everywhere on my home network because it is agile, flexible, and opens up new possibilities for what used to be just a box that connected you to the Internet. With some of the newer models, like the WRTSL54GS, you can attach external storage or devices which opens up even more possibilities.

I spent some part of my waking hours today figuring out how to perform PXE booting to install OpenBSD (to save burning an ISO). If you’re not using the Kamikaze release, dnsmasq, as far as I am aware has not changed greatly so the following should still work. By the way, the great thing is that a dedicated tftp daemon is not required for all of this either. dnsmasq has it all built-in.

In order to enable PXE booting:
1. Log in as root
2. Add to /etc/dnsmasq.conf the following configuration options 1:

# PXE Booting (For installs):
# Define your own tftp-root, the user/group for this directory was
# nobody:nogroup from a leftover atftpd install
# This is the file that will be tftp'd across

3. Restart dnsmasq. In Kamikzae, the init scripts allow you to do:
/etc/init.d/dnsmasq restart

For older releases, you may need to find the process with `ps` and either send a SIGHUP `kill $pid -HUP`, or SIGTERM `kill $pid`, then restart it. Either one works.

4. For OpenBSD, drop `pxeboot` and `bsd.rd` into the tftp-root directory. Both can be found here.

5. Since the `pxeboot` image looks for `bsd` to slurp, you may need to create a symlink from bsd.rd to bsd:
`ln -s bsd.rd bsd`

6. Reconfigure the target host for installation to boot from LAN, and that should be it.

1More documentation is available here: http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html