BUILD(7)
π οΈ BUILD(7) β general instructions on how to build the FreeBSD system
πΈ NAME πΈ
build β general instructions on how to build the FreeBSD system
β¨ DESCRIPTION β¨
okay bestie, gather round: the sources for the FreeBSD system and its applications live in three directories, normally:
/usr/srcβ the βbase systemβ, loosely defined as everything required to build the system to a useful state/usr/docβ system documentation, excluding manual pages/usr/portsβ third-party software, with a consistent interface for building and installing them; seeports(7)
These directories may be initially empty or non-existent until updated with Git (devel/git from the FreeBSD Ports Collection).
The make(1) command is used in each of these directories to build and install the things in that directory. Issuing the make(1) command in any directory issues the make(1) command recursively in all subdirectories. With no target specified, the items in the directories are built and no further action is taken.
A source tree is allowed to be read-only. As described in make(1), objects are usually built in a separate object directory hierarchy specified by the environment variable MAKEOBJDIRPREFIX, or under /usr/obj if variable MAKEOBJDIRPREFIX is not set. The canonical object directory is described in the documentation for the buildworld target below.
The build may be controlled by defining make(1) variables described in the βENVIRONMENTβ section below, and by the variables documented in make.conf(5).
The default components included in the build are specified in the file /etc/src.conf in the source tree. To override the default file, include the SRCCONF option in the make steps, pointing to a custom src.conf file. For more information see src.conf(5).
The following list provides the names and actions for the targets supported by the build system:
analyzeβ Run Clang static analyzer against all objects and present output on stdout.checkβ Run tests for a given subdirectory. The default directory used is${.OBJDIR}, but the check directory can be changed with${CHECKDIR}.checkworldβ Run the FreeBSD test suite on installed world.cleanβ Remove any files created during the build process.cleandependβ Remove the${.OBJDIR}/${DEPENDFILE}*files generated by priormakeandmake dependsteps.cleandirβ Remove the canonical object directory if it exists, or perform actions equivalent tomake clean cleandependif it does not. This target will also remove anobjlink in${.CURDIR}if that exists.
It is advisable to run make cleandir twice: the first invocation will remove the canonical object directory and the second one will clean up ${.CURDIR}.
dependβ Generate a list of build dependencies in file${.OBJDIR}/${DEPENDFILE}. Per-object dependencies are generated at build time and stored in${.OBJDIR}/${DEPENDFILE}.${OBJ}.installβ Install the results of the build to the appropriate location in the installation directory hierarchy specified in variableDESTDIR.objβ Create the canonical object directory associated with the current directory.objlinkβ Create a symbolic link to the canonical object directory in${.CURDIR}.tagsβ Generate a tags file using the program specified in themake(1)variableCTAGS. The build system supportsctags(1)and GNU Global.
The other supported targets under directory /usr/src are:
buildenvβ Spawn an interactive shell with environment variables set up for building the system or individual components. For cross-building the target architecture needs to be specified withmake(1)variablesTARGET_ARCHandTARGET.
This target is only useful after a complete toolchain (including the compiler, linker, assembler, headers and libraries) has been built; see the toolchain target below.
buildworldβ Build everything but the kernel, configure files inetc, andrelease. The object directory can be changed from the default/usr/objby setting theMAKEOBJDIRPREFIXmake(1)variable. The actual build location prefix used depends on theWITH_UNIFIED_OBJDIRoption fromsrc.conf(5). If enabled it is${MAKEOBJDIRPREFIX}${.CURDIR}/${TARGET}.${TARGET_ARCH}for all builds. If disabled it is${MAKEOBJDIRPREFIX}${.CURDIR}for native builds, and${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}${.CURDIR}for cross builds and native builds with variableCROSS_BUILD_TESTINGset.cleankernelβ Attempts to clean up targets built by a precedingbuildkernel, or similar step, built from the same source directory andKERNCONF.cleanworldβ Attempt to clean up targets built by a precedingbuildworld, or similar step, built from this source directory.cleanuniverseβ WhenWITH_UNIFIED_OBJDIRis enabled, attempt to clean up targets built by a precedingbuildworld,universe, or similar step, for any architecture built from this source directory.distributeworldβ Distribute everything compiled by a precedingbuildworldstep. Files are placed in the directory hierarchy specified bymake(1)variableDISTDIR. This target is used while building a release; seerelease(7).native-xtoolsβ This target builds a cross-toolchain for the givenTARGETandTARGET_ARCH, as well as a select list of static userland tools for the host system. This is intended to be used in a jail where QEMU is used to improve performance by avoiding emulating binaries that do not need to be emulated.TARGETandTARGET_ARCHshould be defined.native-xtools-installβ Installs the results to${DESTDIR}/${NXTP}whereNXTPdefaults tonxb-bin.TARGETandTARGET_ARCHmust be defined.packagesβ Create afreebsd-base(7)package repository containing packages that can be used to install or upgrade the base system. The repository is created in the object directory, under${REPODIR}/${PKG_ABI}whereREPODIRis the base directory where the repository will be created, andPKG_ABIis thepkg(7)ABI for the build target, for example,/usr/obj/${SRCDIR}/repo/FreeBSD:15:amd64.packageworldβ Archive the results ofdistributeworld, placing the results inDISTDIR. This target is used while building arelease(7)and is unrelated to buildingfreebsd-base(7)packages.installworldβ Install everything built by a precedingbuildworldstep into the directory hierarchy pointed to bymake(1)variableDESTDIR.
If installing onto an NFS file system and running make(1) with the -j option, make sure that rpc.lockd(8) is running on both client and server. See rc.conf(5) on how to make it start at boot time.
toolchainβ Create the build toolchain needed to build the rest of the system. For cross-architecture builds, this step creates a cross-toolchain.universeβ For each architecture, execute abuildworldfollowed by abuildkernelfor all kernels for that architecture, includingLINT. This command takes a long time. πkernelsβ LikeuniversewithWITHOUT_WORLDSdefined so only the kernels for each architecture are built.worldsβ LikeuniversewithWITHOUT_KERNELSdefined so only the worlds for each architecture are built.targetsβ Print a list of supportedTARGET/TARGET_ARCHpairs for world and kernel targets.tinderboxβ Execute the same targets asuniverse. In addition print a summary of all failed targets at the end and exit with an error if there were any.toolchainsβ Create a build toolchain for each architecture supported by the build system.xdevβ Builds and installs a cross-toolchain and sysroot for the givenTARGETandTARGET_ARCH. The sysroot contains target library and headers. The target is an alias forxdev-buildandxdev-install. The location of the files installed can be controlled withDESTDIR. The target location inDESTDIRis${DESTDIR}/${XDTP}whereXDTPdefaults to/usr/${XDDIR}andXDDIRdefaults to${TARGET_ARCH}-freebsd.update-packagesβ Create or update thefreebsd-base(7)package repository for the base system.- If an old repository is being updated, then packages whose contents have not changed since the previous version will be copied into the new repository to avoid needless updating of the version number.
- If
PKG_REPO_SIGNING_KEYis defined, the repo will be signed according topkg-repo(8).
xdev-buildβ Builds for thexdevtarget.xdev-installβ Installs the files for thexdevtarget.xdev-linksβ Installs autoconf-style symlinks to${DESTDIR}/usr/binpointing into the xdev toolchain in${DESTDIR}/${XDTP}.
Kernel specific build targets in /usr/src are:
buildkernelβ Rebuild the kernel and the kernel modules. The object directory can be changed from the default/usr/objby setting theMAKEOBJDIRPREFIXmake(1)variable.installkernelβ drops the kernel and its modules into${DESTDIR}/boot/kernel, and if there's already a directory there holding the kernel you're currently running, it gets renamed tokernel.old(no deleting your safety net, we love that π). Wanna change where it lands under${DESTDIR}? Use theINSTKERNNAMEorKODIRmake(1)variables.distributekernelβ installs the kernel into${DISTDIR}/kernel/boot/kernel. This one's a release-building thing, so peeprelease(7).packagekernelβ archives whateverdistributekernelproduced, and chucks the result intoDISTDIR. Also arelease(7)era target, and it's got nothing to do with buildingfreebsd-base(7)packages β don't mix them up bestie πkernelβ literally justbuildkernelfollowed byinstallkernel. Two for one, iconic.kernel-toolchainβ rebuilds all the tools you need to compile a kernel. Use this when you skippedbuildworldfirst. It's giving "I'll just do the kernel part" energy β¨reinstallkernelβ reinstalls the kernel and modules, straight-up overwriting the contents of the target directory (yes, over it, no backup behaviour here π). Same deal asinstallkernel: you can point the target directory somewhere else with themake(1)variableINSTKERNNAME.
okay so there's also a whole set of convenience targets for cleaning up the install destination directory β that's the one held in the DESTDIR variable btw β and they go like this:
check-oldβ prints a list of old files and directories in the system. Just looks, doesn't touch πcheck-old-libsβ prints a list of obsolete base system libraries.delete-oldβ actually deletes obsolete base system files and directories, interactively. Pass-DBATCH_DELETE_OLD_FILESon the command line and it stops asking β full non-interactive mode, no vibes check, it just goes π. Set the variablesDESTDIR,TARGET_ARCHandTARGETthe same way you would formake installworld.delete-old-libsβ deletes obsolete base system libraries, interactively. β οΈ Only use this one if no third party software uses these libraries β like, fr fr, check first. Passing-DBATCH_DELETE_OLD_FILESon the command line makes the delete non-interactive. The variablesDESTDIR,TARGET_ARCHandTARGETshould be set as withmake installworld.
β¨ ENVIRONMENT β¨
The variables that influence all builds include:
DEBUG_FLAGSβ defines a set of debugging flags that get used to build all userland binaries under/usr/src. And the slay part: whenDEBUG_FLAGSis defined, theinstallandinstallworldtargets install binaries from the currentMAKEOBJDIRPREFIXwithout stripping, so the debugging information stays in the installed binaries. Your future self debugging at 3am says thank you π«ΆDESTDIRβ the directory hierarchy prefix where built objects get installed. If you don't set it,DESTDIRdefaults to the empty string. If you do set it, it must be an absolute path. no exceptions πMAKEOBJDIRPREFIXβ defines the prefix for directory names in the tree of built objects. Defaults to/usr/objif not defined. π¨ Big one: this variable should only be set in the environment or in/etc/src-env.confβ not via/etc/make.conf, not via/etc/src.conf, and not on the command line. AlsoMAKEOBJDIRPREFIXmust specify an absolute path.WITHOUT_WERRORβ if defined, compiler warnings will not cause the build to halt, even if the makefile says otherwise. Chill mode: enabled πΈWITH_CTFβ if defined, the build process runs the DTrace CTF conversion tools on built objects. CTF stands for CTF, iykyk β¨
π οΈ and the make(1) variables that steer stuff in /usr/src π οΈ
Additionally, builds in /usr/src are influenced by these make(1) variables:
CROSS_TOOLCHAINβ asks for an external toolchain to build either the world or the kernel. The value can be either the full path to a file, or the base name of a file in${LOCALBASE}/share/toolchains. That file should be a make file which sets variables requesting an external toolchain, such asXCC.
External toolchains are available in ports for both LLVM and GCC/binutils. For the ones available in ports, CROSS_TOOLCHAIN should be set to the name of the package. LLVM toolchain packages use the name llvm<major version>. GCC toolchains give you separate packages for each architecture and use the name ${MACHINE_ARCH}-gcc<major version>.
INSTKERNNAMEβ if set, specifies an alternative name to build and install for the various kernel make targets. Defaults tokernel.KERNCONFβ specify one or more space-separated kernels to build and install for the various kernel make targets. If you list multiple, the first kernel listed installs to/boot/${INSTKERNNAME}, and every subsequent kernel installs to/boot/${INSTKERNNAME}.NAME. If it's unset, it defaults toGENERICβ except on POWER architectures, where it defaults toGENERIC64forpowerpc64, andGENERIC64LEforpowerpc64le. Icons only πKERNBUILDDIRβ overrides the default directory used to grab all theopt_*.hfiles when building a kernel module. Super useful for stand-alone modules that depend onconfig(8)options. It's set automatically for modules built with a kernel.KERNCONFDIRβ overrides the directory whereKERNCONF(and any files included byKERNCONF) should be found. Defaults tosys/${ARCH}/conf.KERNFASTβ if set, thebuildkerneltarget defaults to settingNO_KERNELCLEAN,NO_KERNELCONFIG, andNO_KERNELOBJ. And when it's set to a value other than1, thenKERNCONFis set to the value ofKERNFAST. Sneaky but valid π¦KODIRβ if set, specifies an alternative directory to install the kernel into.LOCAL_DIRSβ if set, supplies a list of additional directories (relative to the root of the source tree) to build as part of theeverythingtarget. These get built in parallel with each other and with the base system directories. Drop a.WAITdirective at the beginning of theLOCAL_DIRSlist to make sure all base system directories build first β.WAITmay also be used as needed elsewhere in the list.LOCAL_ITOOLSβ if set, supplies a list of additional tools used by theinstallworldanddistributeworldtargets.LOCAL_LIB_DIRSβ if set, supplies a list of additional directories (relative to the root of the source tree) to build as part of thelibrariestarget. They build in parallel with each other and with the base system libraries. Insert a.WAITdirective at the beginning of theLOCAL_DIRSlist to make sure all base system libraries build first β.WAITmay also be used as needed elsewhere within the list.LOCAL_MTREEβ if set, supplies a list of additional mtrees (relative to the root of the source tree) to use as part of thehierarchytarget.LOCAL_LEGACY_DIRSβ if set, supplies a list of additional directories (relative to the root of the source tree) to build as part of thelegacytarget.LOCAL_BSTOOL_DIRSβ if set, supplies a list of additional directories (relative to the root of the source tree) to build as part of thebootstrap-toolstarget.LOCAL_TOOL_DIRSβ if set, supplies a list of additional directories (relative to the root of the source tree) to build as part of thebuild-toolstarget.LOCAL_XTOOL_DIRSβ if set, supplies a list of additional directories (relative to the root of the source tree) to build as part of thecross-toolstarget.OBJROOTβ the object directory root, defined as${OBJDIR}/${SRCDIR}/. Seeshare/mk/src.sys.obj.mk.PKG_FORMATβ specify a package compression format when buildingfreebsd-base(7)packages. Default:tzst. Consider usingtarto disable compression entirely. The accepted options are documented in the-fdescription ofpkg-create(8).PORTS_MODULESβ a list of ports with kernel modules that should be built and installed as part of thebuildkernelandinstallkernelprocess. Heads up: this is currently incompatible with buildingfreebsd-base(7)packages. Each port must be specified ascategory/port[@flavor], like:
PORTS_MODULES=graphics/gpu-firmware-intel-kmod@kabylake
PORTS_MODULES+=graphics/drm-66-kmod
LOCAL_MODULESβ a list of external kernel modules that should be built and installed as part of thebuildkernelandinstallkernelprocess. Defaults to the list of sub-directories ofLOCAL_MODULES_DIR.LOCAL_MODULES_DIRβ the directory to search in for the kernel modules specified byLOCAL_MODULES. Each kernel module should consist of a directory containing a makefile. Defaults to${LOCALBASE}/sys/modules.SRCCONFβ specify a file to override the default/etc/src.conf. Thesrc.conffile controls which components get built. Seesrc.conf(5).REPODIRβ the root directory used to create the package repository for buildingpackges(7). Defaults to${OBJROOT}/repo/. You can also set this insrc-env.conf(5).STRIPBINβ the command used at install time to strip binaries. Big heads-up: ifSTRIPBINneeds any extra tools to actually run, add them to theLOCAL_ITOOLSmake(1)variable before you rundistributeworldorinstallworld, k? Seeinstall(1)for the whole story.SUBDIR_OVERRIDEβ overrides the default list of sub-directories so you build only the sub-directory named in this variable. Careful tho: if you combine it withbuildworld, all the libraries and includes plus some of the build tools will still build too. Specify-DNO_LIBSand-DWORLDFASTand it'll only build the specified directory, the way it was done historically. When you combine it withbuildworld, you gotta overrideLOCAL_LIB_DIRSwith any custom directories that contain libraries. This lets you build a subset of the system the same waybuildworlddoes, using its sysroot handling. Also super handy when you're debugging a failed build. π
make some-target SUBDIR_OVERRIDE=foo/bar
SYSDIRβ sets where the kernel source lives, overriding the default/usr/src/sys. Ngl the kernel source sits in thesyssubdirectory of the source tree you checked out from thesrc.gitrepository.TARGETβ the target hardware platform, basically theuname -moutput vibe. You need this to cross-build some target architectures. Like, cross-building for ARM64 machines requiresTARGET_ARCH=aarch64andTARGET=arm64. If you don't set it,TARGETdefaults to the current hardware platform β unlessTARGET_ARCHis also set, in which case it defaults to the appropriate value for that architecture. β¨TARGET_ARCHβ the target machine processor architecture, theuname -pequivalent. Set it to cross-build for a different architecture. Not set? ThenTARGET_ARCHdefaults to the current machine architecture, unlessTARGETis also set, in which case it defaults to the appropriate value for that platform. Typically you only need to setTARGETβ that's the main character here π
π οΈ Builds under /usr/src
Builds under /usr/src are also influenced by defining one or more of these symbols, using the -D option of make(1):
LOADER_DEFAULT_INTERPβ sets which interpreter the default loader program gets. Valid values are4th,lua, andsimp. This creates the default link for/boot/loaderpointing at the loader with that interpreter, and it also decides which interpreter gets compiled intouserboot.NO_CLEANDIRβ if set, the build targets that clean parts of the object tree use the equivalent ofmake cleaninstead ofmake cleandir.NO_CLEANβ if set, no object tree files get cleaned at all. Fun fact: this is already the default whenWITH_META_MODEis used withfilemon(4)loaded. Seesrc.conf(5)for more. Heads up: settingNO_CLEANimpliesNO_KERNELCLEAN, so whenNO_CLEANis set, no kernel objects get cleaned either.NO_CTFβ if set, the build process doesn't run the DTrace CTF conversion tools on built objects.NO_SHAREβ if set, the build doesn't descend into the/usr/src/sharesubdirectory. Translation: manual pages, locale data files, timezone data files and other/usr/src/sharefiles will not be rebuilt from their sources. πNO_KERNELCLEANβ if set, the build process doesn't runmake cleanas part of thebuildkerneltarget.NO_KERNELCONFIGβ if set, the build process doesn't runconfig(8)as part of thebuildkerneltarget.NO_KERNELOBJβ if set, the build process doesn't runmake objas part of thebuildkerneltarget.NO_LIBSβ if set, the libraries phase gets skipped entirely. bye bestie πNO_OBJWALKβ if set, no object directories get created. Fr only use this if object directories were created in a previous build and no new directories are connected β otherwise you're gonna have a bad time.UNIVERSE_TOOLCHAINβ requests use of the toolchain built as part of theuniversetarget as an external toolchain.WORLDFASTβ if set, the build targetbuildworlddefaults to settingNO_CLEAN,NO_OBJWALK, and skips most bootstrap phases. It'll only bootstrap libraries and build all of userland. Only use this when you know none of the bootstrap needs changed and that no new directories have been connected to the build. Ignore that and it's giving chaos π
π Builds under /usr/doc
Builds under the directory /usr/doc are influenced by this make(1) variable:
DOC_LANGβ if set, restricts the documentation build to the language subdirectories you list as its content. The default action is to build documentation for all languages.
π Builds using universe and related targets
Builds using the universe and related targets are influenced by these make(1) variables:
JFLAGβ passes the value of this variable to everymake(1)invocation used to build worlds and kernels. Use it to enable multiple jobs within a single architecture's build while still building each architecture serially.MAKE_JUST_KERNELSβ only build kernels for each supported architecture.MAKE_JUST_WORLDSβ only build worlds for each supported architecture.WITHOUT_WORLDSβ only build kernels for each supported architecture.WITHOUT_KERNELSβ only build worlds for each supported architecture.
Yep, that's genuinely what the page says β I'm copying it character for character because the rule is facts never change ππ
UNIVERSE_TARGETβ executes the specifiedmake(1)target for each supported architecture instead of the default action of building a world and one or more kernels. This variable impliesWITHOUT_KERNELS.USE_GCC_TOOLCHAINSβ uses external GCC toolchains to build the requested targets. If the required toolchain package for a supported architecture isn't installed, the build for that architecture is skipped. You can pin a specific version of GCC by setting the value of this variable to the version you want (for example,gcc14) β otherwise a default version of GCC is used.TARGETSβ only build the listed targets instead of each supported architecture.EXTRA_TARGETSβ in addition to the supported architectures, also build the semi-supported architectures. A semi-supported architecture has build support in the FreeBSD tree, but it gets significantly less testing and is generally for fringe uses that don't have wide appeal. Not the main character energy, but we respect the grind π«Ά
π FILES
/usr/doc/Makefile
/usr/doc/share/mk/doc.project.mk
/usr/ports/Mk/bsd.port.mk
/usr/ports/Mk/bsd.sites.mk
/usr/src/Makefile
/usr/src/Makefile.inc1 make(1) infrastructure for each tree
/usr/ports/UPDATING
/usr/src/UPDATING notable changes in each tree
/usr/share/examples/etc/make.conf example make.conf(5)
/etc/src.conf src build configuration, see
src.conf(5)
π EXAMPLES π
Okay bestie, this section is literally the lore drop β it's all the best practices for the common situations you're gonna hit. And when you do gotta do something by hand, UPDATING will tell you.
β οΈ MAKE SURE YOU HAVE FULL BACKUPS BEFORE PROCEEDING! I'm not playing, like, actually do it. π
π Example 1: Build and upgrade system in place π
So if you're running installed drivers β think graphics drivers or virtual machine guest drivers β you gotta check out the ports(7) tree, and then name those drivers in src.conf(5) so they get built and installed automatically right after the kernel. Iconic shortcut, no cap:
git clone https://git.FreeBSD.org/ports.git /usr/ports
cat << EOF >> /etc/src.conf
PORTS_MODULES+=graphics/drm-kmod emulators/virtualbox-ose-kmod
EOF
Then check out the CURRENT branch, build it, and install it β overwriting the current system, yeah, it's giving full send:
git clone https://git.FreeBSD.org/src.git /usr/src
cd /usr/src
make buildworld buildkernel
make installkernel
shutdown -r now
For major version upgrades, boot into single-user mode. After you restart, install userspace and merge configurations. Then β only after you've verified you genuinely don't need them β delete the old files:
cd /usr/src
etcupdate -p
make installworld
etcupdate -B
make delete-old
shutdown -r now
And once you've tested the new system and confirmed your apps don't depend on them, delete the old libraries:
make delete-old-libs
πΈ Example 2: Build and upgrade a custom kernel πΈ
Make a custom kernel config, MYKERNEL, by including an existing config and using device/nodevice and options/nooption to pick and configure your components:
cd /usr/src
cat << EOF > sys/amd64/conf/MYKERNEL
include GENERIC
ident MYKERNEL
nodevice sound
EOF
Once that's done, build a fresh toolchain, build the kernel, and install it directly β which moves the old kernel to /boot/kernel.old/:
make kernel-toolchain
make -DALWAYS_CHECK_MAKE buildkernel KERNCONF=MYKERNEL
make -DALWAYS_CHECK_MAKE installkernel KERNCONF=MYKERNEL
shutdown -r now
If you'd rather package the kernel into a freebsd-base(7) package instead of installing it directly, use update-packages instead of installkernel β the way that this just works:
make buildworld buildkernel KERNCONF=MYKERNEL
make update-packages KERNCONF=MYKERNEL
And if you wanna install the kernel directly to an alternate location, use the INSTKERNNAME variable and boot it once to test it via nextboot(8):
make installkernel KERNCONF=MYKERNEL INSTKERNNAME=testkernel
nextboot -k testkernel
shutdown -r now
π¦ Example 3: Build and upgrade a single piece of userspace π¦
Rebuild and reinstall one single piece of userspace β in this case ls(1). She's small, she's mighty:
cd /usr/src/bin/ls
make clean all
make install
β¨ Example 4: Build and upgrade a loadable kernel module β¨
Same energy, but for one single loadable kernel module β in this case sound(4):
cd /usr/src/sys/modules/sound
make all install clean cleandepend KMODDIR=/boot/kernel
π₯ Example 5: Quickly rebuild a kernel in place π₯
Quick little rebuild-and-reinstall of the kernel where it only recompiles the files that changed since your last build. Obsessed with the efficiency, but heads up:
β οΈ This only works if you've already completed a full kernel build in the past. It will not work on a fresh source tree, and that's on periodt.
cd /usr/src
make kernel KERNFAST=1
π Example 6: Cross-compiling for different architectures π
Wanna rebuild parts of FreeBSD for a different CPU architecture? First prep your source tree by building the cross-toolchain:
cd src
make toolchain TARGET_ARCH=aarch64
Then this little sequence right here cross-builds the whole system for the arm64 (aarch64) architecture on a totally different host architecture β like amd64, for example:
cd /usr/src
make TARGET_ARCH=aarch64 buildworld buildkernel
make TARGET_ARCH=aarch64 DESTDIR=/client installworld installkernel
After all that, to build and install just one piece of userspace, use:
cd src/bin/ls
make buildenv TARGET_ARCH=aarch64
make clean all install DESTDIR=/client
And likewise, to quickly rebuild and reinstall the kernel, use:
cd src
make buildenv TARGET_ARCH=aarch64
make kernel KERNFAST=1 DESTDIR=/client
π DIAGNOSTICS π
If you see these, bestie, something went sideways:
Bad system call (core dumped)
rescue/sh check failed, installation aborted
Translation: the kernel was not updated, because the build procedure was incorrect. π Go study the examples above β they're literally right there, you got this. π«Ά
π SEE ALSO π
The whole friend group: cc(1), install(1), make(1), make.conf(5), src.conf(5), arch(7), development(7), freebsd-base(7), pkg(7), ports(7), release(7), tests(7), config(8), etcupdate(8), nextboot(8), pkg-repo(8), shutdown(8)
π§ HISTORY π§
The build manpage first appeared in FreeBSD 4.3. A true icon since day one. β
π AUTHORS π
Mike W. Meyer <mwm@mired.org> β thank you for your service, king. π
πΊ CAVEATS πΊ
Okay, the fine print β but make it fashion. Read these, fr fr:
- Old objects can cause obscure build problems; try
make cleandir cleandir. π - Environment poisoning can cause obscure build problems; try prefixing
make(1)commands withenv -i. - When you're doing a major release upgrade, booting into single user mode for
installworldis required. Not optional, not a vibe suggestion. - Updating the
boot loader(8)is architecture specific. Consultboot(8)for your architecture for more details. π¦
And that's the whole page, bestie! π This one came from the Debian build of the page dated April 28, 2026 β go forth and make buildworld responsibly. π
β¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π the page's license: BSD-2-Clause
- Copyright (c) 2000 Mike W. Meyer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms