Files
makronix/docs/BUILD-VM.md
T
lotherk bfb8f1a32e source set: one tree, usr/src, the whole repository
The source medium carried six sets: NetBSD's src, gnusrc, syssrc and
sharesrc at /usr/src, xsrc at /usr/xsrc and msrc at /usr/msrc.  Makronix is
one tree, so there is one set now: src.tgz, unpacked to /usr/src, with the
repository as it is -- src/, xsrc/, ext/, pkgsrc/, mobile/, www/, docs/,
tools/, the root files, PINS, packages.list, distfiles.lst and distfiles/
(only the archives of the Makronix packages).

- makesrctars -m packs the staged tree as usr/src and skips the split sets.
  It keeps the modes and the links of the repository (pkgsrc and tools run
  their scripts directly); build.sh gets the directory as MAKROSRCDIR.
- tools/srctree-stage.sh replaces tools/msrc-stage.sh.  It copies git's file
  list of the root repository and of pkgsrc (tracked files plus the untracked
  Makronix recipes: AGENTS.md, wm/mcde, x11/mcde-motif,
  filesystems/afpfs-ng), stages the distfiles, and puts the pkgsrc patch
  names that ustar cannot store into pkgsrc-longnames.cpio.
- makesrctars removes source sets of the old layout from
  RELEASEDIR/source/sets before it writes, so no stale gnusrc/msrc/xsrc can
  travel on a medium.

Measured: tools/srctree-stage.sh -> 462655 entries, 11 GB, 214 names in
pkgsrc-longnames.cpio; make sourcesets verified distfiles.lst (2010 archives,
0 missing, 0 wrong hash) and wrote RELEASEDIR/source/sets/src.tgz
(build/logs/sourcesets-2026-11-15.log).

The installer side is not in this commit: it is being changed in the same
tree by the sysinst profile work (tasksd t0260) -- one SET_SRC, the long-name
extraction from /usr/src/pkgsrc, the messages and sysinst.8.
docs/OFFLINE-BUILD.md, docs/BUILD-VM.md, docs/LICENSES.md and GOAL.md
describe the one tree.
2026-11-15 21:45:20 +00:00

7.7 KiB

The build VM

A kept installation of Makronix, with the source sets on it, in which Makronix is built: the playground, and the place for the offline proof (docs/OFFLINE-BUILD.md).

Made

From the DVD with the source sets (make isosrc), in the simple mode, by

MX_VMOPTS="-s 64G -m 10G -c 8" MX_HOST=makronix-dev \
    tools/install-simple.sh -S -d build/vm/makronix-dev.qcow2

Log build/logs/install-devvm-2026-11-07.log: all checks PASS (users, groups, dtlogin running, /usr/src, /usr/xsrc, /usr/msrc with 71 distfiles). Disk: 64 GB qcow2, sparse; 8.2 GB used after the install, 42 GB free on /. 8 CPUs, 10 GB RAM. sshd=YES and the key build/vm/id_vm.pub for tester were added by hand over the serial console afterwards (the simple mode does not turn sshd on).

Used

tools/devvm.sh start      boot it, wait for sshd (127.0.0.1:2222)
tools/devvm.sh ssh [cmd]  as tester (wheel, operator, ...)
tools/devvm.sh scp ...
tools/devvm.sh stop       shutdown(8), wait for qemu to exit

