xref: /freebsd/usr.sbin/config/config.8 (revision 9e2b87207ba1949f402e169416f63ab5cdbf3dd4)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd April 9, 2021
29.Dt CONFIG 8
30.Os
31.Sh NAME
32.Nm config
33.Nd build system configuration files
34.Sh SYNOPSIS
35.Nm
36.Op Fl CVgpv
37.Op Fl I Ar path
38.Op Fl d Ar destdir
39.Op Fl s Ar srcdir
40.Ar SYSTEM_NAME
41.Nm
42.Op Fl x Ar kernel
43.Sh DESCRIPTION
44The
45.Nm
46utility builds a set of system configuration files from the file
47.Ar SYSTEM_NAME
48which describes
49the system to configure.
50A second file
51tells
52.Nm
53what files are needed to generate a system and
54can be augmented by configuration specific set of files
55that give alternate files for a specific machine
56(see the
57.Sx FILES
58section below).
59.Pp
60Available options and operands:
61.Bl -tag -width "SYSTEM_NAME"
62.It Fl V
63Print the
64.Nm
65version number.
66.It Fl C
67If the INCLUDE_CONFIG_FILE is present in a configuration file,
68kernel image will contain full configuration files included
69literally (preserving comments).
70This flag is kept for backward compatibility.
71.It Fl I Ar path
72Search in
73.Ar path
74for any file included by the
75.Ic include
76directive.
77This option may be specified more than once.
78.It Fl d Ar destdir
79Use
80.Ar destdir
81as the output directory, instead of the default one.
82Note that
83.Nm
84does not append
85.Ar SYSTEM_NAME
86to the directory given.
87.It Fl s Ar srcdir
88Use
89.Ar srcdir
90as the source directory, instead of the default one.
91.It Fl m
92Print the MACHINE and MACHINE_ARCH values for this
93kernel and exit.
94.It Fl g
95Configure a system for debugging.
96.It Fl x Ar kernel
97Print kernel configuration file embedded into a kernel
98file.
99This option makes sense only if
100.Cd "options INCLUDE_CONFIG_FILE"
101entry was present in your configuration file.
102.It Fl v
103Turns on verbose output.
104.It Ar SYSTEM_NAME
105Specify the name of the system configuration file
106containing device specifications, configuration options
107and other system parameters for one system configuration.
108.El
109.Pp
110The
111.Nm
112utility should be run from the
113.Pa conf
114subdirectory of the system source (usually
115.Pa /sys/ Ns Va ARCH Ns Pa /conf ) ,
116where
117.Va ARCH
118represents one of the architectures supported by
119.Fx .
120The
121.Nm
122utility creates the directory
123.Pa ../compile/ Ns Ar SYSTEM_NAME
124or the one given with the
125.Fl d
126option
127as necessary and places all output files there.
128The output of
129.Nm
130consists of a number of files; for the
131.Tn i386 ,
132they are:
133.Pa Makefile ,
134used by
135.Xr make 1
136in building the system;
137header files,
138definitions of
139the number of various devices that will be compiled into the system.
140.Pp
141The
142.Nm
143utility looks for kernel sources in the directory
144.Pa ../..
145or the one given with the
146.Fl s
147option.
148.Pp
149After running
150.Nm ,
151it is necessary to run
152.Dq Li make depend
153in the directory where the new makefile
154was created.
155The
156.Nm
157utility prints a reminder of this when it completes.
158.Pp
159If any other error messages are produced by
160.Nm ,
161the problems in the configuration file should be corrected and
162.Nm
163should be run again.
164Attempts to compile a system that had configuration errors
165are likely to fail.
166.Sh DEBUG KERNELS
167Traditional
168.Bx
169kernels are compiled without symbols due to the heavy load on the
170system when compiling a
171.Dq debug
172kernel.
173A debug kernel contains complete symbols for all the source files, and
174enables an experienced kernel programmer to analyse the cause of a problem.
175The
176debuggers available prior to
177.Bx 4.4 Lite
178were able to find some information
179from a normal kernel;
180.Xr gdb 1 Pq Pa ports/devel/gdb
181provides very little support for normal kernels, and a debug kernel is needed
182for any meaningful analysis.
183.Pp
184For reasons of history, time and space, building a debug kernel is not the
185default with
186.Fx :
187a debug kernel takes up to 30% longer to build and
188requires about 30 MB of disk storage in the build directory, compared to about 6
189MB for a non-debug kernel.
190A debug kernel is about 11 MB in size, compared to
191about 2 MB for a non-debug kernel.
192This space is used both in the root file
193system and at run time in memory.
194Use the
195.Fl g
196option to build a debug kernel.
197With this option,
198.Nm
199causes two kernel files to be built in the kernel build directory:
200.Bl -bullet
201.It
202.Pa kernel.debug
203is the complete debug kernel.
204.It
205.Pa kernel
206is a copy of the kernel with the debug symbols stripped off.
207This is equivalent
208to the normal non-debug kernel.
209.El
210.Pp
211There is currently little sense in installing and booting from a debug kernel,
212since the only tools available which use the symbols do not run on-line.
213There
214are therefore two options for installing a debug kernel:
215.Bl -bullet
216.It
217.Dq Li "make install"
218installs
219.Pa kernel
220in the root file system.
221.It
222.Dq Li "make install.debug"
223installs
224.Pa kernel.debug
225in the root file system.
226.El
227.Sh FILES
228.Bl -tag -width "/sys/ARCH/compile/SYSTEM_NAME" -compact
229.It Pa /sys/conf/files
230list of common files system is built from
231.It Pa /sys/conf/Makefile . Ns Va ARCH
232generic makefile for the
233.Va ARCH
234.It Pa /sys/conf/files . Ns Va ARCH
235list of
236.Va ARCH
237specific files
238.It Pa /sys/ Ns Va ARCH Ns Pa /compile/ Ns Ar SYSTEM_NAME
239default kernel build directory for system
240.Ar SYSTEM_NAME
241on
242.Va ARCH .
243.El
244.Sh SEE ALSO
245.Xr config 5
246.Pp
247The
248.Sx SYNOPSIS
249portion of each device in section 4.
250.Rs
251.\" 4.4BSD SMM:2
252.%A S. J. Leffler
253.%A M. J. Karels
254.%T "Building 4.3 BSD UNIX System with Config"
255.%B 4.4BSD System Manager's Manual (SMM)
256.Re
257.Sh HISTORY
258The
259.Nm
260utility appeared in
261.Bx 4.1 .
262.Pp
263Before support for
264.Fl x
265was introduced,
266.Cd "options INCLUDE_CONFIG_FILE"
267included entire configuration file that used to be embedded in
268the new kernel.
269This meant that
270.Xr strings 1
271could be used to extract it from a kernel:
272to extract the configuration information, you had to use
273the command:
274.Pp
275.Dl "strings -n 3 kernel | sed -n 's/^___//p'"
276.Sh BUGS
277The line numbers reported in error messages are usually off by one.
278