Enhance network boot setup script and documentation: automate fetching of Raspberry Pi 4 boot files from GitHub, update TFTP root handling, and improve user instructions for setup. Remove manual steps for file retrieval and clarify echo messages in the setup script.
This commit is contained in:
@@ -14,7 +14,7 @@ if [[ -n "$TARGET" ]]; then
|
||||
rsync -a "$REPO_DIR/lxc/" "$TARGET:/tmp/cm4-network-boot-lxc/" --exclude='.git'
|
||||
scp "$SCRIPT_DIR/setup-network-boot-on-lxc.sh" "$TARGET:/tmp/cm4-network-boot-lxc/setup.sh"
|
||||
ssh "$TARGET" "bash /tmp/cm4-network-boot-lxc/setup.sh"
|
||||
echo "Done. Next: ensure /srv/tftpboot has RPi boot files (see docs/NETWORK-BOOT-LXC.md)."
|
||||
echo "Done."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -42,12 +42,26 @@ log-queries
|
||||
port=0
|
||||
DNSMASQ
|
||||
|
||||
# 3) TFTP root and minimal placeholder so TFTP serves something
|
||||
# 3) TFTP root: fetch Raspberry Pi 4 boot files from GitHub if missing
|
||||
mkdir -p /srv/tftpboot
|
||||
if [[ ! -f /srv/tftpboot/start4cd.elf ]]; then
|
||||
echo "TFTP root /srv/tftpboot is empty. You need Raspberry Pi 4 boot files (start4cd.elf, fixup4cd.dat, config.txt, cmdline.txt, kernel8.img)."
|
||||
echo "Download from: https://github.com/raspberrypi/firmware/ (branch master, boot/ folder) and copy into /srv/tftpboot"
|
||||
echo "Or from a Pi: scp -r pi@<pi>:/boot/firmware/* root@<lxc>:/srv/tftpboot/"
|
||||
echo "Fetching Raspberry Pi firmware boot files from GitHub ..."
|
||||
if ! command -v curl >/dev/null 2>&1 && ! command -v wget >/dev/null 2>&1; then
|
||||
apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq curl
|
||||
fi
|
||||
tmpdir=$(mktemp -d)
|
||||
trap "rm -rf $tmpdir" EXIT
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -sL "https://github.com/raspberrypi/firmware/archive/refs/heads/master.tar.gz" -o "$tmpdir/firmware.tar.gz"
|
||||
else
|
||||
wget -q -O "$tmpdir/firmware.tar.gz" "https://github.com/raspberrypi/firmware/archive/refs/heads/master.tar.gz"
|
||||
fi
|
||||
tar xzf "$tmpdir/firmware.tar.gz" -C "$tmpdir"
|
||||
cp -a "$tmpdir/firmware-master/boot/." /srv/tftpboot/
|
||||
rm -rf "$tmpdir"
|
||||
echo "Copied RPi boot files to /srv/tftpboot"
|
||||
else
|
||||
echo "TFTP root already has boot files (start4cd.elf present), skipping fetch."
|
||||
fi
|
||||
|
||||
# 4) IP forwarding (LAN clients use WAN)
|
||||
@@ -87,4 +101,4 @@ systemctl restart dnsmasq
|
||||
echo "Network boot setup done."
|
||||
echo " - DHCP + TFTP on eth1 (10.20.50.1), range 10.20.50.100-200"
|
||||
echo " - NAT: 10.20.50.0/24 -> eth0 (internet)"
|
||||
echo " - Put RPi 4 boot files in /srv/tftpboot (see above or docs/NETWORK-BOOT-LXC.md)"
|
||||
echo " - TFTP root: /srv/tftpboot (RPi boot files from GitHub)"
|
||||
|
||||
Reference in New Issue
Block a user