Contents |
To make testing on an embedded platform slightly efficient it is recommended to boot the device over the network and have the root file system on NFS. This allows for quick updates to the file system without needing to reimage and copy to a compact flash or HDD. A typical development might look like this, one switch shared between a desktop, a FreeBSD development server where miru directory server is built from SVN, and a target development server to PXE boot. The target server might be a PC as pictured or an embedded device.
Several infrastructure components are necessary to use PXE booting, similar to the LTSP environment. The following sections detail how to set those up on your FreeBSD development box, although a separate server or CD-ROM based miru directory server could be used.
Throughout this article the following IP addresses are going to be used, adjust appropriately for your network.
IP address Description 10.30.2.1 Router and DNS server or proxy 10.30.2.2 DHCP and TFTP server 10.30.2.10 NFS server 10.30.2.20 LTSP server 10.30.2.30 Ocean development server 10.30.2.40 Ocean target device 10.30.2.100-200 LTSP clients
Extra information on Preboot Execution Environment (PXE) is available on Wikipedia and the PXE Wiki.
For details on setting up a NFS server please review the FreeBSD handbook. On the NFS server, make sure that the following options are configured in the /etc/rc.conf file:
rpcbind_enable="YES" nfs_server_enable="YES" mountd_flags="-r"
The /etc/exports file contains the list of directories shared, we will export a special directory from the Ocean environment built for PXE support.
/usr/local/ocean/pxe-clone -alldirs -ro
A reboot will make FreeBSD set everything up properly. A reboot is not necessary though. Executing the following commands as root should start everything up. On the NFS server:
# rpcbind # nfsd -u -t -n 4 # mountd -r
Install the ISC-DHCP server.
# cd /usr/ports/net/isc-dhcp3-server # make install
Create a configuration file /usr/local/etc/dhcpd.conf
# dhcpd.conf
# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers 10.30.2.1;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates.
ddns-update-style ad-hoc;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
subnet 10.30.2.0 netmask 255.255.255.0 {
}
host ocean {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 10.30.2.40;
next-server 10.30.2.30;
filename "pxeboot";
option root-path "10.30.2.30:/mnt";
}
To start the server.
# /usr/local/sbin/dhcpd -f -cf /usr/local/etc/dhcpd.conf
Depending on your environment you might end up with two or three DHCP servers, it is recommended the services are easy to enable and disable to allow quick progression of development.
Install the TFTP-HPA server.
# cd /usr/ports/ftp/tftp-hpa # make install
Create a directory for the TFTP files to reside.
# mkdir /tftpboot
Start the server.
# /usr/local/libexec/in.tftpd -pls /tftpboot
In order to build a kernel that supports PXE booting and NFS ROOT alter the file configure_freesbie2.sh:
KERNELCONF="$OCEAN_HOME/conf/OCEAN.classic.developer"
Starting from an already built regular platform execute the following.
# rm /usr/obj/usr/local/ocean/freesbie2/.done_buildkernel # ./buildkernel.sh # ./install_freesbie2.sh # ./umount_img.sh # ./img_freesbie2.sh # ./mount_img.sh # ./clone_pxeimg.sh
Then reboot the target device and it should PXE boot the FreeBSD loader which TFTP loads the kernel which NFS mounts the root file system read only and continues normal operation.
To test the serial console from a PXE booting VMware machine add a serial port and configure as a Named Pipe.
Named Pipe: /tmp/.ocean This end is the server. The other end is an application.
Connect to the serial console via the named pipe on the host machine.
$ socat /tmp/.ocean stdio,raw,echo=0
WRAP hardware does not support PXE boot, it might be possible via future fixes to etherboot FreeBSD but currently not possible. For WRAP hardware please read the article HOWTO: Create miru directory server WRAP Developer Edition.
© 2009 Novell, Inc. All Rights Reserved.