Enhance the NETWORK-BOOT-LXC.md documentation with detailed steps for testing network boot functionality, including prerequisites, expected outcomes, and quick testing methods. Introduce a new section on monitoring network boot status on the LXC, outlining commands to check DHCP leases, dnsmasq status, and registered devices. Update the initramfs scripts to support a rescue mode for devices stuck in network-only boot, allowing users to change boot order settings. Include a new rescue script for eMMC management in the build process.
45 lines
1.3 KiB
Bash
45 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# Init for provisioning initramfs: bring up minimal env and run provisioning-client.sh.
|
|
# PROVISIONING_SERVER can be set via kernel cmdline: provisioning_server=http://10.20.50.1:5000
|
|
|
|
set -e
|
|
export PATH=/bin:/usr/bin
|
|
export LD_LIBRARY_PATH=/lib
|
|
|
|
echo "=== CM4 provisioning initramfs ==="
|
|
|
|
# Minimal filesystem
|
|
mount -t proc none /proc
|
|
mount -t sysfs none /sys
|
|
mount -t devtmpfs none /dev
|
|
mkdir -p /dev/pts
|
|
mount -t devpts none /dev/pts
|
|
|
|
# Kernel might have brought up eth0 via ip=dhcp; ensure we have an IP
|
|
if ! ip addr show | grep -q 'inet .* scope global'; then
|
|
echo "Getting DHCP lease..."
|
|
udhcpc -f -q -i eth0 -n 2>/dev/null || true
|
|
fi
|
|
|
|
# Allow kernel cmdline to override: provisioning_server=... and rescue mode
|
|
RESCUE=0
|
|
for arg in $(cat /proc/cmdline); do
|
|
case "$arg" in
|
|
provisioning_server=*) export PROVISIONING_SERVER="${arg#*=}"; ;;
|
|
provisioning_rescue=1) RESCUE=1; ;;
|
|
esac
|
|
done
|
|
PROVISIONING_SERVER="${PROVISIONING_SERVER:-http://10.20.50.1:5000}"
|
|
export PROVISIONING_SERVER
|
|
|
|
if [ "$RESCUE" -eq 1 ]; then
|
|
echo "=== RESCUE MODE (provisioning_rescue=1) ==="
|
|
echo "Run /rescue-eeprom.sh to mount eMMC and change boot order (rpi-eeprom-config), then reboot."
|
|
echo "Or run /bin/sh for a shell."
|
|
exec /bin/sh -i
|
|
fi
|
|
|
|
echo "Provisioning server: $PROVISIONING_SERVER"
|
|
echo "Running provisioning client..."
|
|
exec /bin/sh /provisioning-client.sh
|