Install Raspbian on an SD card and install needed tools
Let’s start configuring your client system for netboot. This is the Raspberry Pi that will eventually boot without a micro SD card installed.
- Download PiOS Lite. For this tutorial I used the Bullseye release.
- Copy the Bullseye image onto an SD card. I suggest using the PiOS Imager. Warning! This will overwrite data on the device specified. Triple check you are writing to the SD card and not your laptop drive!
- Put the SD card in your client Raspberry Pi 4 and boot it. Using the lite version of raspbian give you a text console only. If you want a graphical console you can use the full version and it should work. I have not tested this workflow with the full version.
- Log in via the console using the login you created with the Imager.
- Connect your Raspberry Pi to the internet via an ethernet cable.
- Update PiOS via apt-get and install the rpi-config program:
sudo apt-get update
sudo apt-get full-upgrade
sudo apt-get install rpi-eeprom
Configure the Rasperry Pi 4 bootloader to PXE boot
Next lets examine your boot loader configuration using this command:
Here is the output on my fresh out of the box Raspberry Pi 4:
pi@raspberrypi:~ $ vcgencmd bootloader_config
We need to modify the boot loader config to boot off the network using the BOOT_ORDER parameter. To do that we must extract it from the EEPROM image. Once extracted, make our modifications to enable PXE boot. Finally install it back into the boot loader.
We do that with these steps:
- Go to the directory where the bootloader images are stored:
- Make a copy of the latest firmware image file. In my case it was
cp pieeprom-2023-05-11.bin new-pieeprom.bin
- Extract the config from the eeprom image
rpi-eeprom-config new-pieeprom.bin > bootconf.txt
- In bootconf.txt, change the BOOT_ORDER variable to
BOOT_ORDER=0xf241. In my case it had defaulted to
0X1means only boot from SD card.
0xf241means attempt SD card boot first, followed by USB Mass Storage Device, followed by network boot, and then repeat. See this Raspberry Pi Bootloader page for more details on the values and what they control.
- Now save the new bootconf.txt file to the firmware image we copied earlier:
rpi-eeprom-config --out netboot-pieeprom.bin --config bootconf.txt new-pieeprom.bin
- Now install the new boot loader:
sudo rpi-eeprom-update -d -f ./netboot-pieeprom.bin
- If you get an error with the above command, double check that your apt-get full-upgrade completed successfully.
cat /proc/cpuinfo to get the serial number of the Pi.