I install all my systems via PXE from a dedicated Slackware based host these days and have tailored the PXE server to support multiple versions of 32/64 bit Slackware plus GParted, memtest86 and a few other utilities.
With the recent addition of FreeBSD to my personal bag of tricks I needed a way to add FreeBSD installations to my Slackware PXE server. I did not see an easy way to do that initially as the FreeBSD handbook only documents serving from a FreeBSD system with custom kernel build for the PXE filesystem. So I set that task aside until a later time... which has now arrived.
Today I re-read the Handbook sections on
Diskless Operation and the
Boot Process and have now found a relatively easy way to serve FreeBSD installations from my Slackware host without having to build a custom kernel or any magic on my part! Here is how...
Step 1 - Configure network accessible mirror of FreeBSD installation media
To do this I mounted the DVD ISOs and copied them to an NFS export location on my Slackware PXE mirror host, /exports/freebsd/{32,64}. I then added these to my /etc/exports on the Slackware host.
Code:
/exports/freebsd/64 192.168.0.0/24(ro,no_root_squash,no_subtree_check)
/exports/freebsd/32 192.168.0.0/24(ro,no_root_squash,no_subtree_check)
Step 2 - Create FreeBSD path and pxe loaders in the Slackware tftp server
My tftp server is already working so I will not detail that here except to note that the root is /tftpboot.
I manage Linux based options through syslinux menu options using the Slackware pxelinux.0 boot loader. But FreeBSD must be loaded with its own
pxeboot loader, so I copied the /boot directories from the 32 and 64 bit FreeBSD exports to...
Code:
/tftpboot/freebsd/32/boot/...
/tftpboot/freebsd/64/boot/...
... which provides the respective pxeboot boot loaders, kernels and modules necessary to boot the kernel over a network.
Step 3 - Configure DHCP options
A key bit of knowledge from the Handbook was how to get the kernel to mount the root filesystem via NFS:
Quote:
The client executes filename, which is pxeboot(8), which then loads the kernel. When the kernel executes, the root file system specified by root-path is mounted over NFS.
|
So we must provide the host address and the root-path option to the client via the DHCP response delivered to PXE clients. So I added the following to my Slackware host /etc/dhcpd.conf (simplified)...
Code:
filename "/freebsd/32/boot/pxeboot";
option root-path "/exports/freebsd/32";
and
filename "/freebsd/64/boot/pxeboot";
option root-path "/exports/freebsd/64";
To "select" a FreeBSD I uncomment the target filename/option pair and comment out others then restart dhcpd. I will add a menu select option later.
Step 4 - Configure the respective fstabs
Finally, I had to configure the FreeBSD filesystem fstab files to mount the root filesystems via NFS...
Code:
#/exports/freebsd/32/etc/fstab
192.168.0.XXX:/exports/freebsd/32 / nfs ro 0 0
#/exports/freebsd/64/etc/fstab
192.168.0.XXX:/exports/freebsd/64 / nfs ro 0 0
... where 192.168.0.XXX is the static IP of the root filesystem mirror host on my network.
In my Slackware root filesystem mirror and DHCP hosts I restart nfsd and dhcpd...
Boot a suitable client machine to the network - works first time for both 32 and 64 bit!
Not only is it easy to set up, it will be equally easy to add or update versions in future!
I hope this is useful to other Linux/BSDers!
**** UPDATE ****
I used the above approach with the Dragonfly 4.0.1 install DVD with similar success.
Dragonfly provides two pxeboot loaders:
Code:
/boot/pxeboot
/boot/pxeboot_tftp
The man page for the tftp version indicates that it uses the normal kernel and loader whereas the non-tftp version uses BOOTP versions of the kernel and loader. I am not sure I fully understand the implications of that, but I was unable to boot using the pxeboot_tftp version.
So to recap, to PXE boot the Dragonfly installer:
1. Create an NFS export of the DVD to mount as root filesystem
2. Copy the /boot directory into the tftp server path
3. Add tftp-path/boot/pxeboot, option root-path /nfs-export-path/ to dhcpd.conf on PXE server
4. Modify /nfs-export-path/etc/fstab to mount / from NFS export
Boot and install Dragonfly over your local network!
By the way, I have performed multiple actual installs of both FreeBSD AMD64 and i386, and Dragonfly 64 to a VM from my PXE server using the above configuration - works great!