DragonFly On-Line Manual Pages
BUILD(7) DragonFly Miscellaneous Information Manual BUILD(7)
build - information on how to build the system
The source for the DragonFly system and applications is located in
/usr/src. This directory contains the "base system" sources, which is
loosely defined as the things required to rebuild the system to a useful
state. It also contains the source for the system documentation,
including manual pages. Refer to development(7) for more information on
how to obtain the DragonFly sources.
Third party applications have to be built using the dports(7) system.
The file /usr/Makefile has targets for obtaining the dports tree. Typing
make in /usr gives specifics on how to obtain the tree for building
The make(1) command is used in /usr/src to build and install the things
in that directory. Issuing the make(1) command in any directory or
subdirectory of those directories has the same effect as issuing the same
command in all subdirectories of that directory. With no target
specified, the things in that directory are just built. The following
list provides the names and actions for other targets:
clean Removes any files created during the build process.
install Installs the results of the build for this directory.
The other /usr/src make targets are:
buildworld Rebuild everything but the kernel.
quickworld Same as buildworld, but skip bootstrap, build and
cross-build tool steps. This target can be used
for incremental upgrades once a full build of the
world has been done with buildworld.
realquickworld Same as quickworld, but also skip the depend
crossworld Just do the bootstrap, build and cross-build
installworld Install everything built by buildworld, as well
as the rescue tools and the initial ramdisk if
they do not exist yet.
installworld-force Force an installworld. This will install to a
temporary directory, then copy the main binaries
and libraries with a static cpdup(1) to DESTDIR
and finally will issue a normal installworld and
upgrade. It is a special case to be used on
older systems as a last resort when the normal
installworld doesn't work.
world buildworld * installworld
buildkernel Rebuild the kernel and the kernel-modules.
nativekernel Rebuild the kernel and the kernel-modules using
quickkernel Same as buildkernel, but do not clean out the obj
modules. This target can be used for incremental
upgrades once a full build of the kernel has been
done with buildkernel.
realquickkernel Same as quickkernel, but also skip the depend
installkernel Install the kernel and the kernel-modules.
reinstallkernel Reinstall the kernel and the kernel-modules.
kernel buildkernel * installkernel
build-all buildworld * buildkernel
The option -j hw.ncpu is added automatically to
optimally utilize the system.
install-all installkernel * installworld + upgrade
preinstall Perform certain operations that have to be done
before installworld, such as adding new users and
groups. This target will be automatically
executed by installworld.
upgrade Upgrade the files in /etc and also setup the rest
of the system for the version of DragonFly just
installed. Also, check for existence of objects
being deprecated with the new installation.
Note that deprecated system libraries may still
be linked from packages installed under
/usr/local/ or other 3rd party objects placed
elsewhere. The check tries to detect these
dependencies, by default searching /usr/local/.
Other places to search may be specified in
CHECK_DEPRECATED_DIRS variable. If defined,
these directories will be searched in addition to
initrd Install the statically linked rescue tools and
the initial ramdisk built by buildworld.
backupworld Manually archive binaries from installed world to
location specified by WORLD_BACKUP.
backup-clean Delete archive created by backupworld.
backup-auto-clean Delete archive created automatically during
restoreworld Restore binaries from archive created by
restoreworld-auto Restore binaries from archive created
automatically during installworld. The archive
location is specified by AUTO_BACKUP.
The target machine processor architecture and
hardware platform. These have to be set for cross-
building. TARGET_ARCH is analogous to the "uname
-p" output. For the 64 bit AMD architecture known
as AMD64, x86-64 or Intel 64, use:
DESTDIR An existing directory to be the root of the
hierarchy where the resulting binaries will be
installed (the default is /).
MAKEOBJDIRPREFIX The directory hierarchy where the object files will
be built (the default is /usr/obj).
__MAKE_CONF Used to override the path of make.conf(5) (the
default is /etc/make.conf).
KERNCONF The name of one or more kernel configurations from
which kernels should be built (the default is
KERNCONFDIR The directory where the kernel configuration files
are kept (the default is /usr/src/sys/config).
DESTLABEL Common suffix added to kernel and modules directory
names, prefixed by a single dot. For example,
make DESTLABEL=test installkernel
installs them as /boot/kernel.test/kernel and
DESTKERNDIR Where to install the kernel and the modules (the
default is /boot), in the directory hierarchy
specified by the environment variable DESTDIR.
DESTKERNNAME The name of the installed kernel file (the default
is kernel), under the directory specified by
DESTKERNDIR. This overrides the effect of
DESTMODULESNAME The name of the directory to install the kernel
modules (the default is modules), under the
directory specified by DESTKERNDIR. This overrides
the effect of DESTLABEL.
WORLD_BACKUP Directory for manual backup of binaries of
installed world (default:
AUTO_BACKUP Directory for automatic backup of binaries of
installed world (default:
NO_BACKUP When defined, the automatic backup feature of
installworld is inhibited.
COPTFLAGS Overrides the default optimization flags for kernel
and module compiles.
KCFLAGS Allows you to add additional compiler flags for
kernel and module compiles. But use COPTFLAGS to
specify any optimization overrides, as some modules
may have to override it to enforce a lower
Directories to search for objects being still
linked to deprecated system libraries. This space
separated list will be used by upgrade target in
addition to default /usr/local/.
REMOVE_DEPRECATED Remove system objects marked as deprecated. Used
by upgrade target.
There are two other mechanisms that users should be aware of. First,
when you issue a installkernel DragonFly will make a backup of the
current kernel in /boot/kernel.old. Because people often do multiple
installkernel operations, this backup kernel can also get lost in the
noise. It is usually prudent to make a backup of the old kernel manually
every once in a while when you know that it is a good kernel. you can do
this after issuing the installkernel by running the command:
cpdup /boot/kernel.old /boot/kernel.bak
The advantage of this is that no installation mechanism will overwrite
your /boot/kernel.bak, and in addition to that the loader's boot menu
will check for its existence and present a menu option 'b' to allow you
to boot from it.
The second mechanism is related to the two-stage root mount. When using
an encrypted root, the system will actually boot from a small initial
ramdisk (a.k.a. initrd) image stored as /boot/kernel/initrd.img.gz. This
image will handle the encrypted configuration, mount, and chroot to the
real root. This image is also used as the rescue ramdisk boot menu
option. This image is NOT updated automatically by installworld or
installkernel. Instead, updating this image has to be done by running
the manual command:
It is usually a good idea to run this command after rebooting into the
new world that you installed (so you know the world you installed is
good). This command will update the initrd image in /boot/kernel and the
rescue tools in /rescue.
The "approved" method of updating your system from the latest sources is:
make buildkernel KERNCONF=FOO
make installkernel KERNCONF=FOO
The above mentioned build and install order enforces that the new kernel
is installed before the new world. Sometimes it might be necessary to
reboot the system between those two steps. In this case "make
installworld" will tell you to do so.
cc(1), install(1), make(1), wmake(1), make.conf(5), development(7),
dports(7), release(7), config(8), reboot(8), shutdown(8)
Mike W. Meyer <email@example.com> and Sascha Wildner <firstname.lastname@example.org>.
DragonFly 6.1-DEVELOPMENT June 24, 2021 DragonFly 6.1-DEVELOPMENT