xref: /freebsd/usr.sbin/config/config.8 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
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.\" 4. 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.\"     @(#)config.8	8.2 (Berkeley) 4/19/94
29.\" $FreeBSD$
30.\"
31.Dd May 8, 2007
32.Dt CONFIG 8
33.Os
34.Sh NAME
35.Nm config
36.Nd build system configuration files
37.Sh SYNOPSIS
38.Nm
39.Op Fl CVgp
40.Op Fl I Ar path
41.Op Fl d Ar destdir
42.Op Fl s Ar srcdir
43.Ar SYSTEM_NAME
44.Nm
45.Op Fl x Ar kernel
46.Sh DESCRIPTION
47The
48.Nm
49utility builds a set of system configuration files from the file
50.Ar SYSTEM_NAME
51which describes
52the system to configure.
53A second file
54tells
55.Nm
56what files are needed to generate a system and
57can be augmented by configuration specific set of files
58that give alternate files for a specific machine
59(see the
60.Sx FILES
61section below).
62.Pp
63Available options and operands:
64.Bl -tag -width ".Ar SYSTEM_NAME"
65.It Fl V
66Print the
67.Nm
68version number.
69.It Fl C
70If the INCLUDE_CONFIG_FILE is present in a configuration file,
71kernel image will contain full configuration files included
72literally (preserving comments).
73This flag is kept for backward compatibility.
74.It Fl I Ar path
75Search in
76.Ar path
77for any file included by the
78.Ic include
79directive.  This option may be specified more than once.
80.It Fl d Ar destdir
81Use
82.Ar destdir
83as the output directory, instead of the default one.
84Note that
85.Nm
86does not append
87.Ar SYSTEM_NAME
88to the directory given.
89.It Fl s Ar srcdir
90Use
91.Ar srcdir
92as the source directory, instead of the default one.
93.It Fl m
94Print the MACHINE and MACHINE_ARCH values for this
95kernel and exit.
96.It Fl g
97Configure a system for debugging.
98.It Fl x Ar kernel
99Print kernel configuration file embedded into a kernel
100file.
101This option makes sense only if
102.Cd "options INCLUDE_CONFIG_FILE"
103entry was present in your configuration file.
104.It Fl p
105Configure a system for profiling; for example,
106.Xr kgmon 8
107and
108.Xr gprof 1 .
109If two or more
110.Fl p
111options are supplied,
112.Nm
113configures a system for high resolution profiling.
114.It Ar SYSTEM_NAME
115Specify the name of the system configuration file
116containing device specifications, configuration options
117and other system parameters for one system configuration.
118.El
119.Pp
120The
121.Nm
122utility should be run from the
123.Pa conf
124subdirectory of the system source (usually
125.Pa /sys/ Ns Va ARCH Ns Pa /conf ) ,
126where
127.Va ARCH
128represents one of the architectures supported by
129.Fx .
130The
131.Nm
132utility creates the directory
133.Pa ../compile/ Ns Ar SYSTEM_NAME
134or the one given with the
135.Fl d
136option
137as necessary and places all output files there.
138The output of
139.Nm
140consists of a number of files; for the
141.Tn i386 ,
142they are:
143.Pa Makefile ,
144used by
145.Xr make 1
146in building the system;
147header files,
148definitions of
149the number of various devices that will be compiled into the system.
150.Pp
151The
152.Nm
153utility looks for kernel sources in the directory
154.Pa ../..
155or the one given with the
156.Fl s
157option.
158.Pp
159After running
160.Nm ,
161it is necessary to run
162.Dq Li make depend
163in the directory where the new makefile
164was created.
165The
166.Nm
167utility prints a reminder of this when it completes.
168.Pp
169If any other error messages are produced by
170.Nm ,
171the problems in the configuration file should be corrected and
172.Nm
173should be run again.
174Attempts to compile a system that had configuration errors
175are likely to fail.
176.Sh DEBUG KERNELS
177Traditional
178.Bx
179kernels are compiled without symbols due to the heavy load on the
180system when compiling a
181.Dq debug
182kernel.
183A debug kernel contains complete symbols for all the source files, and
184enables an experienced kernel programmer to analyse the cause of a problem.
185The
186debuggers available prior to
187.Bx 4.4 Lite
188were able to find some information
189from a normal kernel;
190.Xr gdb 1
191provides very little support for normal kernels, and a debug kernel is needed
192for any meaningful analysis.
193.Pp
194For reasons of history, time and space, building a debug kernel is not the
195default with
196.Fx :
197a debug kernel takes up to 30% longer to build and
198requires about 30 MB of disk storage in the build directory, compared to about 6
199MB for a non-debug kernel.
200A debug kernel is about 11 MB in size, compared to
201about 2 MB for a non-debug kernel.
202This space is used both in the root file
203system and at run time in memory.
204Use the
205.Fl g
206option to build a debug kernel.
207With this option,
208.Nm
209causes two kernel files to be built in the kernel build directory:
210.Bl -bullet
211.It
212.Pa kernel.debug
213is the complete debug kernel.
214.It
215.Pa kernel
216is a copy of the kernel with the debug symbols stripped off.
217This is equivalent
218to the normal non-debug kernel.
219.El
220.Pp
221There is currently little sense in installing and booting from a debug kernel,
222since the only tools available which use the symbols do not run on-line.
223There
224are therefore two options for installing a debug kernel:
225.Bl -bullet
226.It
227.Dq Li "make install"
228installs
229.Pa kernel
230in the root file system.
231.It
232.Dq Li "make install.debug"
233installs
234.Pa kernel.debug
235in the root file system.
236.El
237.Sh FILES
238.Bl -tag -width ".Pa /sys/ Ns Va ARCH Ns Pa /compile/ Ns Ar SYSTEM_NAME" -compact
239.It Pa /sys/conf/files
240list of common files system is built from
241.It Pa /sys/conf/Makefile. Ns Va ARCH
242generic makefile for the
243.Va ARCH
244.It Pa /sys/conf/files. Ns Va ARCH
245list of
246.Va ARCH
247specific files
248.It Pa /sys/ Ns Va ARCH Ns Pa /compile/ Ns Ar SYSTEM_NAME
249default kernel build directory for system
250.Ar SYSTEM_NAME
251on
252.Va ARCH .
253.El
254.Sh SEE ALSO
255.Xr config 5
256.Pp
257The
258.Sx SYNOPSIS
259portion of each device in section 4.
260.Rs
261.%T "Building 4.3 BSD UNIX System with Config"
262.Re
263.Sh HISTORY
264The
265.Nm
266utility appeared in
267.Bx 4.1 .
268.Pp
269Before support for
270.Fl x
271was introduced,
272.Cd "options INCLUDE_CONFIG_FILE"
273included entire configuration file that used to be embedded in
274the new kernel.
275This meant that
276.Xr strings 1
277could be used to extract it from a kernel:
278to extract the configuration information, you had to use
279the command:
280.Pp
281.Dl "strings -n 3 kernel | sed -n 's/^___//p'"
282.Sh BUGS
283The line numbers reported in error messages are usually off by one.
284