Netbooting an ARM board

NFSROOT

These examples use bbb for the BeagleBone Black board. You may wish to change this string if you are using some other board.

Using a tftp and dhcp server that you own

If you are using a tftp server and a dhcp server that you own (i.e. can modify its configuration) this is the easiest method. First see Developing and Cross-building for ARM Systems to build FreeBSD world and kernel.

DHCP configuration

In your dhcpd.conf add a new group for arm boards and add the board :

group armv7 {
  option root-path "tftp://<TFTP_SERVER_IP>/armv7";
  filename "armv7/loader.efi";
  host bbb {
    option root-path "<NFS_SERVER_IP>:/nfsroot/armv7/bbb";
    hardware ethernet <BOARD_MAC_ADDRESS>;
    fixed-address <BOARD_IP_ADDRESS>;
  }

TFTP Server setup

In /etc/inetd.conf of the tftp server uncomment the line :

tftp    dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot

And create a /tftpboot/armv7 directory and a /tftpboot/dtb directory. Those directories will hold the loader and the DTBs.

Place loader.efi in /tftpboot/armv7 and the DTBs in /tftpboot/dtb/

Then do :

sysrc inetd_enable="YES"
service inetd start

NFS Server configuration

Please refer to the handbook for NFS configuration

Cross installation

To install FreeBSD in the nfsroot simply do

make installworld installkernel distribution DESTDIR=/nfsroot/armv7/bbb/

Tweak board settings

A few tweaks needs to be done so you won't have surprises when booting the board. In /nfsroot/armv7/bbb/boot/loader.conf add :

boot.nfsroot.options="nolockd"

The first line makes all locks local and not forwarded to the server, see mount_nfs. The second and third lines are useful if you will connect to the board using uart as loader will not draw the menu or use colors.

Booting the board

Plug the board and quickly stop u-boot from autobooting by pressing any key beside 'Enter'

U-Boots from the FreeBSD ports collection are using distroboot. It will run the command line contain in the bootcmd variable. This command line will test every boot target that the board offers (mmc, nand, dhcp etc ...) and will run the associated command line for it (bootcmd_<target>). The easiest way to make sure that your board will always boot from the network is :

=> env set boot_targets dhcp
=> saveenv

For Beaglebone/Beaglebone Black they seems to have hardcoded setting again this variable in bootcmd for some reason ... so we need to modify it too.

=> env set bootcmd 'if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run distro_bootcmd'
=> saveenv

Now if you type 'boot' or power cycle the board, it will do a dhcp request, load the dtb and loader.efi from the tftpserver and loader will load the kernel and modules from the nfs server and boot it.

arm/netboot (last edited 2021-01-15T16:51:28+0000 by EmmanuelVadot)