-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(extensions): add netboot extension for TFTP+NFS diskless boot #9656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iav
wants to merge
20
commits into
armbian:main
Choose a base branch
from
iav:enh/netboot-extension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 3fa8cf0
fix(templates): make nfs-boot.cmd.template architecture-agnostic
iav 03c9bcc
feat(rootfs-to-image): rootfs export tree + configurable compression
iav a779cf8
feat(extensions/netboot): netboot extension for TFTP+NFS diskless boot
iav 82f8d05
feat(core): add ROOTFS_TYPE=nfs-root for full network boot
iav 56f0a74
docs(netboot): add full netboot setup guide
iav bb888b6
fix(rootfs): preserve xattrs/ACLs/sparse + scope archive hook to nfs
iav 6a70e9f
feat(extensions/netboot): netboot-deploy.sh reference deploy hook
iav 10bf004
docs(extensions/netboot): troubleshooting for NFS over TCP / DHCP siaddr
iav 2298c9b
feat(extensions/netboot): switch to siaddr-based NFS mount with stall…
iav fa41495
fix(host-utils): use chown -h to tolerate dangling symlinks in reset_…
iav cc9e95b
feat(extensions/netboot): tag tftp/nfs subdir with -min/-desktop suffix
iav 5432c29
fix(extensions/netboot): require effective root for NFS-side updates
iav 46eb1b9
fix(extensions/netboot): prune removed DTBs in kernel-only deploy
iav d3dc56d
fix(rootfs): preserve sparse extents on rootfs cache extract
iav b2ad595
feat(extensions/netboot): clarify kernel-only deploy contract — initr…
iav 7e11b7b
fix(extensions/netboot): always clean up remote rootfs archive on tar…
iav a00afc3
docs(extensions/netboot): document GNU tar requirement on the deploy …
iav 03fecbe
fix(extensions/netboot): only fire kernel-only deploy on standalone k…
iav 39a1c92
docs(extensions/netboot): unify normalize/normalise spelling
iav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
24 changes: 24 additions & 0 deletions
24
extensions/netboot/files/initramfs-scripts/init-premount/zz-netboot-watchdog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| ) & | ||
| echo $! > /run/netboot-watchdog.pid | ||
21 changes: 21 additions & 0 deletions
21
extensions/netboot/files/initramfs-scripts/nfs-bottom/zz-netboot-watchdog-cancel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.