NFSv3/NFSv4 Root Filesystem Exports, Firmware Staging & Network Boot Studio

Mounting / over NFS shrinks driver edit-compile-test turnarounds to three seconds, yet Ubuntu 22.04/24.04 drops legacy NFSv2/v3 root mounts unless /etc/nfs.conf enables vers3, and a single stray space in /etc/exports exposes root-privileged shares to the entire LAN.

20 minfree previewLinux 6.12C11glibc 2.39→ module 3 lab
What you'll learn
  • Author whitespace-safe /etc/exports entries with no_root_squash and enable NFSv3 TCP support in /etc/nfs.conf on modern Ubuntu/Debian hosts.
  • Construct exact U-Boot Linux kernel bootargs (root=/dev/nfs, nfsroot=<srv>:<path>,vers=3,tcp, and static ip= tuple) matching host exports.
  • Compare TFTP+NFS network boot, SSH/rsync delta sync, and raw flash image deployment, and complete the Module 3 network boot studio.

Three-Second Driver Turnaround—and Why Modern Ubuntu Rejects Default nfsroot

Re-partitioning or reflashing an SD card every time you tweak one line in a character driver wastes ten minutes per iteration. With TFTP + NFS network boot, U-Boot pulls zImage and .dtb over TFTP in one second, and the Linux kernel (CONFIG_IP_PNP=y, CONFIG_ROOT_NFS=y) mounts /srv/nfs/rootfs from your workstation directly as /! The instant make modules finishes on your host and copies led_drv.ko into /srv/nfs/rootfs/lib/modules/..., you type modprobe led_drv on the board's UART console—zero SD swaps, zero scp copies!

