SIGILLatum

Logo

Petr Tesarik's Linux blog

View the Project on GitHub ptesarik/SIGILLatum.github.io

11 June 2021

Raspberry Pi 4 Network Boot

by Petr Tesařík

The Raspberry Pi first loads the VPU firmware, then the ARM bootloader (or directly the operating system). Both stages can be booted over Ethernet using TFTP if the bootloader configuration option BOOT_ORDER includes a NETWORK mode (value 0x2). Consult the Raspberry Pi 4 bootloader documentation for more details.

Raspberry Pi Firmware

First, let us explain how the Raspberry Pi EEPROM bootloader works:

U-Boot

Second, let us look at U-Boot. Unattended installation will use the built-in configuration. The distro_bootcmd for openSUSE and SUSE follows this boot order:

  1. on-board microSD card reader,
  2. USB mass storage,
  3. network using U-Boot PXE,
  4. network using UEFI PXE.

The TFTP server address is always taken from the siaddr DHCP header field. The file name is handled differently for U-Boot PXE and UEFI.

The U-Boot PXE method looks for a configuration file inside a pxelinux.cfg directory, which must be in the same directory as the boot file (sent in the file DHCP header field). These names are tried for the PXE configuration file:

With UEFI, The boot file name is taken from the file header field, or from DHCP option 67 (Bootfile name), depending on DHCP option 52 (Option overload). This file should be the next-stage bootloader, i.e. GRUB.

To distinguish between the U-Boot PXE and UEFI requests on the DHCP server, check the value of DHCP option 93 (Client Architecture):

GRUB

GRUB uses the network routines of U-Boot (through its EFI implementation), so it does not ask the DHCP server again. It does load additional files from the TFTP server (most importantly grub.cfg), but that’s not specific to the Raspberry Pi. Read GRUB documentation for details.

tags: raspberry - rpi4 - boot - dhcp - tftp