Last active
May 30, 2020 17:30
-
-
Save sdwilsh/7bd8e09b886596caa1ddc0e1ba39dfa8 to your computer and use it in GitHub Desktop.
Configure Bootloader for Network Booting a Pi 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp /lib/firmware/raspberrypi/bootloader/stable/pieeprom-2020-04-16.bin pieeprom.bin | |
rpi-eeprom-config pieeprom.bin > bootconf.txt | |
# Enable pxe booting, and copy over additions. | |
sed -i -r -e 's/BOOT_ORDER.*?$/BOOT_ORDER=0x21/g' bootconf.txt | |
# Set prefix to be the mac address, like normal PXE things. | |
TFTP_IP=$(cat /etc/iscsi/iscsi.initramfs | grep 'ISCSI_TARGET_IP=' | cut -d '=' -f 2) | |
sed -i -r -e 's/TFTP_PREFIX.*?$/TFTP_PREFIX=2/g' bootconf.txt | |
# Set the TFTP IP address (no need to mess with DHCP settings). | |
sed -i -r -e "s/TFTP_IP.*?$/TFTP_IP=${TFTP_IP}/g" bootconf.txt | |
# Set this device's IP address. | |
PI_IP=$(ifconfig eth0 | awk '/inet /{ print $2;}') | |
PI_NETMASK=$(ifconfig eth0 | awk '/netmask/{ print $4;}') | |
sed -i -r -e "s/^\[none\]$/CLIENT_IP=${PI_IP}\nSUBNET=${PI_NETMASK}\n[none]/g" bootconf.txt | |
# Save the new configuration to the firmware, and install it (requires a reboot). | |
rpi-eeprom-config --out pieeprom-netboot.bin --config bootconf.txt pieeprom.bin | |
rpi-eeprom-update -d -f ./pieeprom-netboot.bin | |
shutdown -r now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment