© 2013 Warren Block
Last updated 2013-09-09
Building FreeBSD world and kernel: the concise version.
Building the world and kernel on FreeBSD need not be a big deal. The Handbook has the long, detailed procedure. Most of the time, that procedure can be greatly reduced. Here we’ll use a shorter, simpler, faster version. If there are problems, try the Handbook procedure, or check /usr/src/UPDATING for instructions.
The Really Short Version
# rm -rf /usr/obj # cd /usr/src # make buildworld # make kernel # make installworld # mergemaster -Ui # shutdown -r now # cd /usr/src # make check-old
Deleting the old object directory speeds up the build. If
/usr/obj has special permissions or flags like nodump, deleting
/usr/obj/usr is usually enough and preserves the parent directory. If
the system has enough RAM, a tmpfs(5) filesystem can be used in
|Using the -j option can increase speed by running multiple jobs. How many jobs to use depends on the processor; number of cores plus one is a start. Test other values, because hardware varies. The devel/ccache port can also increase speed if you update regularly.|
|The kernel target builds and installs the new kernel. If you have a custom kernel, set the name in the KERNCONF variable (make kernel KERNCONF=MYKERNEL). The official Handbook procedure recommends a reboot into single user mode after installing the new kernel, but it is not required.|
|Do not use -j with installworld.|
|-Ui speeds mergemaster usage. Set IGNORE_FILES= in /etc/mergemaster.rc to skip files that don’t need to be merged. See mergemaster(8).|
|If old files are found, use the delete-old and delete-old-libs targets to remove them. Programs that are still using old libraries will be broken until they have been recompiled.|