Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b74e166
feat(core): add artifact_ready extension hook for post-build artifacts
iav May 6, 2026
3fa8cf0
fix(templates): make nfs-boot.cmd.template architecture-agnostic
iav Apr 11, 2026
03c9bcc
feat(rootfs-to-image): rootfs export tree + configurable compression
iav Apr 12, 2026
a779cf8
feat(extensions/netboot): netboot extension for TFTP+NFS diskless boot
iav Apr 12, 2026
82f8d05
feat(core): add ROOTFS_TYPE=nfs-root for full network boot
iav Apr 12, 2026
56f0a74
docs(netboot): add full netboot setup guide
iav Apr 12, 2026
bb888b6
fix(rootfs): preserve xattrs/ACLs/sparse + scope archive hook to nfs
iav Apr 29, 2026
6a70e9f
feat(extensions/netboot): netboot-deploy.sh reference deploy hook
iav Apr 24, 2026
10bf004
docs(extensions/netboot): troubleshooting for NFS over TCP / DHCP siaddr
iav May 1, 2026
2298c9b
feat(extensions/netboot): switch to siaddr-based NFS mount with stall…
iav May 1, 2026
fa41495
fix(host-utils): use chown -h to tolerate dangling symlinks in reset_…
iav May 4, 2026
cc9e95b
feat(extensions/netboot): tag tftp/nfs subdir with -min/-desktop suffix
iav May 4, 2026
5432c29
fix(extensions/netboot): require effective root for NFS-side updates
iav May 7, 2026
46eb1b9
fix(extensions/netboot): prune removed DTBs in kernel-only deploy
iav May 7, 2026
d3dc56d
fix(rootfs): preserve sparse extents on rootfs cache extract
iav May 7, 2026
b2ad595
feat(extensions/netboot): clarify kernel-only deploy contract — initr…
iav May 7, 2026
7e11b7b
fix(extensions/netboot): always clean up remote rootfs archive on tar…
iav May 8, 2026
a00afc3
docs(extensions/netboot): document GNU tar requirement on the deploy …
iav May 8, 2026
03fecbe
fix(extensions/netboot): only fire kernel-only deploy on standalone k…
iav May 8, 2026
39a1c92
docs(extensions/netboot): unify normalize/normalise spelling
iav May 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 58 additions & 14 deletions config/templates/nfs-boot.cmd.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,71 @@
setenv net_setup "ip=dhcp"

# for static configuration see documentation
# https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/nfs/nfsroot.rst
# https://www.kernel.org/doc/Documentation/admin-guide/nfs/nfsroot.rst
# setenv net_setup "ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>"

# you may need to add extra kernel arguments specific to your device
setenv bootargs "console=tty1 console=ttyS0,115200 root=/dev/nfs ${net_setup} rw rootflags=noatime disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=6"
# No hardcoded `console=`: kernels resolve the console from the DTB's
# /chosen/stdout-path. Hardcoding a baud rate here breaks boards whose
# UART runs at non-115200 speeds (e.g. helios64 @ 1500000).
setenv bootargs "root=/dev/nfs ${net_setup} rw rootwait earlycon panic=10 loglevel=6"

if test -n ${nfs_root}; then
if test -n "${nfs_root}"; then
setenv bootargs "${bootargs} nfsroot=${nfs_root}"
fi

if ext4load mmc 0 0x00000000 .next || fatload mmc 0 0x00000000 .next; then
ext4load mmc 0 ${fdt_addr_r} /dtb/${fdtfile} || fatload mmc 0 ${fdt_addr_r} /dtb/${fdtfile}
ext4load mmc 0 ${kernel_addr_r} zImage || fatload mmc 0 ${kernel_addr_r} zImage
ext4load mmc 0 ${ramdisk_addr_r} uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
setenv fdt_high ffffffff
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
# Load kernel + DTB + initrd from the active distro boot partition.
# devtype/devnum/distro_bootpart are set by U-Boot's bootflow scanner
# before this script runs. Boards that source boot.scr directly (legacy
# sunxi without distro_bootcmd, etc.) have these unset — fall back to
# the historical "mmc 0:1" so the existing ROOTFS_TYPE=nfs path keeps
# working there.
test -n "${devtype}" || setenv devtype mmc
test -n "${devnum}" || setenv devnum 0
test -n "${distro_bootpart}" || setenv distro_bootpart 1
setenv boot_dev "${devtype} ${devnum}:${distro_bootpart}"

# Probe mainline marker: mainline rootfs has /boot/.next, legacy sunxi (pre-DT)
# does not — it ships script.bin in place of a DTB.
if load ${boot_dev} ${fdt_addr_r} .next; then
# Mainline: real DTB, arm64 flat Image or compressed zImage.
# Some boards (TI K3, BeagleBone) keep fdtfile with a .dts suffix; the
# tree installs the compiled .dtb, so we need to normalize before loading.
setenv dtb_name "${fdtfile}"
# U-Boot setexpr.s sub takes `<regex> <substitute>` — the target is implicit
# (the named variable itself), which is both read and written in place.
setexpr.s dtb_name sub "\\.dts\$" ".dtb"
if load ${boot_dev} ${fdt_addr_r} dtb/${dtb_name}; then
true
else
echo "FATAL: failed to load DTB dtb/${dtb_name} (fdtfile=${fdtfile})"
reset
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
load ${boot_dev} ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
if load ${boot_dev} ${kernel_addr_r} Image; then
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
elif load ${boot_dev} ${kernel_addr_r} zImage; then
setenv fdt_high ffffffff
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
else
echo "FATAL: failed to load kernel (neither Image nor zImage)"
reset
fi
else
ext4load mmc 0 ${fdt_addr_r} script.bin || fatload mmc 0 ${fdt_addr_r} script.bin
ext4load mmc 0 ${kernel_addr_r} zImage || fatload mmc 0 ${kernel_addr_r} zImage
ext4load mmc 0 ${ramdisk_addr_r} uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
bootz ${kernel_addr_r} ${ramdisk_addr_r}
# Legacy sunxi (pre-mainline): script.bin substitutes for DTB, zImage only,
# bootz is called without the fdt argument.
if load ${boot_dev} ${fdt_addr_r} script.bin; then
true
else
echo "FATAL: no mainline (.next) and no legacy script.bin"
reset
fi
load ${boot_dev} ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
if load ${boot_dev} ${kernel_addr_r} zImage; then
bootz ${kernel_addr_r} ${ramdisk_addr_r}
else
echo "FATAL: failed to load zImage (legacy)"
reset
fi
fi

# Recompile with:
Expand Down
926 changes: 926 additions & 0 deletions extensions/netboot/README.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions extensions/netboot/files/dhcpcd-hooks/71-netboot-rootpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# Fix ROOTSERVER in /run/net-${interface}.conf for nfsroot=<path> (path-only) boots.
#
# The standard 70-net-conf hook sets ROOTSERVER='${new_routers}' (default
# gateway). The kernel's own IP-Config (ip=dhcp) correctly resolves the boot
# server from DHCP siaddr and records it as "bootserver" in /proc/net/pnp.
# Appending ROOTSERVER from there overrides the gateway value; shell-source
# semantics in /scripts/nfs pick the last assignment.
#
# Installed by the Armbian `netboot` extension.

if ${if_configured?} && ${if_up?} && [ "${protocol-}" = dhcp ] \
&& [ -f "/run/net-${interface?}.conf" ]; then

