Building Makronix Makronix builds itself from its own sources. The installation medium can carry those sources, so a machine can be rebuilt without a network; a development machine does the same with more room and more patience. This chapter is the map: the source layout, the one entry point, and what each target produces. The source tree src/ Makronix's NetBSD tree: the kernel, the userland, the build system and the installer. It is edited directly; there is no patch layer between it and the system. Upstream NetBSD is in refs/netbsd/src, for reading. xsrc/ The X tree, imported the same way. X is part of the base system: the server, the drivers, the fonts and the clients are built into the X sets. pkgsrc/ The pkgsrc checkout, pinned. It is not edited; a change is a moved pin or a package in ext/ or the local wip. ext/ The third-party trees Makronix ships and changes: MCDE, its Motif build, afpfs-ng and glibc. Each has its own recipe and its own IMPORT note. tools/ Makronix's own POSIX shell tools: the build stamp, the package list reader, the set generator, the test harnesses and the MCDE helpers. docs/ and www/ The contracts and the guide, and the web site. The guide's source is docs/guide/book.xml. One entry point Everything is built from the top-level Makefile. The interface is deliberately small: $ make # the distribution (no medium) $ make release ARCH=amd64 # through to a finished release $ make iso # the installation CD/DVD image $ make usb # the bootable USB image $ make userland # the pkgsrc packages and the makronix set $ make sourcesets # the source sets for the medium $ make test # the tool tests, then the installation tests $ make install # install over a running Makronix make release builds the sets and the kernels; make iso packages what the release built; it refuses to run if a source changed since, because the medium would not match its sets. make usb needs the source sets under source/sets; make sourcesets writes them. ARCH is the name a person types: amd64, i386, macppc, evbarm. On a NetBSD host without ARCH, the host decides; on a cross host it is amd64 unless named. JOBS sets the parallelism. Cross and native are one build The build detects whether the host is NetBSD or not. A NetBSD host builds natively with its own toolchain; a Linux or another host cross-builds the same tree with the toolchain that build.sh builds first. A package that builds only on one of the two is a defect in the recipe, not a reason to use a virtual machine. The pkgsrc packages are built for the target with the same toolchain; tools/pkgsrc-cross.mk.conf is the whole configuration, and pkgsrc/ itself is not patched. The workarounds in that file are measured; explains them and when they can go. Where the results land The build writes to build/obj: the object tree, destdir.arch and the release directory releasedir. The logs are in build/logs. A medium is in releasedir/images; the sets are in releasedir/arch/binary/sets. The gate is checkflist, run the way NetBSD runs it: the set lists and what the build actually installed must agree. Extra or missing files fail the build. A build is done when checkflist reports neither. Building on the installed system The source set installs the whole tree to /usr/src — the NetBSD sources under /usr/src/src, X under /usr/src/xsrc, pkgsrc under /usr/src/pkgsrc. Build from /usr/src as a user in the wsrc group: $ cd /usr/src $ export MAKRONIX_TOP=/usr/src $ make release ARCH=amd64 A full self-build needs room for the object tree and the distfiles and takes hours on a laptop; the first build is the slow one. The source set is not the development history: it carries the files a rebuild needs, and PINS names the revisions they came from. Tests make test runs the tests of the tools first, then the installation tests: a machine is installed from the medium in QEMU and must reach a login prompt and shut down cleanly. The MCDE tests run before the release tests, from a native build of the host. A test that has never failed has not been tested; the harnesses are in tools/ and each can be run alone.