- NetBSD Manual Pages
CONFIG(1) NetBSD General Commands Manual CONFIG(1)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
config -- build kernel compilation directories
config [-dMPpSv] [-b builddir] [-D var=value] [-s srcdir] [-U value]
config -x [kernel-file]
config -L [-v] [-s srcdir] [config-file]
In its first synopsis form, config creates a kernel build directory from
the machine description file config-file, which describes the system to
configure. Refer to section KERNEL BUILD CONFIGURATION for the details
of that use of config.
In its second synopsis form, config takes the binary kernel kernel-file
as its single argument (aside from the mandatory -x flag), then extracts
the embedded configuration file (if any) and writes it to standard out-
put. If kernel-file is not given, and the system is not running NetBSD
an error is printed. On systems running NetBSD the booted kernel is
looked up using the sysctl(3) variable machdep.booted_kernel and if that
is not found, _PATH_UNIX (/netbsd) is used. Configuration data will be
available if the given kernel was compiled with either
INCLUDE_CONFIG_FILE or INCLUDE_JUST_CONFIG options.
In its third synopsis form, config is a tool for the kernel developer and
generates a ``lint'' configuration file to be used during regression
testing. Refer to section LINT CONFIGURATION for the details of that use
config accepts the following parameters:
Use builddir as the kernel build directory, instead of computing
and creating one automatically.
-d Issue diagnostic output for debugging problems with config
itself. More -d options (currently up to 5) produce more output.
Define a makeoptions variable to the given value. This is equiv-
alent to appending a makeoptions var=value line to the config
-L Generate a lint configuration. See section LINT CONFIGURATION
-M Do modular build (experimental). Instead of linking all object
files (*.o) at once, collect related object files into an inter-
mediate relocatable object (*.ko), then link those *.ko files
into the final kernel. This changes the order of objects in the
-P Pack locators to save space in the resulting kernel binary. The
amount of space saved that way is so small that this option
should be considered historical, and of no actual use.
-p Generate a build directory suited for kernel profiling. However,
this options should be avoided in favor of the relevant options
inside the configuration file as described in section KERNEL
Point to the top of the kernel source tree. It must be an abso-
lute path when config is used to prepare a kernel build direc-
tory, but can be relative when it is used in combination with the
-S Use suffix rules and build objects under subdirectories (experi-
-U var Undefine the makeoption var. This is equivalent to appending the
line no makeoptions var to the config file.
-v Increase verbosity by enabling some more warnings.
-x Extract the configuration embedded in a kernel binary.
KERNEL BUILD CONFIGURATION
There are several different ways to run the config program. The tradi-
tional way is to run config from the conf subdirectory of the machine-
specific directory of the system source (usually /sys/arch/MACHINE/conf,
where MACHINE is one of vax, hp300, and so forth), and to specify as the
config-file the name of a machine description file located in that direc-
tory. config will by default create files in the directory
../compile/SYSTEMNAME, where SYSTEMNAME is the last path component of
config-file. config will assume that the top-level kernel source direc-
tory is located four directories above the build directory.
Another way is to create the build directory yourself, place the machine
description file in the build directory with the name CONFIG, and run
config from within the build directory without specifying a config-file.
config will then by default create files in the current directory. If
you run config this way, you must specify the location of the top-level
kernel source directory using the -s option or by using the ``source''
directive at the beginning of the machine description file.
Finally, you can specify the build directory for config and run it from
anywhere. You can specify a build directory with the -b option or by
using the ``build'' directive at the beginning of the machine description
file. You must specify the location of the top-level kernel source
directory if you specify a build directory.
If config-file is a binary kernel, config will try to extract the config-
uration file embedded into it, which will be present if that kernel was
built either with INCLUDE_CONFIG_FILE or INCLUDE_JUST_CONFIG options.
This work mode requires you to manually specify a build directory with
the -b option, which implies the need to provide a source tree too.
If the -p option is supplied, .PROF is appended to the default compila-
tion directory name, and config acts as if the lines ``makeoptions
PROF="-pg"'' and ``options GPROF'' appeared in the machine description
file. This will build a system that includes profiling code; see
kgmon(8) and gprof(1). The -p flag is expected to be used for
``one-shot'' profiles of existing systems; for regular profiling, it is
probably wiser to create a separate machine description file containing
the makeoptions line.
The old undocumented -g flag is no longer supported. Instead, use
``makeoptions DEBUG="-g"'' and (typically) ``options KGDB''.
The output of config consists of a number of files, principally ioconf.c,
a description of I/O devices that may be attached to the system; and a
Makefile, used by make(1) in building the kernel.
After running config, it is wise to run ``make depend'' in the directory
where the new makefile was created. config prints a reminder of this
when it completes.
If config stops due to errors, the problems reported should be corrected
and config should be run again. config attempts to avoid changing the
compilation directory if there are configuration errors, but this code is
not well-tested, and some problems (such as running out of disk space)
A so-called ``lint'' configuration should include everything from the
kernel that can possibly be selected. The rationale is to provide a way
to reach all the code a user might select, in order to make sure all
options and drivers compile without error for a given source tree.
When used with the -L flag, config takes the regular configuration file
config-file and prints on the standard output a configuration file that
includes config-file, selects all options and file-systems the user can
possibly select, and defines an instance of every possible attachment as
described by the kernel option definition files used by config-file.
The resulting configuration file is meant as a way to select all possible
features in order to test that each of them compiles. It is not meant to
result in a kernel binary that can run on any hardware.
Unlike the first synopsis form, the provided srcdir is relative to the
current working directory. In the first synopsis form, it is relative to
the build directory.
The SYNOPSIS portion of each device in section 4.
options(4), config(5), config(9)
The config command appeared in 4.1BSD. It was completely revised in
4.4BSD. The -x option appeared in NetBSD 2.0. The -L option appeared in
NetBSD 10.99 September 1, 2015 NetBSD 10.99