Skip to content

Commit 109cec0

Browse files
iavclaude
andcommitted
feat(core): add ROOTFS_TYPE=nfs-root for full network boot
New rootfs type for full network boot: the only thing on the device's local storage is U-Boot itself. Kernel, DTB, optional uInitrd and PXE config come from TFTP; rootfs is mounted over NFS. A new case branch in do_main_configuration auto-enables the netboot extension, symmetric with existing fs-f2fs-support / fs-btrfs wiring. The legacy ROOTFS_TYPE=nfs (hybrid: kernel on local storage, only / over NFS) is untouched — both paths coexist. - nfs-root case branch in ROOTFS_TYPE dispatch calls enable_extension "netboot" - prepare_partitions skips root partition creation and SD-size sanity check - check_filesystem_compatibility_on_host skipped for nfs-root - create_image_from_sdcard_rootfs early-returns for nfs-root after the pre_umount hook has grabbed TFTP artifacts from /boot: SDCARD.raw is dropped, the .img pipeline (mv to DESTIMG, write-to-SD, fingerprint, compress) is skipped. For nfs-root the only deliverables are the rootfs archive / ROOTFS_EXPORT_DIR tree and the TFTP staging dir — producing a boot-partition .img would be misleading (nothing on the device reads it). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aef1c59 commit 109cec0

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

lib/functions/configuration/main-config.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ function do_main_configuration() {
138138
nfs)
139139
FIXED_IMAGE_SIZE=256 # small SD card with kernel, boot script and .dtb/.bin files
140140
;;
141+
nfs-root)
142+
# Full netboot: no local storage in the early boot path at all. Kernel,
143+
# DTB and extlinux go to TFTP, rootfs is mounted over NFS. The netboot
144+
# extension owns artifact staging and PXE config generation.
145+
FIXED_IMAGE_SIZE=256
146+
enable_extension "netboot"
147+
;;
141148
f2fs)
142149
enable_extension "fs-f2fs-support"
143150
# Fixed image size is in 1M dd blocks (MiB)
@@ -161,9 +168,9 @@ function do_main_configuration() {
161168
esac
162169

163170
# Check if the filesystem type is supported by the build host.
164-
# Skipped for nfs: ROOTFS_TYPE=nfs produces a rootfs tarball;
165-
# host-side filesystem support is irrelevant for the nfs case.
166-
if [[ $CONFIG_DEFS_ONLY != yes && $ROOTFS_TYPE != nfs ]]; then
171+
# Skipped for nfs/nfs-root: those produce a rootfs tarball and/or export tree;
172+
# host-side filesystem support is irrelevant.
173+
if [[ $CONFIG_DEFS_ONLY != yes && $ROOTFS_TYPE != nfs && $ROOTFS_TYPE != nfs-root ]]; then
167174
check_filesystem_compatibility_on_host
168175
fi
169176

lib/functions/image/partitioning.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function prepare_partitions() {
2020

2121
# possible partition combinations
2222
# /boot: none, ext4, ext2, fat (BOOTFS_TYPE)
23-
# root: ext4, btrfs, f2fs, nilfs2, nfs (ROOTFS_TYPE)
23+
# root: ext4, btrfs, f2fs, nilfs2, nfs, nfs-root (ROOTFS_TYPE)
2424

2525
# declare makes local variables by default if used inside a function
2626
# NOTE: mountopts string should always start with comma if not empty
@@ -121,7 +121,7 @@ function prepare_partitions() {
121121
BOOTSIZE=0
122122
fi
123123
# Check if we need root partition
124-
[[ $ROOTFS_TYPE != nfs ]] &&
124+
[[ $ROOTFS_TYPE != nfs && $ROOTFS_TYPE != nfs-root ]] &&
125125
local rootpart=$((next++))
126126

127127
display_alert "calculated rootpart" "rootpart: ${rootpart}" "debug"
@@ -144,7 +144,7 @@ function prepare_partitions() {
144144
display_alert "Using user-defined image size" "$FIXED_IMAGE_SIZE MiB" "info"
145145
sdsize=$FIXED_IMAGE_SIZE
146146
# basic sanity check
147-
if [[ $ROOTFS_TYPE != nfs && $ROOTFS_TYPE != btrfs && $sdsize -lt $rootfs_size ]]; then
147+
if [[ $ROOTFS_TYPE != nfs && $ROOTFS_TYPE != nfs-root && $ROOTFS_TYPE != btrfs && $sdsize -lt $rootfs_size ]]; then
148148
exit_with_error "User defined image size is too small" "$sdsize <= $rootfs_size"
149149
fi
150150
else

lib/functions/image/rootfs-to-image.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ function create_image_from_sdcard_rootfs() {
173173
rm -rf --one-file-system "${MOUNT}"
174174
# unset MOUNT # don't unset, it's readonly now
175175

176+
# nfs-root: no local storage image. Kernel/DTB/initrd are already staged for TFTP
177+
# by the netboot extension (pre_umount_final_image hook), and rootfs lives in the
178+
# archive or ROOTFS_EXPORT_DIR tree — both written directly to ${DEST}/images.
179+
# Drop SDCARD.raw and skip the .img pipeline (write-to-SD, fingerprint, compress).
180+
if [[ "${ROOTFS_TYPE}" == "nfs-root" ]]; then
181+
display_alert "nfs-root" "no local storage image produced" "info"
182+
rm -f "${SDCARD}.raw"
183+
return 0
184+
fi
185+
176186
mkdir -p "${DESTIMG}"
177187
# @TODO: misterious cwd, who sets it?
178188

0 commit comments

Comments
 (0)