1.\" Copyright (c) 2003 Joseph Koshy 2.\" 3.\" Redistribution and use in source and binary forms, with or without 4.\" modification, are permitted provided that the following conditions 5.\" are met: 6.\" 1. Redistributions of source code must retain the above copyright 7.\" notice, this list of conditions and the following disclaimer. 8.\" 2. Redistributions in binary form must reproduce the above copyright 9.\" notice, this list of conditions and the following disclaimer in the 10.\" documentation and/or other materials provided with the distribution. 11.\" 12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22.\" SUCH DAMAGE. 23.\" 24.\" $FreeBSD$ 25.\" 26.Dd December 3, 2005 27.Dt CONFIG 5 28.Os 29.Sh NAME 30.Nm config 31.Nd kernel configuration file format 32.Sh DESCRIPTION 33A kernel configuration file specifies the configuration of a 34.Fx 35kernel. 36It is processed by 37.Xr config 8 38to create a build environment where a kernel may be built using 39.Xr make 1 . 40.Ss Lexical Structure 41A kernel configuration file comprises a sequence of specification 42directives. 43.Pp 44A specification directive starts with a keyword at the beginning 45of the line and is followed by additional parameters. 46.Pp 47A specification directive may be terminated by a semicolon 48.Ql \&; 49or by a newline. 50Long input lines may be broken into shorter lines by starting the 51second and subsequent lines with a white space character. 52.Pp 53Case is significant, 54.Dq Li machine 55and 56.Dq Li MACHINE 57are different tokens. 58.Pp 59A double quote character 60.Ql \[dq] 61starts a quoted string. 62All characters up to the next quote character form the value 63of the quoted string. 64A 65.Ql \[dq] 66character may be inserted into a quoted string by 67using the sequence 68.Ql \e\[dq] . 69.Pp 70Numbers are specified using 71.Tn C Ns -style 72syntax. 73.Pp 74A 75.Ql # 76character starts a comment; all characters from the 77.Ql # 78character till the end of the current line are ignored. 79.Pp 80Whitespace between tokens is ignored, except inside quoted strings. 81Whitespace following a comment line is ignored. 82.Ss Configuration Directives 83Kernel configuration directives may appear in any order 84in a kernel configuration file. 85Directives are processed in order of appearance with subsequent 86directive lines overriding the effect of prior ones. 87.Pp 88The list of keywords and their meanings are as follows: 89.Bl -tag -width indent -compact 90.\" -------- CPU -------- 91.Pp 92.It Ic cpu Ar cputype 93Specify the CPU this kernel will run on. 94There can be more than one 95.Ic cpu 96directive in a configuration file. 97The allowed list of CPU names is architecture specific and is 98defined in the file 99.Pa sys/conf/options. Ns Aq Ar arch . 100.\" -------- DEVICE -------- 101.Pp 102.It Ic device Ar name Op , Ar name Op ... 103.It Ic devices Ar name Op , Ar name Op ... 104Configures the specified devices 105for inclusion into the kernel image. 106Devices that are common to all architectures are 107defined in the file 108.Pa sys/conf/files . 109Devices that are specific to architecture 110.Ar arch 111are defined in the file 112.Pa sys/conf/files. Ns Aq Ar arch . 113.\" -------- ENV -------- 114.Pp 115.It Ic env Ar filename 116Specifies a filename containing a kernel environment definition. 117The kernel normally uses an environment prepared for it at boot time 118by 119.Xr loader 8 . 120This directive makes the kernel ignore the boot environment and use 121the compiled-in environment instead. 122.Pp 123This directive is useful for setting kernel tunables in 124embedded environments that do not start from 125.Xr loader 8 . 126.\" -------- FILES -------- 127.Pp 128.It Ic files Ar filename 129Specifies a file containing a list of files specific to that kernel 130configuration file (a la 131.Pa files. Ns Aq Ar arch ) . 132.\" -------- HINTS -------- 133.Pp 134.It Ic hints Ar filename 135Specifies a file to load a static device configuration specification 136from. 137From 138.Fx 5.0 139onwards, the kernel reads the system's device configuration at boot 140time (see 141.Xr device.hints 5 ) . 142This directive configures the kernel to use the static device configuration 143listed in 144.Ar filename . 145The file 146.Ar filename 147must conform to the syntax specified by 148.Xr device.hints 5 . 149Multiple hints lines are allowed. 150The resulting hints will be the files concatenated in the order of appearance. 151.\" -------- IDENT -------- 152.Pp 153.It Ic ident Ar name 154Set the kernel name to 155.Ar name . 156At least one 157.Ic ident 158directive is required. 159.\" -------- INCLUDE -------- 160.Pp 161.It Ic include Ar filename 162Read subsequent text from file 163.Ar filename 164and return to the current file after 165.Ar filename 166is successfully processed. 167.\" -------- MACHINE -------- 168.Pp 169.It Ic machine Ar arch Op Ar cpuarch 170Specifies the architecture of the machine the kernel is being 171compiled for. 172Legal values for 173.Ar arch 174include: 175.Pp 176.Bl -tag -width ".Cm powerpc" -compact 177.It Cm alpha 178The DEC Alpha architecture. 179.It Cm arm 180The ARM architecture. 181.It Cm amd64 182The AMD x86-64 architecture. 183.It Cm i386 184The Intel x86 based PC architecture. 185.It Cm ia64 186The Intel IA64 architecture. 187.It Cm mips 188The MIPS architecture. 189.It Cm pc98 190The PC98 architecture. 191.It Cm powerpc 192The IBM PowerPC architecture. 193.It Cm sparc64 194The Sun Sparc64 architecture. 195.El 196.Pp 197If argument 198.Ar cpuarch 199is specified, it points 200.Xr config 8 201to the cpu architecture of the machine. 202Currently the 203.Cm pc98 204architecture requires its cpu architecture 205to be set to 206.Cm i386 . 207When 208.Ar cpuarch 209is not specified, it is assumed to be the same as 210.Ar arch . 211.Ar arch 212corresponds to MACHINE. 213.Ar cpuarch 214corresponds to MACHINE_ARCH. 215.Pp 216A kernel configuration file may have only one 217.Ic machine 218directive. 219.\" -------- MAKEOPTION -------- 220.Pp 221.It Ic makeoption Ar options 222.It Ic makeoptions Ar options 223Add 224.Ar options 225to the generated makefile. 226.Pp 227The 228.Ar options 229argument is a comma separated list of one or more option 230specifications. 231Each option specification has the form 232.Pp 233.D1 Ar MakeVariableName Ns Op = Ns Ar Value 234.Pp 235and results in the appropriate 236.Xr make 1 237variable definition being inserted into the generated makefile. 238If only the name of the 239.Xr make 1 240variable is specified, 241.Ar value 242is assumed to be the empty string. 243.Pp 244Example: 245.Bd -literal -offset indent -compact 246makeoptions MYMAKEOPTION="foobar" 247makeoptions MYNULLMAKEOPTION 248.Ed 249.\" -------- MAXUSERS -------- 250.Pp 251.It Ic maxusers Ar number 252This optional directive is used to configure the size 253of some kernel data structures. 254The parameter 255.Ar number 256can be 0 (the default) or an integer greater than or equal to 2. 257A value of 0 indicates that the kernel should configure 258its data structures according to the size of available 259physical memory. 260If auto configuration is requested, the kernel will set 261this tunable to a value between 32 and 384. 262.Pp 263As explained in 264.Xr tuning 7 , 265this tunable can also be set at boot time using 266.Xr loader 8 . 267.\" -------- NOCPU -------- 268.Pp 269.It Ic nocpu Ar cputype 270Remove the specified CPU 271from the list of previously selected CPUs. 272This directive can be used to cancel the effect of 273.Ic cpu 274directives in files included using 275.Ic include . 276.\" -------- NODEVICE -------- 277.Pp 278.It Ic nodevice Ar name Op , Ar name Op ... 279.It Ic nodevices Ar name Op , Ar name Op ... 280Remove the specified devices 281from the list of previously selected devices. 282This directive can be used to cancel the effects of 283.Ic device 284or 285.Ic devices 286directives in files included using 287.Ic include . 288.\" -------- NOMAKEOPTION -------- 289.Pp 290.It Ic nomakeoption Ar name 291.It Ic nomakeoptions Ar name 292Removes previously defined 293.Xr make 1 294option 295.Ar name 296from the kernel build. 297This directive can be used to cancel the effects of 298.Ic makeoption 299directives in files included using 300.Ic include . 301.\" -------- NOOPTION -------- 302.Pp 303.It Ic nooption Ar name Op , Ar name Op ... 304.It Ic nooptions Ar name Op , Ar name Op ... 305Remove the specified kernel options 306from the list of previously defined options. 307This directive can be used to cancel the effects of 308.Ic option 309or 310.Ic options 311directives in files included using 312.Ic include . 313.\" -------- OPTIONS -------- 314.Pp 315.It Ic option Ar optionspec Op , Ar optionspec Op ... 316.It Ic options Ar optionspec Op , Ar optionspec Op ... 317Add compile time kernel options to the kernel build. 318Each option specification has the form 319.Pp 320.D1 Ar name Ns Op = Ns Ar value 321.Pp 322If 323.Ar value 324is not specified, it is assumed to be 325.Dv NULL . 326Options common to all architectures are specified in 327the file 328.Pa sys/conf/options . 329Options specific to architecture 330.Ar arch 331are specified in the file 332.Pa sys/conf/options. Ns Aq Ar arch . 333.\" -------- PROFILE -------- 334.Pp 335.It Ic profile Ar number 336Enables kernel profiling if 337.Ar number 338is non-zero. 339If 340.Ar number 341is 2 or greater, the kernel is configured for 342high-resolution profiling. 343Kernels can also be built for profiling using the 344.Fl p 345option to 346.Xr config 8 . 347.El 348.Ss Obsolete Directives 349The following kernel configuration directives are obsolete. 350.Bl -tag -width indent 351.\" -------- CONFIG -------- 352.Pp 353.It Ic config 354This directive was used to specify the device to be used for the root 355file system. 356From 357.Fx 4.0 358onwards, this information is passed to a booting kernel by 359.Xr loader 8 . 360.El 361.Sh FILES 362.Bl -tag -width ".Pa sys/conf/Makefile. Ns Ar arch" -compact 363.It Pa sys/compile/ Ns Ar NAME 364Compile directory created from a kernel configuration. 365.It Pa sys/conf/Makefile. Ns Ar arch 366.Pa Makefile 367fragments for architecture 368.Ar arch . 369.It Pa sys/conf/files 370Devices common to all architectures. 371.It Pa sys/conf/files. Ns Ar arch 372Devices for architecture 373.Ar arch . 374.It Pa sys/conf/options 375Options common to all architectures. 376.It Pa sys/conf/options. Ns Ar arch 377Options for architecture 378.Ar arch . 379.El 380.Sh SEE ALSO 381.Xr kenv 1 , 382.Xr make 1 , 383.Xr device.hints 5 , 384.Xr loader.conf 5 , 385.Xr config 8 , 386.Xr kldload 8 , 387.Xr loader 8 388.Rs 389.%T "Building 4.4BSD Kernels with Config" 390.%A "Samuel J. Leffler" 391.%A "Michael J. Karels" 392.Re 393.Sh HISTORY 394The 395.Xr config 8 396utility first appeared in 397.Bx 4.1 , 398and was subsequently revised in 399.Bx 4.4 . 400.Pp 401The kernel configuration mechanism changed further in 402.Fx 4.0 403and 404.Fx 5.0 , 405moving toward an architecture supporting dynamic kernel 406configuration. 407