Two notorious bugs trip up engineers on Ubuntu 22.04 and 24.04 LTS. First, kernel Documentation/admin-guide/nfs/nfsroot.rst historically defaulted nfsroot= to NFSv2 over UDP, whereas modern nfs-kernel-server disables NFSv2 completely and often requires explicit [nfsd] vers3=y + tcp=y in /etc/nfs.conf paired with ,vers=3,tcp inside bootargs! Second, writing /srv/nfs/rootfs 192.168.10.0/24 (rw,no_root_squash) with one space before ( tells exportfs to export read-only (ro,root_squash) to 192.168.10.0/24 and rw,no_root_squash to the entire world (*)!

fig_m03_l03_a.svg — Both sides of the wire must agree on protocol version…

Figure 3.3a. Both sides of the wire must agree on protocol version (vers=3,tcp), subnet CIDR without spaces, and UID 0 preservation ().

mental model: Mounting / over NFS is like running a restaurant kitchen (ARMv7-A board) whose walk-in pantry door opens directly into the central commissary (host /srv/nfs/rootfs): whenever the commissary places a fresh spice jar (driver.ko) on the shelf, the chef grabs it immediately without waiting for a delivery van (SD card). root_squash is a cautious commissary guard who strips the Head Chef (UID 0) of master keys and treats them as an untrusted visitor (UID 65534), while a space before ( in /etc/exports hangs the *'Master Keys Granted'* sign on the public street door instead of the kitchen door!

Where it stops working: no_root_squash grants any machine on the allowed subnet genuine UID 0 write access inside /srv/nfs/rootfs—never export / or /home with no_root_squash, and always restrict /srv/nfs/rootfs strictly to the isolated wired bench CIDR (192.168.10.0/24)!

definition (Kernel IP Autoconfiguration (ip= 7-Tuple) and NFS Root Squashing): Because user-space tools (ip, NetworkManager, dhclient) live inside the root filesystem that has not been mounted yet, the Linux kernel brings up eth0 in Ring 0 using the ip= bootargs 7-tuple: ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> (for example ip=192.168.10.50:192.168.10.10::255.255.255.0:board:eth0:off, leaving <gw-ip> empty on an isolated bench!). Once TCP/IP is live, fs/nfs/nfsroot.c contacts the host NFS server; no_root_squash disables default UID 0 -> 65534 (nobody) credential remapping inside /srv/nfs/rootfs.

ast_m03_l03.svg — Enable [nfsd] vers3=y, write cidr(rw,no_root_squash),…step 1/4
  1. Step 1. Extract your target rootfs archive into /srv/nfs/rootfs using sudo tar --numeric-owner so UID 0 ownership is intact on disk.
  2. Step 2. Enable vers3=y under [nfsd] in /etc/nfs.conf, restart nfs-kernel-server, and verify +3 appears in /proc/fs/nfsd/versions.
  3. Step 3. Add the tight CIDR(options) entry to /etc/exports, reload via exportfs -rav, and confirm zero '*' wildcard leaks in exportfs -v.
  4. Step 4. Pass explicit vers=3,tcp and static eth0 ip= parameters in U-Boot bootargs, boot via TFTP, and verify live host-to-target file sync.

Figure 3.3b. Enable [nfsd] vers3=y, write cidr(rw,no_root_squash), and pin nfsroot=...,vers=3,tcp.

Inside /etc/exports Parsing, bootargs Tokenization & Deployment Trade-Offs

Why do embedded kernels prefer NFSv3 over NFSv4 for root=/dev/nfs? NFSv4 introduced pseudo-root path stripping (fsid=0) and string-based user@domain idmapd mapping, which frequently mismatches minimal BusyBox systems lacking rpc.idmapd during early boot; NFSv3 over TCP (vers=3,tcp) uses raw numeric 32-bit UID/GID integers on the wire and mounts exact absolute export paths (/srv/nfs/rootfs) reliably in fs/nfs/nfsroot.c.

Choosing the right transport across the engineering lifecycle is equally straightforward: use TFTP + NFSv3 during daily Linux kernel, Device Tree, and .ko driver bring-up (zero flash wear, 3 s turnaround); use rsync -avz or scp over SSH when iterating on user-space C/C++ applications on a board already booted from eMMC; and use offline SD images or USB UUU Fastboot to validate standalone cold-boot timing before shipping.

fig_m03_l03_b.svg — Cross-checking /etc/exports against U-Boot bootargs…

Figure 3.3b. Cross-checking /etc/exports against U-Boot bootargs catches path mismatches, missing vers=3,tcp, and subnet typos before power-on.

Deployment WorkflowTurnaround TimeFlash WearBest Engineering Stage
U-Boot TFTP + Kernel NFSv3 /~3 s (make -> reboot / insmod)Zero (100% DDR3 + host disk)Active Linux kernel, Device Tree & .ko driver bring-up
rsync -avz / scp over SSH (OpenSSH)< 1 s (delta user-space binary)Minimal (target ext4 only)Application, daemon, or Qt UI iteration on booted eMMC
Raw dd / sfdisk MicroSD Card~2–4 min (sync, umount, swap)Moderate (removable card)Bootloader (SPL/U-Boot) & cold-boot partition validation
USB OTG SDP + UUU -> eMMC / NAND~1–3 min (full image burn)One full Factory/CI cycleBoard bring-up without SD slot & production provisioning
learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat -H 3 -H 7 nfs_bench_setup.conf File: nfs_bench_setup.conf    # 1. /etc/nfs.conf (Ubuntu 22.04 / 24.04 LTS: re-enable NFSv3 for embedded U-Boot/kernel)    [nfsd]  vers3=y    tcp=y        # 2. /etc/exports (ZERO space between 192.168.10.0/24 and '('!)  /srv/nfs/rootfs 192.168.10.0/24(rw,sync,no_root_squash,no_subtree_check)        # 3. Matching U-Boot environment script    setenv bootargs 'console=ttymxc0,115200 root=/dev/nfs nfsroot=192.168.10.10:/srv/nfs/rootfs,vers=3,tcp rw ip=192.168.10.50:192.168.10.10::255.255.255.0:imx6ull:eth0:off'
  1. Explicitly enables NFSv3 over TCP on Ubuntu 22.04+/24.04 so fs/nfs/nfsroot.c mounts cleanly.
  2. Adjacent '192.168.10.0/24(' scopes no_root_squash strictly to the isolated bench subnet.
exports(5) at a glance — GL-E00
exports(5)                  GL-E00 Quick Reference                  exports(5) NAME       exports, exportfs, nfs.conf - NFS server export table and kernel       nfsroot bootargs SYNOPSIS       sudo exportfs -rav # Reload /etc/exports and print active options cat       /proc/fs/nfsd/versions # Confirm +3 is active in rpc.nfsd showmount -e       192.168.10.10 # Query rpc.mountd export list        EXPORTS & BOOTARGS CONTRACT /srv/nfs/rootfs       192.168.10.0/24(rw,sync,no_root_squash,no_subtree_check) root=/dev/nfs       nfsroot=192.168.10.10:/srv/nfs/rootfs,vers=3,tcp rw       ip=192.168.10.50:192.168.10.10::255.255.255.0:board:eth0:off Kernel Systems Academy                  Lesson 3.3                  exports(5) GL-E00 quick reference · full manual page: man 5 exports 

Cross-Checking /etc/exports Against Kernel nfsroot= bootargs in C11

Before rebooting a board only to watch VFS: Unable to mount root fs via NFS scroll across UART, we can cross-validate /etc/exports and U-Boot bootargs deterministically in ISO C11. In verify.c, audit_nfs_contract() parses an /etc/exports line—catching the classic whitespace-before-( wildcard bug (-2) and missing no_root_squash (-4)—then parses bootargs to confirm root=/dev/nfs, exact export directory match, ,vers=3,tcp pinning, and CIDR subnet membership.

Notice how bitwise subnet verification ((srv_ip & mask) == (net_ip & mask)) converts dotted-quad IPv4 strings into 32-bit host-order integers and applies 0xFFFFFFFFU << (32 - plen). If you change your bench NIC from 192.168.10.10/24 to 10.77.0.10/24 and forget to update /etc/exports, audit_nfs_contract() rejects the mismatch (-11) before rpc.mountd denies the target mount request.

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat -H 20 -H 50 verify.c File: verify.c    #define _POSIX_C_SOURCE 200809L    #include <stdint.h>    #include <stdio.h>    #include <stdlib.h>    #include <string.h>        static int parse_ipv4(const char *s, uint32_t *out) {        unsigned int a, b, c, d;        char tail;        if (sscanf(s, "%u.%u.%u.%u%c", &a, &b, &c, &d, &tail) != 4) return -1;        if (a > 255U || b > 255U || c > 255U || d > 255U) return -1;        *out = (a << 24) | (b << 16) | (c << 8) | d;        return 0;    }        static int audit_nfs_contract(const char *exports_ln, const char *bootargs) {        char exp_path[128] = {0}, spec[160] = {0}, extra[32] = {0};        int n = sscanf(exports_ln, "%127s %159s %31s", exp_path, spec, extra);        if (n < 2) return -1;      if (n >= 3 && extra[0] == '(') return -2; /* Fatal space between CIDR and '('! */            char *lp = strchr(spec, '(');        char *rp = lp ? strchr(lp + 1, ')') : NULL;        if (!lp || !rp || lp == spec) return -3;            char cidr[64] = {0}, opts[128] = {0};        memcpy(cidr, spec, (size_t)(lp - spec));        memcpy(opts, lp + 1, (size_t)(rp - lp - 1));        if (!strstr(opts, "rw") || !strstr(opts, "no_root_squash")) return -4;            char *slash = strchr(cidr, '/');        if (!slash) return -5;        *slash = '\0';        int plen = atoi(slash + 1);        uint32_t net_ip = 0;        if (plen < 8 || plen > 30 || parse_ipv4(cidr, &net_ip) != 0) return -5;        uint32_t mask = 0xFFFFFFFFU << (32 - plen);            if (!strstr(bootargs, "root=/dev/nfs")) return -6;        const char *nr = strstr(bootargs, "nfsroot=");        if (!nr) return -7;        nr += 8;        const char *end = strchr(nr, ' ');        char nr_tok[192] = {0};        size_t nr_len = end ? (size_t)(end - nr) : strlen(nr);        if (nr_len >= sizeof(nr_tok)) return -7;        memcpy(nr_tok, nr, nr_len);            if (!strstr(nr_tok, ",vers=3") || !strstr(nr_tok, ",tcp")) return -8;      char *colon = strchr(nr_tok, ':');        char *comma = colon ? strchr(colon + 1, ',') : NULL;        if (!colon || !comma) return -9;        *colon = '\0';        *comma = '\0';            uint32_t srv_ip = 0;        if (parse_ipv4(nr_tok, &srv_ip) != 0) return -10;        if ((srv_ip & mask) != (net_ip & mask)) return -11;        if (strcmp(colon + 1, exp_path) != 0) return -12;        return 0;    }        int main(void) {        const char *exp_ok = "/srv/nfs/rootfs 192.168.10.0/24(rw,sync,no_root_squash,no_subtree_check)";        const char *exp_sp = "/srv/nfs/rootfs 192.168.10.0/24 (rw,sync,no_root_squash)";        const char *ba_ok =            "console=ttymxc0,115200 root=/dev/nfs "            "nfsroot=192.168.10.10:/srv/nfs/rootfs,vers=3,tcp rw "            "ip=192.168.10.50:192.168.10.10::255.255.255.0::eth0:off";        const char *ba_nov3 =            "console=ttymxc0,115200 root=/dev/nfs "            "nfsroot=192.168.10.10:/srv/nfs/rootfs rw";            int r_ok = audit_nfs_contract(exp_ok, ba_ok);        int r_space = audit_nfs_contract(exp_sp, ba_ok);        int r_nov3 = audit_nfs_contract(exp_ok, ba_nov3);            printf("nfs_audit: valid=%d exports_space_bug=%d missing_vers3_tcp=%d\n",               r_ok, r_space, r_nov3);        return (r_ok == 0 && r_space == -2 && r_nov3 == -8) ? 0 : 1;    }
  1. Detects whitespace between CIDR and '(' via extra[0] == '(', catching the world-writable '*' export hazard.
  2. Requires explicit ',vers=3' and ',tcp' on nfsroot= so Ubuntu 22.04/24.04 rpc.nfsd accepts the root mount.

Confirming /etc/exports Whitespace & vers=3,tcp Rejections

Inspect the execution output: the matched /etc/exports + vers=3,tcp bootargs contract returns valid=0, inserting a single space before ( immediately triggers exports_space_bug=-2, and omitting ,vers=3,tcp triggers missing_vers3_tcp=-8.

While this host C11 verifier proves lexical and subnet consistency across host and U-Boot configuration files, live bring-up still requires confirming cat /proc/fs/nfsd/versions includes +3 on the workstation and verifying physical 100BASE-TX link carrier on the target Ethernet PHY.

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03gcc -std=c11 -Wall -Wextra -Werror verify.c -o verifylearner@ksa:~/gl-e00/m03-l03./verifynfs_audit: valid=0 exports_space_bug=-2 missing_vers3_tcp=-8learner@ksa:~/gl-e00/m03-l03
strace — learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03strace -e trace=write,exit_group ./verifywrite(1, "nfs_audit: valid=0 exports_space"..., 61) = 61exit_group(0)                           = ?+++ exited with 0 +++

Host NetworkManager Conflicts & Target connman/systemd-networkd Drops

You now control the complete host-to-target network boot pipeline—from signed APT/sysroot isolation through dual-NIC FIB routing and RFC 1350 TFTP to NFSv3 / mounting. Put all three pieces together in the graded lab_m03_tftp_nfs_bootargs studio below.

Board Mounts NFS Root Successfully, Then Hangs Mid-Boot Starting NetworkManager!:

  • Symptom: Kernel prints VFS: Mounted root (nfs filesystem) on device 0:15, /sbin/init starts services, and two seconds later the console freezes with nfs: server 192.168.10.10 not responding, still trying!
  • Root Cause: A user-space network daemon inside the target rootfs (connman, NetworkManager, or ifupdown DHCP on eth0) flushed eth0's IP address to run DHCP, severing the live TCP connection backing / itself!
  • Fix: When booting root=/dev/nfs, configure target user-space network managers to ignore eth0 (ConnMan -I eth0 or CriticalConnection=true / KeepConfiguration=yes in systemd-networkd).

Host Firewall Allows Port 2049 Yet NFSv3 Mount Still Hangs:

  • Symptom: You opened TCP/2049 (nfs) in ufw, yet U-Boot TFTP succeeds and kernel NFSv3 root mount times out.
  • Root Cause: Unlike NFSv4 (single port 2049), NFSv3 first queries rpcbind (portmapper on TCP/UDP 111) to discover rpc.mountd's port (MOUNTv3 handshake) before opening TCP/2049!
  • Fix: Allow all traffic from the dedicated wired bench interface (sudo ufw allow in on enx_bench from 192.168.10.0/24) or pin a static rpc.mountd port in /etc/nfs.conf ([mountd] port=20048) alongside 111 and 2049.

Guided Practice

Extend audit_nfs_contract() in verify.c to parse the ip= 7-tuple (ip=<client>:<srv>:<gw>:<mask>:...) from bootargs and verify that <srv> in ip= equals <srv> in nfsroot= and that <client> lies inside the same /24 subnet without colliding with <srv>!

Independent Practice

Open labs/lab_m03_tftp_nfs_bootargs/ and fix all three bugs in starter/core.c so sh check.sh passes 5/5 TAP version 13 assertions and ./files/lab_cli --bench records CLOCK_MONOTONIC percentiles.

Verification Checks

quiz · 1 of 3

What does /srv/nfs/rootfs 192.168.10.0/24 (rw,sync,no_root_squash) (notice the space before () actually configure in /etc/exports?

quiz · 2 of 3

An i.MX6ULL board boots Linux kernel 6.12 via TFTP, prints VFS: Mounted root (nfs filesystem), starts systemd, and immediately hangs printing nfs: server 192.168.10.10 not responding. What happened?

quiz · 3 of 3

Why does booting an embedded target with nfsroot=192.168.10.10:/srv/nfs/rootfs (without ,vers=3,tcp) commonly fail against an out-of-the-box Ubuntu 24.04 LTS host?

Dual-NIC FIB Router, RFC 1350 TFTP Framing & NFSv3 Bootargs Verifier

env: host

1. Motivation

A broken network-boot bench silently wastes hours of board bring-up: one stray gateway4 on the USB-Ethernet dongle kills internet access, off-by-one 512-byte TFTP framing truncates exact-multiple Device Trees, and missing ,vers=3,tcp or no_root_squash panics the Linux kernel on root mount. This studio builds a preflight C11 verifier catching all three before power-on.

2. Learning objectives

  • Audit multi-homed FIB tables to forbid 0.0.0.0/0 gateways on isolated bench NICs while confirming /24 on-link reachability.
  • Validate RFC 1350 DATA/ACK lockstep sequences including the N / 512 + 1 zero-byte EOF packet invariant.
  • Cross-validate /etc/exports (rw, no_root_squash, no space before () against Linux kernel nfsroot=...,vers=3,tcp bootargs.

3. Environment requirements

All automated verification steps run in unprivileged user space on a POSIX Linux host using gcc -std=c11 -Wall -Wextra -Werror and clock_gettime(CLOCK_MONOTONIC). Recorded transcripts in captures.json were generated on x86_64 running kernel 7.0.0-42-generic and prove protocol, state-machine, and memory invariants only. Physical bus timing, DMA cache coherency, and board peripheral behavior require target validation on Linux kernel 6.12 LTS (ARMv7-A Cortex-A7).

4. Required software and hardware

  • Host workstation: gcc (-std=c11 -Wall -Wextra -Werror), GNU make, ar (binutils), and POSIX /bin/sh.
  • Target environment (optional hardware step, Section 13): i.MX6ULL ARMv7-A board wired via 100BASE-TX Ethernet (ENET1/ENET2) to a host static 192.168.10.10/24 USB-Ethernet adapter running tftpd-hpa and nfs-kernel-server (vers3=y).

5. Complete executable commands

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat script.sh File: script.sh    make -B -C files    ./files/lab_cli    ./files/lab_cli --bench    sh check.sh

6. Annotated source code

files/core.c enforces the production invariants that starter/core.c breaks:

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat example.c File: example.c    size_t expected_blocks = (image_bytes / 512U) + 1U;    if (frame_count != expected_blocks * 2U) return -2;    ...    size_t exp_len = (b < expected_blocks) ? 512U : (image_bytes % 512U);

starter/core.c introduces three authentic network-boot bugs: (1) ksa_validate_dual_nic_fib() ignores default routes attached to is_bench_nic; (2) ksa_verify_tftp_session() computes (image_bytes + 511U) / 512U (ceil), failing whenever image_bytes is an exact multiple of 512 bytes (1,024 B needs 3 blocks, not 2!); and (3) ksa_validate_nfs_boot() omits verifying ,vers=3 and ,tcp on nfsroot=.

7. Expected output

Passing files/ run (sh check.sh, exit code 0):

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat listing.txt File: listing.txt    TAP version 13    1..5    ok 1 - builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werror    ok 2 - archives core.o into libcore.a and links independent TAP verifier    ok 3 - rejects competing default gateway on bench NIC while preserving WAN 0.0.0.0/0 and /24 link    ok 4 - verifies RFC 1350 TFTP DATA/ACK lockstep including trailing 0-byte EOF on exact 512B multiples    ok 5 - cross-checks /etc/exports whitespace and no_root_squash against kernel nfsroot=...,vers=3,tcp    # pass 5/5

CLI verification output (./files/lab_cli):

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat listing.txt File: listing.txt    dual_nic_fib: rc=0    tftp_1024B_3blk_eof: rc=0    nfs_exports_bootargs: rc=0

Defective starter/ run (exit code 1): emits FAIL: diagnostics on the broken contract assertions.

8. Explanation of observed behavior

Restoring all three invariants makes libcore.a pass all 5 TAP version 13 checks cleanly: dual_gw routing tables are rejected before blackholing WAN traffic, 1,024-byte TFTP transfers require the trailing 0-byte block 3 EOF packet, and /etc/exports + bootargs agree on path, subnet CIDR, no_root_squash, and vers=3,tcp.

9. Experiment variations

  • Near transfer: Extend ksa_validate_nfs_boot() to parse the ip=<client>:<srv>:<gw>:<mask>:... parameter and reject non-empty <gw> values when <client> and <srv> sit on an isolated /24 bench.
  • Far transfer: Write a live Linux workstation preflight script that feeds ip -4 route show, /etc/default/tftpd-hpa, /proc/fs/nfsd/versions, and /etc/exports into lab_cli before launching picocom.

10. Performance measurements

Recorded host benchmark (./files/lab_cli --bench, CLOCK_MONOTONIC, warmup=5, N=40 batches):

learner@ksa: ~/gl-e00/m03-l03
learner@ksa:~/gl-e00/m03-l03$ bat listing.txt File: listing.txt    BENCH lab_m03_tftp_nfs_bootargs clock=CLOCK_MONOTONIC warmup=5 samples=40 p50_ns=752 p95_ns=801 p99_ns=807 sink=0

CLOCK_MONOTONIC host benchmark numbers measure in-memory C11 validation speed (~nanoseconds), not 100BASE-TX wire propagation, UDP socket round-trip time, or host SSD /srv/nfs/rootfs read latency.

11. Troubleshooting

SymptomRoot causeFix
not ok 3 - rejects competing default gateway...routes[i].is_bench_nic check on prefix_len == 0 is disabled, allowing wan_defaults or bench default route.Return -2 immediately if routes[i].prefix_len == 0 && routes[i].is_bench_nic.
not ok 4 - verifies RFC 1350 TFTP DATA/ACK lockstep...Used ceiling division (image_bytes + 511U) / 512U, yielding 2 blocks instead of 3 for 1,024 B.Use (image_bytes / 512U) + 1U so exact 512 B multiples include the mandatory 0-byte EOF block.
not ok 5 - cross-checks /etc/exports whitespace...Missing check for ,vers=3 and ,tcp inside nfsroot= token.Return -9 if `!strstr(nr_tok, ",vers=3")!strstr(nr_tok, ",tcp")`.

12. Guided questions

  1. Why does (image_bytes + 511U) / 512U agree with (image_bytes / 512U) + 1U on 700 bytes (2 blocks) yet disagree on 0 bytes (0 vs 1) and 1,024 bytes (2 vs 3)?
  • *Hint 1:* How does an RFC 1350 receiver know that the sender has no further blocks after receiving a full 512-byte DATA packet?
  • *Hint 2:* A 512-byte DATA packet ALWAYS means 'at least one more packet follows', so every remainder r = image_bytes % 512 (including r = 0) ends with a final block of length r < 512, giving floor(N / 512) + 1 blocks for every N >= 0!
  1. In ksa_validate_nfs_boot(), how does sscanf(exports_line, "%127s %159s %31s", exp_dir, spec, extra) detect /srv/nfs/rootfs 192.168.10.0/24 (rw,...)?
  • *Hint 1:* What gets stored into spec and extra when a space separates 192.168.10.0/24 from (rw,...)?
  • *Hint 2:* When a space precedes (, spec receives "192.168.10.0/24" (with no '(') and extra receives "(rw,...)", so n >= 3 && extra[0] == '(' catches the wildcard leak immediately!

13. Independent challenges

Add RFC 2348 blksize option-negotiation support (OACK opcode 6, e.g., blksize=1468) to ksa_verify_tftp_session_ext() and benchmark 512 B vs 1468 B block counts for an 8 MiB zImage.

14. Solutions and explanations

The reference files/core.c forbids prefix_len == 0 on is_bench_nic interfaces, computes (image_bytes / 512U) + 1U blocks for RFC 1350 TFTP EOF framing, and enforces tight cidr(rw,...,no_root_squash) + ,vers=3,tcp consistency across /etc/exports and bootargs.

Run locally in your terminal and check off each verification milestone.

Not started

Key takeaways

  • Exporting a target root filesystem in /etc/exports requires path cidr(rw,sync,,no_subtree_check) with ZERO whitespace between the CIDR subnet and '(' so options bind to that subnet rather than '*'.
  • Without no_root_squash, the host NFS server maps target UID 0 requests to nobody (65534), causing /sbin/init, systemd, and device/module operations on the board to fail with EACCES.
  • On Ubuntu 22.04+ and 24.04 LTS hosts, /etc/nfs.conf must enable [nfsd] vers3=y and tcp=y to match Linux kernel bootargs root=/dev/nfs nfsroot=192.168.10.10:/srv/nfs/rootfs,vers=3,tcp rw ip=...
  • Embedded workflows use TFTP + NFS root during rapid kernel/driver iteration, rsync/scp over SSH for incremental user-space updates on booted targets, and UUU/SD partition images for standalone release.
Progress is saved on this device.
up next · module 3 labLab: Dual-NIC FIB Router, RFC 1350 TFTP Framing & NFSv3 Bootargs Verifier (60 min)
→ module 3 lab

search — fzf

0/0 ───────────────────────────────────────────

keyboard shortcuts — less

/
search
f
focus mode
[
previous
]
next
?
help
Esc
close

figure