1.\" $NetBSD: config.1,v 1.2 2005/06/05 18:59:35 wiz Exp $ 2.\" 3.\" Copyright (c) 1980, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" from: @(#)config.8 8.2 (Berkeley) 4/19/94 31.\" 32.Dd April 26, 2003 33.Dt CONFIG 1 34.Os 35.Sh NAME 36.Nm config 37.Nd build kernel compilation directories 38.Sh SYNOPSIS 39.Nm 40.Op Fl Ppv 41.Op Fl b Ar builddir 42.Op Fl s Ar srcdir 43.Op Ar config-file 44.Nm 45.Fl x 46.Op Ar kernel-file 47.Sh DESCRIPTION 48In its first synopsis form, 49.Nm 50creates a kernel build directory from the machine description file 51.Ar config-file , 52which describes the system to configure. 53.Pp 54There are several different ways to run the 55.Nm 56program. 57The traditional way is to run 58.Nm 59from the 60.Pa conf 61subdirectory of the machine-specific directory of the system source 62(usually 63.Pa /sys/arch/MACHINE/conf , 64where 65.Pa MACHINE 66is one of 67.Pa vax , 68.Pa hp300 , 69and so forth), and to specify as the 70.Ar config-file 71the name of a machine description file located in that directory. 72.Nm 73will by default create files in the directory 74.Pa ../compile/SYSTEMNAME , 75where 76.Pa SYSTEMNAME 77is the last path component of 78.Ar config-file . 79.Nm 80will assume that the top-level kernel source directory is located four 81directories above the build directory. 82.Pp 83Another way is to create the build directory yourself, place the 84machine description file in the build directory with the name 85.Pa CONFIG , 86and run 87.Nm 88from within the build directory without specifying a 89.Ar config-file . 90.Nm 91will then by default create files in the current directory. 92If you run 93.Nm 94this way, you must specify the location of the top-level kernel source 95directory using the 96.Fl s 97option or by using the 98.Dq Li source 99directive at the beginning of the machine description file. 100.Pp 101Finally, you can specify the build directory for 102.Nm 103and run it from anywhere. 104You can specify a build directory with the 105.Fl b 106option or by using the 107.Dq Li build 108directive at the beginning of the machine description file. 109You must specify the location of the top-level kernel source directory if you 110specify a build directory. 111.Pp 112If 113.Ar config-file 114is a binary kernel, 115.Nm 116will try to extract the configuration file embedded into it, which will 117be present if that kernel was built either with 118.Va INCLUDE_CONFIG_FILE 119or 120.Va INCLUDE_JUST_CONFIG 121options. 122This work mode requires you to manually specify a build directory with 123the 124.Fl b 125option, which implies the need to provide a source tree too. 126.Pp 127If the 128.Fl p 129option is supplied, 130.Pa .PROF 131is appended to the default compilation directory name, and 132.Nm 133acts as if the lines 134.Dq Li makeoptions PROF="-pg" 135and 136.Dq Li options GPROF 137appeared in the machine description file. 138This will build a system that includes profiling code; see 139.Xr kgmon 8 140and 141.Xr gprof 1 . 142The 143.Fl p 144flag is expected to be used for 145.Dq one-shot 146profiles of existing systems; for regular profiling, it is probably 147wiser to create a separate machine description file containing the 148.Li makeoptions 149line. 150.Pp 151The 152.Fl v 153option causes 154.Nm 155to be somewhat more verbose by enabling certain warning messages. 156.Pp 157The 158.Fl P 159option causes 160.Nm 161to pack locators, conserving some kernel memory. 162.Pp 163The old undocumented 164.Fl g 165flag is no longer supported. 166Instead, use 167.Dq Li makeoptions DEBUG="-g" 168and (typically) 169.Dq Li options KGDB . 170.Pp 171The output of 172.Nm 173consists of a number of files, principally 174.Pa ioconf.c , 175a description of I/O devices that may be attached to the system; and a 176.Pa Makefile , 177used by 178.Xr make 1 179in building the kernel. 180.Pp 181After running 182.Nm , 183it is wise to run 184.Dq Li make depend 185in the directory where the new makefile 186was created. 187.Nm 188prints a reminder of this when it completes. 189.Pp 190If 191.Nm 192stops due to errors, the problems reported should be corrected and 193.Nm 194should be run again. 195.Nm 196attempts to avoid changing the compilation directory 197if there are configuration errors, 198but this code is not well-tested, 199and some problems (such as running out of disk space) 200are unrecoverable. 201.Pp 202In its second synopsis form, 203.Nm 204takes the binary kernel 205.Ar kernel-file 206as its single argument (aside from the mandatory 207.Fl x 208flag), then extracts the embedded configuration file (if any) and 209writes it to standard output. 210If 211.Ar kernel-file 212is not given, 213.Pa /netbsd 214is used. 215Configuration data will be available if the given kernel was compiled 216with either 217.Va INCLUDE_CONFIG_FILE 218or 219.Va INCLUDE_JUST_CONFIG 220options. 221.Sh SEE ALSO 222The SYNOPSIS portion of each device in section 4. 223.\".Rs 224.\" .%T "Building 4.4 BSD Systems with Config" 225.\" .%T "Device Support in 4.4BSD" 226.\".Re 227.sp 228.Xr options 4 , 229.Xr config 9 230.Sh HISTORY 231The 232.Nm 233command appeared in 234.Bx 4.1 . 235It was completely revised in 236.Bx 4.4 . 237The 238.Fl x 239option appeared in 240.Nx 2.0 . 241