# NomadBSD 15.1 Patch v3: Stock Kernel + fusefs-unionfs + build.cfg Cleanup

Supersedes v1 and v2. Self-contained: built against PRISTINE master, so it
carries your build.cfg edits (RELEASE 15.1, BASESIZE 2960, BUILD_KERNEL NO)
and the full pkg.list delta (adds filesystems/unionfs, removes
sysutils/bsdstats) - no pre-edited files required.

## Applying

Because v3 is diffed against pristine master, first revert anything v1
or v2 changed AND the two files you edited by hand (v3 re-creates those
edits itself):

    git checkout -- build build.cfg pkg.list config/etc/rc.d/mount_uzip
    git apply --stat nomadbsd-stock-kernel-fusefs-v3.patch   # preview
    git apply nomadbsd-stock-kernel-fusefs-v3.patch
    git add -A && git commit -m "FreeBSD 15.1: stock kernel, base fusefs, packaged fusefs-unionfs"

Verified to apply cleanly to pristine master and on top of the HiDPI
patch (no shared files).

## Contents (4 files, +62/-33)

**build** and **config/etc/rc.d/mount_uzip** — unchanged from v1:
- `build_modules` (fusefs2) and `build_unionfs` (the fork) dropped from
  BUILD_STAGES; `build_kernel()` guards on BUILD_KERNEL so
  `./build resume` can't rebuild the custom kernel behind your back.
- mount_uzip loads base `fusefs.ko` and runs the packaged fuse3
  unionfs from inside the uzip
  (`/unionfs/usr/local/bin/unionfs`, `LD_LIBRARY_PATH=/unionfs/usr/local/lib`),
  with fuse2-only options `nonempty`/`use_ino` removed and the option
  string exposed as the rc.conf tunable `mount_uzip_unionfs_opts`.

**pkg.list** — now included in the patch: adds `filesystems/unionfs`
(the fuse3-based fusefs-unionfs 3.7 package) and removes
`sysutils/bsdstats`, matching the file you're building with. The
`bsdstats_enable="NO"` line in config/etc/rc.conf is untouched — it's
harmless with the package absent.

**build.cfg** — carries your three edits (RELEASE=15.1-RELEASE,
BASESIZE=2960, BUILD_KERNEL="NO") plus the requested corrections. Every kernel
option was verified against the actual releng/15.1 sources
(sys/conf/options, sys/conf/options.amd64, sys/amd64/conf/GENERIC)
rather than assumptions:

1. **All existing COMMON_KERNELOPTS names are still valid in 15.1** —
   including COMPAT_FREEBSD4–9, which remain enabled in 15.1 GENERIC,
   so those nooptions still do real work. Nothing had to be deleted.
   The block is now annotated to distinguish lines that actively
   subtract from release GENERIC (COMPAT_FREEBSD4–9, KDB, KDB_TRACE,
   DDB_CTF) from lines that are no-ops on releng but protect a future
   -CURRENT build (INVARIANTS, WITNESS, etc.).
2. **Added `nooptions NETGDB`** — the one genuine 15.1 addition. GENERIC
   sets NETGDB alongside KDB; since the config removes the rest of the
   debugger stack, removing its network transport too is consistent.
3. **`WITHOUT_KMODS=""`** — every module in the old list (drm, drm2,
   i915kms, mach64, mga, r128, radeonkms, savage, sis, tdfx, via) is
   gone from 15.1's sys/modules. One trap documented in the comment:
   `sis` now matches the sis(4) *SiS 900 ethernet* module, so
   re-adding the old list to a future custom-kernel build would
   silently drop a NIC driver.
4. **i386 removed**: ARCH comment, the `KERNELOPTS` i386 branch, the
   empty `I386_KERNELOPTS()`, and `PKG_EXCLUDE_i386()`. Safe: the build
   script invokes `PKG_EXCLUDE_${ARCH}` dynamically with stderr
   suppressed, so a missing function is already the normal amd64/mac
   path. (The build script's own i386 code paths are left alone — they
   are inert for ARCH=amd64 and removing them is upstream's call.)
5. **BASESIZE: your 2960 is a good number — kept.** Reasoning now in
   the comment: the pruned custom kernel's /boot/kernel was ~150 MiB;
   stock GENERIC with all modules is ~450 MiB, and 15.1's world grew
   too, putting the real footprint around 2.4–2.6 GiB. 2960 gives
   ~400 MiB headroom above that. You could shave to ~2700, but the
   cost of undersizing is a failed build at the very end
   (test_rootfs_minfree bails below 50 MiB free) versus ~250 MiB of
   image size — not worth optimizing until everything boots.

## Notes

- The kernel-options work only matters when you flip BUILD_KERNEL back
  to YES someday; with "NO" the whole block is inert. It's now correct
  and documented for that day.
- Watch item unchanged from v1: `NVIDIA_DRIVERS="340 390 470 latest"` —
  the 340/390 legacy ports are candidates for removal from the ports
  tree; if `build_nvidia_drivers` bails on a missing port directory,
  trim that list.
- First-boot verification list from v1 still applies (uzip mount,
  /usr/local populated, SDDM up, cow write test, `sudo -v`).
