Update boot order configuration for eMMC first, then network

Modify the first-boot script and documentation to set the EEPROM boot order to 0xf21, prioritizing eMMC boot followed by network boot. Adjust network boot settings for faster failure on DHCP timeouts and update related scripts and documentation to reflect these changes. Enhance the rescue script to directly modify EEPROM settings without requiring a chroot into eMMC, streamlining the recovery process for devices stuck in network-only boot. Update relevant documentation to ensure clarity on the new boot order and its implications.
This commit is contained in:
nearxos
2026-02-21 15:05:17 +02:00
parent ff6258c2af
commit 5238d457e8
13 changed files with 348 additions and 247 deletions

View File

@@ -1,11 +1,12 @@
#!/usr/bin/env bash
# Check if network boot is set as first priority on a Pi 4 / CM4 (reTerminal).
# Check if boot order is set as expected on a Pi 4 / CM4 (reTerminal).
# Run on the device: ./check-network-boot-priority.sh
# Or from your machine: ssh pi@<device-ip> 'bash -s' < scripts/check-network-boot-priority.sh
set -e
# BOOT_ORDER: 0x2 = network, 0x1 = SD/eMMC. 0x21 = network first, then local storage.
WANT_BOOT_ORDER="0x21"
# BOOT_ORDER nibbles (right-to-left): 1=SD/eMMC, 2=network, f=restart.
# 0xf21 = eMMC first, then network, then restart.
WANT_BOOT_ORDER="0xf21"
get_config() {
if command -v vcgencmd >/dev/null 2>&1; then
@@ -29,12 +30,12 @@ if [[ -z "$BOOT_ORDER" ]]; then
fi
echo "BOOT_ORDER=$BOOT_ORDER (current)"
echo "Expected for network first: $WANT_BOOT_ORDER (0x2=network, 0x1=SD/eMMC; 0x21 = network then local)"
echo "Expected: $WANT_BOOT_ORDER (1=eMMC, 2=network, f=restart; eMMC first, then network)"
if [[ "$(echo "$BOOT_ORDER" | tr '[:upper:]' '[:lower:]')" == "$(echo "$WANT_BOOT_ORDER" | tr '[:upper:]' '[:lower:]')" ]]; then
echo "Result: Network boot is set as first priority."
echo "Result: Boot order matches expected (eMMC first, then network)."
exit 0
fi
echo "Result: Network boot is NOT first (current: $BOOT_ORDER). To set network first, set BOOT_ORDER=0x21 (e.g. via cloud-init first-boot or rpi-eeprom-config --edit)."
echo "Result: Boot order does NOT match (current: $BOOT_ORDER, expected: $WANT_BOOT_ORDER). Set via rpi-eeprom-config --edit or cloud-init first-boot."
exit 2

View File

@@ -35,12 +35,11 @@ fi
# 2) dnsmasq config for eth1 only (DHCP + TFTP); PXE options in network-boot-pxe.conf (toggle with toggle-network-boot-dhcp.sh)
mkdir -p /etc/dnsmasq.d
cat > /etc/dnsmasq.d/network-boot.conf << 'DNSMASQ'
# DHCP + TFTP on eth1 only (provisioning LAN)
# DHCP on eth1 only (provisioning LAN)
# TFTP and PXE options are in network-boot-pxe.conf, controlled by toggle-network-boot-dhcp.sh
interface=eth1
bind-interfaces
dhcp-range=10.20.50.100,10.20.50.200,12h
enable-tftp
tftp-root=/srv/tftpboot
log-dhcp
log-queries
port=0