# Read boot server from kernel IP-Config — set from DHCP siaddr.
# /proc/net/pnp is only populated when the kernel handles DHCP itself
# (ip=dhcp in cmdline); if it is absent or has no valid bootserver entry
# we clear ROOTSERVER explicitly so nfs-mount fails fast rather than
# silently trying the default gateway written by 70-net-conf.
bootserver=$(grep '^bootserver ' /proc/net/pnp 2>/dev/null | cut -d' ' -f2)
if [ -n "$bootserver" ] && [ "$bootserver" != "0.0.0.0" ]; then
printf "ROOTSERVER='%s'\n" "$bootserver" >> "/run/net-${interface}.conf"
else
printf '71-netboot-rootpath: bootserver not found in /proc/net/pnp, clearing ROOTSERVER\n' >&2
printf "ROOTSERVER=''\n" >> "/run/net-${interface}.conf"
fi
fi
26 changes: 26 additions & 0 deletions extensions/netboot/files/initramfs-hooks/netboot-rootpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh
# Initramfs hook: include 71-netboot-rootpath in the dhcpcd hooks dir of the
# generated initramfs. That hook overrides ROOTSERVER in
# /run/net-${interface}.conf with the boot server from /proc/net/pnp so the
# initramfs nfs-mount script does not fall back to the default gateway.
# Companion of the Armbian `netboot` extension.

set -e

PREREQ=""
case "$1" in
prereqs) echo "$PREREQ"; exit 0 ;;
esac

. /usr/share/initramfs-tools/hook-functions

# Mirror the destination directory choice from the upstream `dhcpcd` hook
# (depends on whether dhcpcd ships its hooks in /usr/lib/dhcpcd or /usr/libexec).
if [ -e /usr/lib/dhcpcd/dhcpcd-run-hooks ]; then
dhcpcd_dir=/usr/lib/dhcpcd
else
dhcpcd_dir=/usr/libexec
fi

copy_file config /usr/share/initramfs-tools/dhcpcd-hooks/71-netboot-rootpath \
"${dhcpcd_dir}/dhcpcd-hooks/71-netboot-rootpath"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
PREREQ=""
prereqs() { echo "$PREREQ"; }
case $1 in
prereqs) prereqs; exit 0 ;;
esac

# Only arm on NFS root boots.
grep -q "root=/dev/nfs" /proc/cmdline || exit 0

# Trigger SysRq-B (immediate reboot, not a kernel panic — different kernel path,
# reboot via PSCI on arm64) after 10 min if NFS root mount hangs.
# nfs-bottom/zz-netboot-watchdog-cancel kills this on successful mount.
(
sleep 600
echo "netboot-watchdog: 10 min elapsed, forcing reboot" > /dev/kmsg 2>/dev/null
# Force-enable SysRq before triggering. If kernel.sysrq is 0 at runtime
# (hardened image, sysctl override, etc.), `echo b` writes succeed at the
# shell level but are no-ops in the kernel — the watchdog would log its
# message and then hang. Setting `1` enables the full command set.
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true
echo b > /proc/sysrq-trigger
Comment thread
coderabbitai[bot] marked this conversation as resolved.
) &
echo $! > /run/netboot-watchdog.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
PREREQ=""
prereqs() { echo "$PREREQ"; }
case $1 in
prereqs) prereqs; exit 0 ;;
esac

# Cancel the NFS watchdog started by init-premount/zz-netboot-watchdog.
# Validate the pidfile content before signalling: a stale or corrupted file
# (truncated, non-numeric, or PID 1 from kernel/init) must not produce an
# unintended kill. Only proceed for a numeric PID strictly greater than 1.
if [ -f /run/netboot-watchdog.pid ]; then
read -r watchdog_pid < /run/netboot-watchdog.pid 2>/dev/null || watchdog_pid=""
case "${watchdog_pid}" in
'' | *[!0-9]*) ;;
*)
[ "${watchdog_pid}" -gt 1 ] && kill "${watchdog_pid}" 2> /dev/null
;;
esac
rm -f /run/netboot-watchdog.pid
Comment thread
coderabbitai[bot] marked this conversation as resolved.
fi
Loading
Loading