Skip to content

Commit 3f017e3

Browse files
iavclaude
andcommitted
fix(templates): make nfs-boot.cmd.template architecture-agnostic
The previous template was hardcoded for sunxi arm32 — `zImage`/`bootz`, `console=tty1 console=ttyS0,115200`, `disp.screen0_output_mode=...`, `ext4load/fatload mmc 0`. It did not work on arm64 boards (e.g. rockchip64/helios64) and baked in a 115200 baud that breaks non-standard UART speeds (helios64 runs at 1500000). Rewrites the U-Boot hush script to: - Prefer `Image` + `booti` (arm64), fall back to `zImage` + `bootz` (arm32). - Load via `${devtype} ${devnum}:${distro_bootpart}` from U-Boot's distro bootflow scanner instead of hardcoded `mmc 0`. - Drop the `console=` overrides — let the kernel resolve the console from DTB `/chosen/stdout-path`, keeping `earlycon` for early output. - Drop sunxi-specific `disp.screen0_output_mode` and legacy `.next`/ `script.bin` probe paths. For the full TFTP+NFS netboot flow see the new `netboot` extension; this template remains the hybrid path where the kernel + DTB live on a local boot partition and only the rootfs is NFS-mounted. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6cb5d74 commit 3f017e3

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

config/templates/nfs-boot.cmd.template

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,33 @@
77
setenv net_setup "ip=dhcp"
88

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

13-
# you may need to add extra kernel arguments specific to your device
14-
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"
13+
# No hardcoded `console=`: kernels resolve the console from the DTB's
14+
# /chosen/stdout-path. Hardcoding a baud rate here breaks boards whose
15+
# UART runs at non-115200 speeds (e.g. helios64 @ 1500000).
16+
setenv bootargs "root=/dev/nfs ${net_setup} rw rootwait earlycon panic=10 loglevel=6"
1517

16-
if test -n ${nfs_root}; then
18+
if test -n "${nfs_root}"; then
1719
setenv bootargs "${bootargs} nfsroot=${nfs_root}"
1820
fi
1921

20-
if ext4load mmc 0 0x00000000 .next || fatload mmc 0 0x00000000 .next; then
21-
ext4load mmc 0 ${fdt_addr_r} /dtb/${fdtfile} || fatload mmc 0 ${fdt_addr_r} /dtb/${fdtfile}
22-
ext4load mmc 0 ${kernel_addr_r} zImage || fatload mmc 0 ${kernel_addr_r} zImage
23-
ext4load mmc 0 ${ramdisk_addr_r} uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
22+
# Load kernel + DTB + initrd from the active distro boot partition.
23+
# devtype/devnum/distro_bootpart are set by U-Boot's bootflow scanner
24+
# before this script runs.
25+
setenv boot_dev "${devtype} ${devnum}:${distro_bootpart}"
26+
27+
load ${boot_dev} ${fdt_addr_r} dtb/${fdtfile}
28+
load ${boot_dev} ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
29+
30+
# Prefer arm64 flat Image (booti); fall back to compressed zImage (bootz).
31+
if load ${boot_dev} ${kernel_addr_r} Image; then
32+
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
33+
else
34+
load ${boot_dev} ${kernel_addr_r} zImage
2435
setenv fdt_high ffffffff
2536
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
26-
else
27-
ext4load mmc 0 ${fdt_addr_r} script.bin || fatload mmc 0 ${fdt_addr_r} script.bin
28-
ext4load mmc 0 ${kernel_addr_r} zImage || fatload mmc 0 ${kernel_addr_r} zImage
29-
ext4load mmc 0 ${ramdisk_addr_r} uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
30-
bootz ${kernel_addr_r} ${ramdisk_addr_r}
3137
fi
3238

3339
# Recompile with:

0 commit comments

Comments
 (0)