Files
reterminal-dm4/emmc-provisioning/network-boot-initramfs/init
nearxos a6e27219f4 Enhance network boot troubleshooting documentation and scripts
Update NETWORK-BOOT-TROUBLESHOOTING.md to clarify the boot process after start4.elf, emphasizing the importance of config.txt settings for kernel and initramfs. Introduce checks for GPU logging and ensure proper configuration for UART. Modify initramfs scripts to improve DHCP lease acquisition and ensure shell output is directed to the serial console. Update ensure-tftpboot-config-kernel-initrd.sh to enforce necessary config settings and link DTB files in serial-prefix directories for better device compatibility.
2026-02-21 02:27:48 +02:00

47 lines
1.5 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 (run in background with timeout so we don't block rescue shell)
if ! ip addr show | grep -q 'inet .* scope global'; then
echo "Getting DHCP lease..."
( udhcpc -f -q -i eth0 -n -T 5 2>/dev/null || true ) &
sleep 6
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."
# Ensure shell I/O goes to serial console (some setups drop output otherwise)
[ -c /dev/console ] && exec </dev/console >/dev/console 2>&1
exec /bin/sh -i
fi
echo "Provisioning server: $PROVISIONING_SERVER"
echo "Running provisioning client..."
exec /bin/sh /provisioning-client.sh