xref: /openbsd-src/share/man/man5/files.conf.5 (revision e746f150bd805c1914008308dbffd2670f534d6f)
1*e746f150Sjmc.\"	$OpenBSD: files.conf.5,v 1.8 2003/09/05 07:13:59 jmc Exp $
29de8d1bdSmiod.\"
39de8d1bdSmiod.\" Copyright (c) 2002 Miodrag Vallat.
49de8d1bdSmiod.\" All rights reserved.
59de8d1bdSmiod.\"
69de8d1bdSmiod.\" Redistribution and use in source and binary forms, with or without
79de8d1bdSmiod.\" modification, are permitted provided that the following conditions
89de8d1bdSmiod.\" are met:
99de8d1bdSmiod.\" 1. Redistribution of source code must retain the above copyright
109de8d1bdSmiod.\"    notice, this list of conditions and the following disclaimer.
119de8d1bdSmiod.\" 2. Redistributions in binary form must reproduce the above copyright
129de8d1bdSmiod.\"    notice, this list of conditions and the following disclaimer in the
139de8d1bdSmiod.\"    documentation and/or other materials provided with the distribution.
149de8d1bdSmiod.\"
159de8d1bdSmiod.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
169de8d1bdSmiod.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
179de8d1bdSmiod.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
189de8d1bdSmiod.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
199de8d1bdSmiod.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
209de8d1bdSmiod.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
219de8d1bdSmiod.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
229de8d1bdSmiod.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
239de8d1bdSmiod.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
249de8d1bdSmiod.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
259de8d1bdSmiod.\"
269de8d1bdSmiod.\"
279de8d1bdSmiod.Dd October 8, 2002
289de8d1bdSmiod.Dt FILES.CONF 5
299de8d1bdSmiod.Os
309de8d1bdSmiod.Sh NAME
319de8d1bdSmiod.Nm files.conf
329de8d1bdSmiod.Nd rules base for the config utility
339de8d1bdSmiod.Sh DESCRIPTION
349de8d1bdSmiodThe various
35*e746f150Sjmc.Pa files.*\&
369de8d1bdSmiodfiles located in the kernel source tree
379de8d1bdSmiodcontain all the necessary information needed by
389de8d1bdSmiod.Xr config 8
399de8d1bdSmiodto parse a kernel configuration file and determine the list of files to
409de8d1bdSmiodcompile.
419de8d1bdSmiod.Sh SYNTAX
429de8d1bdSmiodThe
43*e746f150Sjmc.Pa files.*\&
449de8d1bdSmiodrules base are simple, human-readable, text files.
459de8d1bdSmiodEmpty lines, as well as text prefixed by the
463c407b27Sjmc.Dq #
479de8d1bdSmiodcharacter, are ignored.
489de8d1bdSmiod.\"
499de8d1bdSmiod.Ss Device tree concept
509de8d1bdSmiod.\"
519de8d1bdSmiodThe
529de8d1bdSmiod.Ox
539de8d1bdSmiodkernel
549de8d1bdSmiod.Dq sees
559de8d1bdSmiodthe various devices as a hierarchical tree, where the various devices
569de8d1bdSmiod.Dq attach
579de8d1bdSmiodto parent entities, which can either be physical devices themselves
589de8d1bdSmiod.Pq such as a computer bus ,
599de8d1bdSmiodor logical entities, designed to make the driver code simpler.
609de8d1bdSmiodUsually, the top-most devices are attached to the pseudo-device
619de8d1bdSmiod.Dq mainbus ,
62a3d129fcSderaadtwhich is itself reported as attached to a fictitious
639de8d1bdSmiod.Dq root
649de8d1bdSmiodnode.
659de8d1bdSmiodThere is no restriction on the
66a3d129fcSderaadt.Dq children
679de8d1bdSmioda device node may have;
68a3d129fcSderaadtsome device drivers can attach themselves to different kinds of parent devices.
699de8d1bdSmiodFor example, the logical
709de8d1bdSmiod.Xr scsibus 4
719de8d1bdSmioddevice can either attach at an
729de8d1bdSmiod.Tn SCSI
739de8d1bdSmiodcontroller device, or at the logical
749de8d1bdSmiod.Xr atapiscsi 4
759de8d1bdSmiodbus.
769de8d1bdSmiod.\"
779de8d1bdSmiod.Ss Locators
789de8d1bdSmiod.\"
799de8d1bdSmiodSome device attachments need to provide attachment information.
809de8d1bdSmiodFor example, an
819de8d1bdSmiod.Xr isa 4
82*e746f150Sjmcdevice will use a range of I/O ports, one or more DMA channels, and one
839de8d1bdSmiodinterrupt vector.
849de8d1bdSmiodThis attachment information is known as the
859de8d1bdSmiod.Dq locators
869de8d1bdSmiodfor the device.
879de8d1bdSmiodMost of the busses support default values for unspecified locators, for devices
889de8d1bdSmiodthat either do not require them
899de8d1bdSmiod.Po
909de8d1bdSmiodsuch as
919de8d1bdSmiod.Xr isa 4
929de8d1bdSmiodcards not using interrupts
939de8d1bdSmiod.Pc ,
949de8d1bdSmiodor which can autoconfigure themselves
95a3d129fcSderaadt.Po
96a3d129fcSderaadtsuch as
97b6407f16Smiod.Xr pci 4
98a3d129fcSderaadtdevices
99a3d129fcSderaadt.Pc .
1009de8d1bdSmiod.Pp
1019de8d1bdSmiodAttachment lines in the kernel configuration file must match the locators of
1029de8d1bdSmiodthe device they are attaching to.
1039de8d1bdSmiodFor example, given
104*e746f150Sjmc.Bd -literal -offset indent
105*e746f150Sjmcdefine pci {[dev = -1], [function = -1]}
106*e746f150Sjmc.Ed
107*e746f150Sjmc.Pp
1089de8d1bdSmiodin the rules files, the following kernel configuration lines are valid:
109*e746f150Sjmc.Bd -literal -offset indent
110*e746f150Sjmcpciknob0 at pci? dev 2 function 42 # use fixed values
111*e746f150Sjmcpciknob* at pci? dev ? function ?  # use default values
112*e746f150Sjmcpciknob* at pci?                   # use default locators
113*e746f150Sjmc.Ed
114a3d129fcSderaadt.Pp
1159de8d1bdSmiodbut the following are not:
116*e746f150Sjmc.Bd -literal -offset indent
117*e746f150Sjmcpciknob* at pci? trick ? treat ?               # unknown locators
118*e746f150Sjmcpciknob* at pci? dev ? function ? usefulness ? # unknown locators
119*e746f150Sjmc.Ed
1209de8d1bdSmiod.\"
1219de8d1bdSmiod.Ss Attributes
1229de8d1bdSmiod.\"
1239de8d1bdSmiodThe syntax
124*e746f150Sjmc.Pp
125*e746f150Sjmc.Dl define attribute
126*e746f150Sjmc.Pp
1279de8d1bdSmioddefines a simple attribute, which can be later used to factorize
1289de8d1bdSmiodcode dependencies.
129a3d129fcSderaadtAn attachment-like attribute will also require locators to be specified,
130a3d129fcSderaadtsuch as
131*e746f150Sjmc.Pp
132*e746f150Sjmc.Dl define attribute {}
133*e746f150Sjmc.Pp
1349de8d1bdSmiodif no locators are necessary, or
135*e746f150Sjmc.Pp
136*e746f150Sjmc.Dl define attribute {[locator1 = default1], [locator2 = default2]}
137*e746f150Sjmc.Pp
1389de8d1bdSmiodif locators are provided.
1399de8d1bdSmiod.\"
1409de8d1bdSmiod.Ss Devices
1419de8d1bdSmiod.\"
1429de8d1bdSmiodFor simple device attachment, the syntax
143*e746f150Sjmc.Pp
144*e746f150Sjmc.Dl define device {}
145*e746f150Sjmc.Pp
1469de8d1bdSmioddefines a simple device, with no locators.
1479de8d1bdSmiodIf locators are necessary, they are specified as:
148*e746f150Sjmc.Pp
149*e746f150Sjmc.Dl define device {[locator1 = default1], [locator2 = default2]}
150*e746f150Sjmc.Pp
1519de8d1bdSmiodA device can also reference an attribute with locators.
1529de8d1bdSmiodThis is in fact a dependency rule.
1539de8d1bdSmiodFor example,
1549de8d1bdSmiod.Pa sys/dev/conf/files
1559de8d1bdSmioddefines the following attribute for
1569de8d1bdSmiod.Tn SCSI
1579de8d1bdSmiodcontrollers:
158*e746f150Sjmc.Pp
159*e746f150Sjmc.Dl define scsi {}			# no locators
160*e746f150Sjmc.Pp
1619de8d1bdSmiodand
1629de8d1bdSmiod.Tn SCSI
1639de8d1bdSmioddrivers can then be defined as
164*e746f150Sjmc.Pp
165*e746f150Sjmc.Dl define scsictrl: scsi
166*e746f150Sjmc.Pp
1679de8d1bdSmiodA device may depend on as many attributes as necessary:
168*e746f150Sjmc.Pp
169*e746f150Sjmc.Dl define complexdev: simpledev, otherdev, specialattribute
170*e746f150Sjmc.Pp
1719de8d1bdSmiod.\"
1729de8d1bdSmiod.Ss Pseudo devices
1739de8d1bdSmiod.\"
1749de8d1bdSmiodPseudo device are defined as regular devices, except that they do not need
1759de8d1bdSmiodlocators, and use a different keyword:
176*e746f150Sjmc.Bd -literal -offset indent
177*e746f150Sjmcpseudo-device loop: inet
178*e746f150Sjmcpseudo-device ksyms
179*e746f150Sjmc.Ed
180*e746f150Sjmc.Pp
181a3d129fcSderaadtdefine, respectively, the loopback network interface and the kernel symbols
1829de8d1bdSmiodpseudo-device.
1839de8d1bdSmiod.\"
1849de8d1bdSmiod.Ss Device attachment rules
1859de8d1bdSmiod.\"
1869de8d1bdSmiodDue to the tree structure of the device nodes, every device but the pseudo
1879de8d1bdSmioddevices need to attach to some parent node.
1889de8d1bdSmiodA device driver has to specify to which parents it can attach, with the
1899de8d1bdSmiodfollowing syntax:
190*e746f150Sjmc.Pp
191*e746f150Sjmc.Dl attach device at parent, parent2, parent3
192*e746f150Sjmc.Pp
1939de8d1bdSmiodwhich lists all the parent attributes a device may attach to.
1949de8d1bdSmiodFor example, if a device is specified as:
195*e746f150Sjmc.Bd -literal -offset indent
196*e746f150Sjmcdevice smartknob: bells, whistles
197*e746f150Sjmcattach smartknob at brainbus
198*e746f150Sjmc.Ed
199*e746f150Sjmc.Pp
2009de8d1bdSmiodthen a
201*e746f150Sjmc.Pp
202*e746f150Sjmc.Dl smartknob* at brainbus?
203*e746f150Sjmc.Pp
2049de8d1bdSmiodconfiguration file line is valid, while a
205*e746f150Sjmc.Pp
206*e746f150Sjmc.Dl smartknob* at dumbbus?
207*e746f150Sjmc.Pp
2089de8d1bdSmiodis not.
2099de8d1bdSmiod.Pp
2109de8d1bdSmiodIf a device supports attachments to multiple parents, using different
2119de8d1bdSmiod.Dq glue
2129de8d1bdSmiodroutines every time, the following syntax specifies the details:
213*e746f150Sjmc.Bd -literal -offset indent
214*e746f150Sjmcattach device at parent with device_parent_glue
215*e746f150Sjmcattach device at parent2 with device_parent2_glue
216*e746f150Sjmc.Ed
217*e746f150Sjmc.Pp
2189de8d1bdSmiodand will define more required attributes, depending on the kernel
2199de8d1bdSmiodconfiguration file's contents.
2209de8d1bdSmiod.\"
2219de8d1bdSmiod.Ss Rule file inclusion
2229de8d1bdSmiod.\"
2239de8d1bdSmiodIt is possible to include other rules files anywhere in a file, using the
2249de8d1bdSmiod.Dq include
2259de8d1bdSmiodkeyword:
226*e746f150Sjmc.Pp
227*e746f150Sjmc.Dl include \&"dev/pci/files.pci\&"
228*e746f150Sjmc.Pp
229b75b2251Sjmcwill include the rules for machine-independent PCI code.
2309de8d1bdSmiod.Pp
2319de8d1bdSmiodThe files
2329de8d1bdSmiod.Pa sys/arch/machine/conf/files.machine ,
2339de8d1bdSmiodfor every
2349de8d1bdSmiod.Dq machine
2359de8d1bdSmiodlisted in the machine line in the kernel configuration file, as well as
2369de8d1bdSmiod.Pa sys/conf/files ,
2379de8d1bdSmiodare always processed, and do not need to be included.
2389de8d1bdSmiod.\"
2399de8d1bdSmiod.Ss Attribute requirements
2409de8d1bdSmiod.\"
2419de8d1bdSmiodThe kernel configuration file description passed to
2429de8d1bdSmiod.Xr config 8
2439de8d1bdSmiodlists several compilation options, as well as several device definitions.
2449de8d1bdSmiodFrom this list,
2459de8d1bdSmiod.Xr config 8
2469de8d1bdSmiodwill build a list of required attributes, which are
247*e746f150Sjmc.Pp
248*e746f150Sjmc.Bl -bullet -offset indent -compact
2499de8d1bdSmiod.It
2509de8d1bdSmiodthe
2519de8d1bdSmiod.Dq option
2529de8d1bdSmiodlines, with the option name translated to lowercase (for example, an
2539de8d1bdSmiod.Dq option INET
2549de8d1bdSmiodline will produce the
2559de8d1bdSmiod.Dq inet
2569de8d1bdSmiodattribute).
2579de8d1bdSmiod.It
2589de8d1bdSmiodthe device and pseudo-device names, except for
2599de8d1bdSmiod.Dq root .
2609de8d1bdSmiod.El
2619de8d1bdSmiod.\"
2629de8d1bdSmiod.Ss Kernel file list
2639de8d1bdSmiod.\"
2649de8d1bdSmiodKernel source files are defined as:
265*e746f150Sjmc.Bd -literal -offset indent
266*e746f150Sjmcfile somewhere/somefile.c	dependencies	need-rules
267*e746f150Sjmc.Ed
268*e746f150Sjmc.Pp
2699de8d1bdSmiodIf the
2709de8d1bdSmiod.Dq dependencies
271a3d129fcSderaadtpart is empty, the file will always be compiled in.
2729de8d1bdSmiodThis is the case for the core kernel files.
2739de8d1bdSmiodOtherwise, the file will only be added to the list if the dependencies are met.
2749de8d1bdSmiodDependencies are based upon attributes and device names.
2759de8d1bdSmiodMultiple dependencies can be written using the
2769de8d1bdSmiod.Dq \&|
2779de8d1bdSmiodand
2783c407b27Sjmc.Dq &
2799de8d1bdSmiodoperators.
2809de8d1bdSmiodFor example, the line
281*e746f150Sjmc.Pp
282*e746f150Sjmc.Dl file netinet/ipsec_input.c	(inet | inet6) & ipsec
283*e746f150Sjmc.Pp
2849de8d1bdSmiodteaches
2859de8d1bdSmiod.Xr config 8
2869de8d1bdSmiodto only add
2879de8d1bdSmiod.Pa sys/netinet/ipsec_input.c
2889de8d1bdSmiodto the filelist if the
2899de8d1bdSmiod.Dq ipsec
2909de8d1bdSmiodattribute, and at least one of the
2919de8d1bdSmiod.Dq inet
2929de8d1bdSmiodand
2939de8d1bdSmiod.Dq inet6
294a3d129fcSderaadtattributes, are required.
2959de8d1bdSmiod.Pp
2969de8d1bdSmiodThe
2979de8d1bdSmiod.Dq need
2989de8d1bdSmiodrules can be empty, or one of the following keywords:
299*e746f150Sjmc.Pp
3009de8d1bdSmiod.Bl -tag -width "needs-count" -compact
301a3d129fcSderaadt.It Ar needs-flag
3029de8d1bdSmiodCreate an attribute header file, defining whether or not this
3039de8d1bdSmiodattribute is compiled in.
304a3d129fcSderaadt.It Ar needs-count
3059de8d1bdSmiodCreate an attribute header file, defining how many instances of this
3069de8d1bdSmiodattribute are to be compiled in.
3079de8d1bdSmiodThis rule is mostly used for pseudo-devices.
3089de8d1bdSmiod.El
3099de8d1bdSmiod.Pp
3109de8d1bdSmiodThe
3119de8d1bdSmiod.Dq attribute header files
3129de8d1bdSmiodare simple C header files created in the kernel compilation directory,
3139de8d1bdSmiodwith the name
3149de8d1bdSmiod.Pa attribute.h
3159de8d1bdSmiodand containing the following line:
316*e746f150Sjmc.Pp
317*e746f150Sjmc.Dl #define NATTRIBUTE	0
318*e746f150Sjmc.Pp
3199de8d1bdSmiodsubstituting the attribute name and its uppercase form, prefixed with
3209de8d1bdSmiodthe letter
3219de8d1bdSmiod.Dq N ,
3229de8d1bdSmiodto
3239de8d1bdSmiod.Dq attribute
3249de8d1bdSmiodand
3259de8d1bdSmiod.Dq NATTRIBUTE ,
3269de8d1bdSmiodrespectively.
3279de8d1bdSmiodFor a
3289de8d1bdSmiod.Dq needs-flag
3299de8d1bdSmiodrule, the value on the
3309de8d1bdSmiod.Dq #define
3319de8d1bdSmiodline is either 1 if the attribute is required, or 0 if it is not required.
3329de8d1bdSmiodFor a
3339de8d1bdSmiod.Dq needs-count
3349de8d1bdSmiodrule, the value is the number of device instances required, or 0
3359de8d1bdSmiodif the device is not required.
3369de8d1bdSmiod.Pp
3379de8d1bdSmiodAttribute files are created for every attribute listed with a
3389de8d1bdSmiod.Dq need
3399de8d1bdSmiodrule, even if it is never referenced from the kernel configuration file.
3409de8d1bdSmiod.\"
3419de8d1bdSmiod.Ss Miscellaneous items
3429de8d1bdSmiod.\"
3439de8d1bdSmiod.Pa sys/arch/machine/conf/files.machine
3449de8d1bdSmiodmust also supply the following special commands:
345*e746f150Sjmc.Bl -tag -width maxpartitions
346a3d129fcSderaadt.It Ar maxpartitions
3479de8d1bdSmiodDefines how many partitions are available on disk block devices, usually 16.
3489de8d1bdSmiodThis value is used by
3499de8d1bdSmiod.Xr config 8
3509de8d1bdSmiodto set up various device information structures.
351a3d129fcSderaadt.It Ar maxusers
3529de8d1bdSmiodDefines the bounds, and the default value, for the
3539de8d1bdSmiod.Dq maxusers
3549de8d1bdSmiodparameter in the kernel configuration file.
3559de8d1bdSmiodThe usual values are 2 8 64 ;
3569de8d1bdSmiod.Xr config 8
3579de8d1bdSmiodwill report an error if the
3589de8d1bdSmiod.Dq maxusers parameter
3599de8d1bdSmiodin the kernel configuration file does not fit in the specified range.
3609de8d1bdSmiod.El
3619de8d1bdSmiod.\"
3629de8d1bdSmiod.Sh FILES
363*e746f150Sjmc.Bl -tag -width XXX \" deliberately small width
3649de8d1bdSmiod.It Pa sys/arch/machine/conf/files.machine
3659de8d1bdSmiodRules for architecture-dependent files, for the
3669de8d1bdSmiod.Dq machine
3679de8d1bdSmiodarchitecture.
3689de8d1bdSmiod.It Pa sys/compat/emul/files.emul
3699de8d1bdSmiodRules for the
3709de8d1bdSmiod.Dq emul
371a3d129fcSderaadtoperating system or subsystem emulation.
3729de8d1bdSmiod.It Pa sys/dev/class/files.class
3739de8d1bdSmiodRules for the
3749de8d1bdSmiod.Dq class
3759de8d1bdSmiodclass of devices.
3769de8d1bdSmiod.It Pa sys/gnu/arch/i386/fpemul/files.fpemul
3779de8d1bdSmiodRules for the i386 GPL floating-point emulator.
3789de8d1bdSmiod.It Pa sys/scsi/files.scsi
3799de8d1bdSmiodRules for the common
3809de8d1bdSmiod.Tn SCSI
3819de8d1bdSmiodsubsystem.
3829de8d1bdSmiod.El
3839de8d1bdSmiod.Sh SEE ALSO
3849de8d1bdSmiod.Xr config 8
385