xref: /netbsd-src/usr.bin/config/config.1 (revision b06817457fd005395ddc17cd2a172bb4bddcb8c5)
1*b0681745Suebayasi.\"	$NetBSD: config.1,v 1.19 2015/09/01 16:01:23 uebayasi Exp $
25ecc953bSthorpej.\"
35ecc953bSthorpej.\" Copyright (c) 1980, 1991, 1993
45ecc953bSthorpej.\"	The Regents of the University of California.  All rights reserved.
55ecc953bSthorpej.\"
65ecc953bSthorpej.\" Redistribution and use in source and binary forms, with or without
75ecc953bSthorpej.\" modification, are permitted provided that the following conditions
85ecc953bSthorpej.\" are met:
95ecc953bSthorpej.\" 1. Redistributions of source code must retain the above copyright
105ecc953bSthorpej.\"    notice, this list of conditions and the following disclaimer.
115ecc953bSthorpej.\" 2. Redistributions in binary form must reproduce the above copyright
125ecc953bSthorpej.\"    notice, this list of conditions and the following disclaimer in the
135ecc953bSthorpej.\"    documentation and/or other materials provided with the distribution.
145ecc953bSthorpej.\" 3. Neither the name of the University nor the names of its contributors
155ecc953bSthorpej.\"    may be used to endorse or promote products derived from this software
165ecc953bSthorpej.\"    without specific prior written permission.
175ecc953bSthorpej.\"
185ecc953bSthorpej.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
195ecc953bSthorpej.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
205ecc953bSthorpej.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
215ecc953bSthorpej.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
225ecc953bSthorpej.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
235ecc953bSthorpej.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
245ecc953bSthorpej.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
255ecc953bSthorpej.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
265ecc953bSthorpej.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
275ecc953bSthorpej.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
285ecc953bSthorpej.\" SUCH DAMAGE.
295ecc953bSthorpej.\"
305ecc953bSthorpej.\"     from: @(#)config.8	8.2 (Berkeley) 4/19/94
315ecc953bSthorpej.\"
32*b0681745Suebayasi.Dd September 1, 2015
33d3918ffeSwiz.Dt CONFIG 1
345ecc953bSthorpej.Os
355ecc953bSthorpej.Sh NAME
365ecc953bSthorpej.Nm config
375ecc953bSthorpej.Nd build kernel compilation directories
385ecc953bSthorpej.Sh SYNOPSIS
395ecc953bSthorpej.Nm
40*b0681745Suebayasi.Op Fl dMPpSv
415ecc953bSthorpej.Op Fl b Ar builddir
421957b5eaSmartin.Op Fl D Ar var=value
435f345558Swiz.Op Fl s Ar srcdir
441957b5eaSmartin.Op Fl U Ar value
455ecc953bSthorpej.Op Ar config-file
465ecc953bSthorpej.Nm
475ecc953bSthorpej.Fl x
485ecc953bSthorpej.Op Ar kernel-file
4959c94545Scube.Nm
5059c94545Scube.Fl L
5159c94545Scube.Op Fl v
5259c94545Scube.Op Fl s Ar srcdir
5359c94545Scube.Op Ar config-file
545ecc953bSthorpej.Sh DESCRIPTION
555ecc953bSthorpejIn its first synopsis form,
565ecc953bSthorpej.Nm
575ecc953bSthorpejcreates a kernel build directory from the machine description file
585ecc953bSthorpej.Ar config-file ,
595ecc953bSthorpejwhich describes the system to configure.
60a44b9acdSwizRefer to section
61a44b9acdSwiz.Sx KERNEL BUILD CONFIGURATION
62a44b9acdSwizfor the details of that use
6314a82de8Scubeof
6414a82de8Scube.Nm .
6514a82de8Scube.Pp
6614a82de8ScubeIn its second synopsis form,
6714a82de8Scube.Nm
6814a82de8Scubetakes the binary kernel
6914a82de8Scube.Ar kernel-file
7014a82de8Scubeas its single argument (aside from the mandatory
7114a82de8Scube.Fl x
7214a82de8Scubeflag), then extracts the embedded configuration file (if any) and
7314a82de8Scubewrites it to standard output.
7414a82de8ScubeIf
7514a82de8Scube.Ar kernel-file
768aaed512Schristosis not given, and the system is not running
778aaed512Schristos.Nx
788aaed512Schristosan error is printed.
798aaed512SchristosOn systems running
808aaed512Schristos.Nx
818aaed512Schristosthe booted kernel is looked up using the
828aaed512Schristos.Xr sysctl 3
83686e48a4Swizvariable
848aaed512Schristos.Dv machdep.booted_kernel
85686e48a4Swizand if that is not found,
868aaed512Schristos.Dv _PATH_UNIX
87686e48a4Swiz.Pq Pa /netbsd
88686e48a4Swizis used.
8914a82de8ScubeConfiguration data will be available if the given kernel was compiled
9014a82de8Scubewith either
9114a82de8Scube.Va INCLUDE_CONFIG_FILE
9214a82de8Scubeor
9314a82de8Scube.Va INCLUDE_JUST_CONFIG
9414a82de8Scubeoptions.
9514a82de8Scube.Pp
9614a82de8ScubeIn its third synopsis form,
9714a82de8Scube.Nm
9814a82de8Scubeis a tool for the kernel developer and generates a
9914a82de8Scube.Dq lint
10014a82de8Scubeconfiguration file to be used during regression testing.
1019a23b0e1ScubeRefer to section
1029a23b0e1Scube.Sx LINT CONFIGURATION
1039a23b0e1Scubefor the details of that use of
10414a82de8Scube.Nm .
10514a82de8Scube.Pp
10614a82de8Scube.Nm
10714a82de8Scubeaccepts the following parameters:
10814a82de8Scube.Bl -tag -width indent
10914a82de8Scube.It Fl b Ar builddir
11014a82de8ScubeUse
11114a82de8Scube.Ar builddir
11214a82de8Scubeas the kernel build directory, instead of computing and creating one
11314a82de8Scubeautomatically.
1147fee31e5Sdholland.It Fl d
1157fee31e5SdhollandIssue diagnostic output for debugging problems with
1167fee31e5Sdholland.Nm
1177fee31e5Sdhollanditself.
1187fee31e5SdhollandMore
1197fee31e5Sdholland.Fl d
1207fee31e5Sdhollandoptions (currently up to 5) produce more output.
1211957b5eaSmartin.It Fl D Ar var=value
1221957b5eaSmartinDefine a makeoptions variable to the given value.
1231957b5eaSmartinThis is equivalent to appending a
1241957b5eaSmartin.Li makeoptions var=value
1251957b5eaSmartinline to the config file.
12614a82de8Scube.It Fl L
127a7c1bdebSwizGenerate a lint configuration.
128a7c1bdebSwizSee section
1299a23b0e1Scube.Sx LINT CONFIGURATION
1309a23b0e1Scubefor details.
131b0d108d3Suebayasi.It Fl M
132b0d108d3SuebayasiDo modular build (experimental).
133b0d108d3SuebayasiInstead of linking all object files (*.o) at once, collect related object
134c8fb5a2eSwizfiles into an intermediate relocatable object (*.ko), then link those *.ko
135b0d108d3Suebayasifiles into the final kernel.
136b0d108d3SuebayasiThis changes the order of objects in the kernel binary.
13714a82de8Scube.It Fl P
13814a82de8ScubePack locators to save space in the resulting kernel binary.
13914a82de8ScubeThe amount of space saved that way is so small that this option should
14014a82de8Scubebe considered historical, and of no actual use.
14114a82de8Scube.It Fl p
14214a82de8ScubeGenerate a build directory suited for kernel profiling.
14314a82de8ScubeHowever, this options should be avoided in favor of the relevant options
144a44b9acdSwizinside the configuration file as described in section
145a44b9acdSwiz.Sx KERNEL BUILD CONFIGURATION .
14614a82de8Scube.It Fl s Ar srcdir
14714a82de8ScubePoint to the top of the kernel source tree.
14814a82de8ScubeIt must be an absolute path when
14914a82de8Scube.Nm
15014a82de8Scubeis used to prepare a kernel build directory, but can be relative
15114a82de8Scubewhen it is used in combination with the
15214a82de8Scube.Fl L
15314a82de8Scubeflag.
154*b0681745Suebayasi.It Fl S
155*b0681745SuebayasiUse suffix rules and build objects under subdirectories (experimental).
1561957b5eaSmartin.It Fl U Ar var
1571957b5eaSmartinUndefine the makeoption
1581957b5eaSmartin.Ar var .
1591957b5eaSmartinThis is equivalent to appending the line
1601957b5eaSmartin.Li no makeoptions var
1611957b5eaSmartinto the config file.
16214a82de8Scube.It Fl v
16314a82de8ScubeIncrease verbosity by enabling some more warnings.
16414a82de8Scube.It Fl x
16514a82de8ScubeExtract the configuration embedded in a kernel binary.
16614a82de8Scube.El
16714a82de8Scube.Ss KERNEL BUILD CONFIGURATION
1685ecc953bSthorpejThere are several different ways to run the
1695ecc953bSthorpej.Nm
1705ecc953bSthorpejprogram.
1715ecc953bSthorpejThe traditional way is to run
1725ecc953bSthorpej.Nm
1735ecc953bSthorpejfrom the
1745ecc953bSthorpej.Pa conf
1755ecc953bSthorpejsubdirectory of the machine-specific directory of the system source
1765ecc953bSthorpej(usually
1775ecc953bSthorpej.Pa /sys/arch/MACHINE/conf ,
1785ecc953bSthorpejwhere
1795ecc953bSthorpej.Pa MACHINE
1805ecc953bSthorpejis one of
1815ecc953bSthorpej.Pa vax ,
1825ecc953bSthorpej.Pa hp300 ,
1835ecc953bSthorpejand so forth), and to specify as the
1845ecc953bSthorpej.Ar config-file
1855ecc953bSthorpejthe name of a machine description file located in that directory.
1865ecc953bSthorpej.Nm
1875ecc953bSthorpejwill by default create files in the directory
1885ecc953bSthorpej.Pa ../compile/SYSTEMNAME ,
1895ecc953bSthorpejwhere
1905ecc953bSthorpej.Pa SYSTEMNAME
1915ecc953bSthorpejis the last path component of
1925ecc953bSthorpej.Ar config-file .
1935ecc953bSthorpej.Nm
1945ecc953bSthorpejwill assume that the top-level kernel source directory is located four
1955ecc953bSthorpejdirectories above the build directory.
1965ecc953bSthorpej.Pp
1975ecc953bSthorpejAnother way is to create the build directory yourself, place the
1985ecc953bSthorpejmachine description file in the build directory with the name
1995ecc953bSthorpej.Pa CONFIG ,
2005ecc953bSthorpejand run
2015ecc953bSthorpej.Nm
2025ecc953bSthorpejfrom within the build directory without specifying a
2035ecc953bSthorpej.Ar config-file .
2045ecc953bSthorpej.Nm
2055ecc953bSthorpejwill then by default create files in the current directory.
2065ecc953bSthorpejIf you run
2075ecc953bSthorpej.Nm
2085ecc953bSthorpejthis way, you must specify the location of the top-level kernel source
2095ecc953bSthorpejdirectory using the
2105ecc953bSthorpej.Fl s
2115ecc953bSthorpejoption or by using the
2125ecc953bSthorpej.Dq Li source
2135ecc953bSthorpejdirective at the beginning of the machine description file.
2145ecc953bSthorpej.Pp
2155ecc953bSthorpejFinally, you can specify the build directory for
2165ecc953bSthorpej.Nm
2175ecc953bSthorpejand run it from anywhere.
2185ecc953bSthorpejYou can specify a build directory with the
2195ecc953bSthorpej.Fl b
2205ecc953bSthorpejoption or by using the
2215ecc953bSthorpej.Dq Li build
2225ecc953bSthorpejdirective at the beginning of the machine description file.
2235ecc953bSthorpejYou must specify the location of the top-level kernel source directory if you
2245ecc953bSthorpejspecify a build directory.
2255ecc953bSthorpej.Pp
2265ecc953bSthorpejIf
2275ecc953bSthorpej.Ar config-file
2285ecc953bSthorpejis a binary kernel,
2295ecc953bSthorpej.Nm
2305ecc953bSthorpejwill try to extract the configuration file embedded into it, which will
2315ecc953bSthorpejbe present if that kernel was built either with
2325ecc953bSthorpej.Va INCLUDE_CONFIG_FILE
2335ecc953bSthorpejor
2345ecc953bSthorpej.Va INCLUDE_JUST_CONFIG
2355ecc953bSthorpejoptions.
2365ecc953bSthorpejThis work mode requires you to manually specify a build directory with
2375ecc953bSthorpejthe
2385ecc953bSthorpej.Fl b
2395ecc953bSthorpejoption, which implies the need to provide a source tree too.
2405ecc953bSthorpej.Pp
2415ecc953bSthorpejIf the
2425ecc953bSthorpej.Fl p
2435ecc953bSthorpejoption is supplied,
2445ecc953bSthorpej.Pa .PROF
2455ecc953bSthorpejis appended to the default compilation directory name, and
2465ecc953bSthorpej.Nm
2475ecc953bSthorpejacts as if the lines
2485ecc953bSthorpej.Dq Li makeoptions PROF="-pg"
2495ecc953bSthorpejand
2505ecc953bSthorpej.Dq Li options GPROF
2515ecc953bSthorpejappeared in the machine description file.
2525ecc953bSthorpejThis will build a system that includes profiling code; see
2535ecc953bSthorpej.Xr kgmon 8
2545ecc953bSthorpejand
2555ecc953bSthorpej.Xr gprof 1 .
2565ecc953bSthorpejThe
2575ecc953bSthorpej.Fl p
2585ecc953bSthorpejflag is expected to be used for
2595ecc953bSthorpej.Dq one-shot
2605ecc953bSthorpejprofiles of existing systems; for regular profiling, it is probably
2615ecc953bSthorpejwiser to create a separate machine description file containing the
2625ecc953bSthorpej.Li makeoptions
2635ecc953bSthorpejline.
2645ecc953bSthorpej.Pp
2655ecc953bSthorpejThe old undocumented
2665ecc953bSthorpej.Fl g
2675ecc953bSthorpejflag is no longer supported.
2685ecc953bSthorpejInstead, use
2695ecc953bSthorpej.Dq Li makeoptions DEBUG="-g"
2705ecc953bSthorpejand (typically)
2715ecc953bSthorpej.Dq Li options KGDB .
2725ecc953bSthorpej.Pp
2735ecc953bSthorpejThe output of
2745ecc953bSthorpej.Nm
2755ecc953bSthorpejconsists of a number of files, principally
2765ecc953bSthorpej.Pa ioconf.c ,
2775ecc953bSthorpeja description of I/O devices that may be attached to the system; and a
2785ecc953bSthorpej.Pa Makefile ,
2795ecc953bSthorpejused by
2805ecc953bSthorpej.Xr make 1
2815ecc953bSthorpejin building the kernel.
2825ecc953bSthorpej.Pp
2835ecc953bSthorpejAfter running
2845ecc953bSthorpej.Nm ,
2855ecc953bSthorpejit is wise to run
2865ecc953bSthorpej.Dq Li make depend
2875ecc953bSthorpejin the directory where the new makefile
2885ecc953bSthorpejwas created.
2895ecc953bSthorpej.Nm
2905ecc953bSthorpejprints a reminder of this when it completes.
2915ecc953bSthorpej.Pp
2925ecc953bSthorpejIf
2935ecc953bSthorpej.Nm
2945ecc953bSthorpejstops due to errors, the problems reported should be corrected and
2955ecc953bSthorpej.Nm
2965ecc953bSthorpejshould be run again.
2975ecc953bSthorpej.Nm
2985ecc953bSthorpejattempts to avoid changing the compilation directory
2995ecc953bSthorpejif there are configuration errors,
3005ecc953bSthorpejbut this code is not well-tested,
3015ecc953bSthorpejand some problems (such as running out of disk space)
3025ecc953bSthorpejare unrecoverable.
30314a82de8Scube.Ss LINT CONFIGURATION
30414a82de8ScubeA so-called
30514a82de8Scube.Dq lint
30614a82de8Scubeconfiguration should include everything from the kernel that can
30714a82de8Scubepossibly be selected.
30814a82de8ScubeThe rationale is to provide a way to reach all the code a user might
30914a82de8Scubeselect, in order to make sure all options and drivers compile without
31014a82de8Scubeerror for a given source tree.
3115ecc953bSthorpej.Pp
31214a82de8ScubeWhen used with the
31314a82de8Scube.Fl L
31414a82de8Scubeflag,
31559c94545Scube.Nm
31659c94545Scubetakes the regular configuration file
31759c94545Scube.Ar config-file
31859c94545Scubeand prints on the standard output a configuration file that includes
31959c94545Scube.Ar config-file ,
32059c94545Scubeselects all options and file-systems the user can possibly select,
32159c94545Scubeand defines an instance of every possible attachment as described by
32259c94545Scubethe kernel option definition files used by
32359c94545Scube.Ar config-file .
32459c94545Scube.Pp
32559c94545ScubeThe resulting configuration file is meant as a way to select all
32659c94545Scubepossible features in order to test that each of them compiles.
32714a82de8ScubeIt is not meant to result in a kernel binary that can run on any
32859c94545Scubehardware.
32959c94545Scube.Pp
33059c94545ScubeUnlike the first synopsis form, the provided
33159c94545Scube.Ar srcdir
33259c94545Scubeis relative to the current working directory.
33359c94545ScubeIn the first synopsis form, it is relative to the build directory.
3345ecc953bSthorpej.Sh SEE ALSO
3355ecc953bSthorpejThe SYNOPSIS portion of each device in section 4.
3365ecc953bSthorpej.\".Rs
3375ecc953bSthorpej.\" .%T "Building 4.4 BSD Systems with Config"
3385ecc953bSthorpej.\" .%T "Device Support in 4.4BSD"
3395ecc953bSthorpej.\".Re
340833d1509Sjoerg.Pp
3415ecc953bSthorpej.Xr options 4 ,
34293e398b3Scube.Xr config 5 ,
3435ecc953bSthorpej.Xr config 9
3445ecc953bSthorpej.Sh HISTORY
3455ecc953bSthorpejThe
3465ecc953bSthorpej.Nm
3475ecc953bSthorpejcommand appeared in
3485ecc953bSthorpej.Bx 4.1 .
3495ecc953bSthorpejIt was completely revised in
3505ecc953bSthorpej.Bx 4.4 .
3515ecc953bSthorpejThe
3525ecc953bSthorpej.Fl x
3535ecc953bSthorpejoption appeared in
3545ecc953bSthorpej.Nx 2.0 .
35514a82de8ScubeThe
35614a82de8Scube.Fl L
35714a82de8Scubeoption appeared in
35814a82de8Scube.Nx 5.0 .
359