Always stop, never vmsh.sh stop or killing qemu. The install test ends with vmsh.sh stop, which kills qemu; the disk it leaves is dirty. The first boot of this VM needed fsck_ffs by hand (duplicate blocks, a few inodes cleared); mtree against /etc/mtree/set.* then found nothing wrong but the files the installation itself changes (/etc/master.passwd, /etc/motd) and rescue/[, whose digest in set.rescue does not match the binary the build ships (the same on the host: a stale digest in the set, not damage). After that, a stop and start cycle booted without any fsck correction.

The passwords of root and tester are the test password of tools/install-simple.sh; change them before the VM is used for anything else.

Measured about it (2026-11-07)

  • cc is GCC 14.4.0 (nb4 20260926), make works, /usr/src/build.sh is there.
  • git is not in the guest: the .git directories of /usr/src and the others are on disk but cannot be used there. pkgsrc has devel/git; whether it builds offline is part of the offline proof.
  • sysctl hw.physmem prints -1 at 10 GB (32-bit sysctl); hw.physmem64 is the one to read.

Not yet

  • A start without a network (the offline proof): vmsh.sh has no switch for -nic none yet.
  • The first build in the VM (build.sh release from /usr/src).

Binary first

Where the NetBSD project publishes a binary package for the platform and Makronix does not patch the package, the binary is taken, not built (decided 2026-11-07). The work goes where nothing is published or where we change something: packages built from packages.list by tools/userland.sh (cross or native, depending on the build host; see Root-AGENTS.md and tools/AGENTS.md), and packages the NetBSD project does not publish. The VM is for testing/install proof, not for building (Root-AGENTS.md, 2026-11-13).

  • tools/pkg-binaries.sh [-a amd64|aarch64] list|fetch -- resolves the packages named in packages.list (the lines of kind fetch) over the project's pkg_summary.gz, with their run-time dependencies, and fetches them to build/packages/ARCH/All, a directory pkg_add can install from (PKG_PATH).
  • Source of the binaries: cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/<arch>/11.0_2026Q3/All, the quarterly branch built for NetBSD 11.0. Makronix is NetBSD 11.99.9; the binaries of the release branch are what is published for it. Whether they run on it is measured when they are installed, not before.
  • Measured 2026-11-07 (tools/pkg-binaries.sh list): amd64: firefox 154.0.1nb1, thunderbird 154.0nb1, qemu 11.1.1nb1 with 112 packages in all, 501 MB of archives (qemu alone is 117 MB, 871 MB installed); aarch64: qemu and firefox, 109 packages, 630 MB; thunderbird has no aarch64 binary in that branch (reported, skipped).
  • There is one list, tracked: packages.list (kinds set, repo and fetch; a line can be limited to one platform with @ARCH; read by tools/pkglist.sh).
  • Not done yet: the binary directory is not put on a medium; the sizes say the DVD, not CD 2. The binaries are not covered by the offline rebuild (no sources of them in the source set): Makronix rebuilds itself, not Firefox. The version of the branch (2026Q3) is not the version of the pinned pkgsrc tree (git-base is 2.55.0 there and 2.56.0 in the VM's build); mixing the two in one /usr/pkg is possible only where their dependency versions agree.

Two VM sessions

tools/vmsh.sh keeps one machine in one session directory. The install tests (install-simple.sh, install-cgd.sh) use build/vmsession and start with vmsh.sh stop, which kills qemu; the build VM must not share it. tools/devvm.sh therefore uses build/vmsession-dev (VMDIR). Found on 2026-11-07, before the first test run that would have killed the VM during its first NetBSD build; the VM that was started before the change still lives in build/vmsession and moves when it is restarted.

Known small defect

tools/makronix-distfiles.sh fetch reports "0 archives taken from ${MAKRONIX_TOP}/distfiles": the shared DISTDIR is read from tools/pkgsrc-cross.mk.conf unexpanded, so nothing is linked from it and everything is fetched again. Correct, only slower.

Sharing the host tree with the VM (measured 2026-11-07)

The host's ~/src/makronix can be mounted in the VM, so both work on the same files. Two ways were measured, in the VM (8 CPUs, KVM, QEMU user-mode network, tooldir and object files on the local disk, sources from the share):

local 9p (mount_9p -Ccu) NFS (mount_nfs -3 -T)
find over sys/ (35,803 files), 1st / 2nd run 0.83 s 20.6 s / 9.3 s 22.3 s / 3.3 s
tar of sys/dev (88 MB), 1st / 2nd run 1.25 s 8.3 s / 4.1 s 7.3 s / 3.4 s
kernel build GENERIC (build.sh kernel=GENERIC, 3425 compiles) 267 s, 322 s not finished 837 s
  • The two local runs differ by 20 %: that is the noise of this measurement.
  • NFS builds the kernel 2.6 to 3.1 times slower than the local disk. The cold first read is the cost (every file once through QEMU's user-mode network); warm reads are fast.
  • 9p: the kernel build did not finish in the measurement (it was cut off after about 20 minutes, 245 of 3425 compiles, load 1.5 to 2.7 with -j 8: the build waited on the share); puffs in user space is the reason. Treat it as "at least 4 times slower", not as a measured factor.

What follows for the work: edit through the share, build from a local copy. tools/ and docs/ are small and read warm; src/ and pkgsrc/ are built from the VM's own disk (/usr/src, the whole tree).

How it is set up

  • 9p: tools/devvm.sh start exports ~/src/makronix (vmsh.sh start -h DIR); in the guest mount_9p -Ccu /dev/vio9p0 /host (the -u is needed, QEMU speaks 9P2000.u; run it with its output redirected, it stays in the background).
  • NFS: the host needs a server: sudo tools/host-nfs-setup.sh install (see the header of the script; remove undoes it). In the guest mount_nfs -3 -T 10.0.2.2:/home/lotherk/src/makronix /host. Facts from the first runs: the export needs insecure (QEMU's user-mode network connects from a port above 1024; with the default secure, mount_nfs says "Permission denied"); nfsd and mountd listen on all addresses and host= in /etc/nfs.conf.d did not change that, so a nftables table makronix_nfs drops 2049 and the pinned mountd port 20048 on every interface but lo; rpcbind is not touched (the host's CDE desktop depends on it; the first version of the script restarted it, which was a mistake). insecure means any process on the host can mount the tree from 127.0.0.1 and then acts as user 1000 in it.