xref: /openbsd-src/share/man/man5/files.conf.5 (revision 89f5bfa7bc3bb246442817baf561e58b2ac59f67)
1*89f5bfa7Snaddy.\"	$OpenBSD: files.conf.5,v 1.23 2016/03/02 15:04:20 naddy 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.\"
27*89f5bfa7Snaddy.Dd $Mdocdate: March 2 2016 $
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
35e746f150Sjmc.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.
41a33cac81Sjmc.Pp
429de8d1bdSmiodThe
43e746f150Sjmc.Pa files.*\&
449de8d1bdSmiodrules base are simple, human-readable, text files.
459de8d1bdSmiodEmpty lines, as well as text prefixed by the
46a33cac81Sjmc.Sq #
479de8d1bdSmiodcharacter, are ignored.
48a33cac81Sjmc.Sh DEVICE TREE CONCEPT
499de8d1bdSmiodThe
509de8d1bdSmiod.Ox
519de8d1bdSmiodkernel
529de8d1bdSmiod.Dq sees
539de8d1bdSmiodthe various devices as a hierarchical tree, where the various devices
549de8d1bdSmiod.Dq attach
559de8d1bdSmiodto parent entities, which can either be physical devices themselves
569de8d1bdSmiod.Pq such as a computer bus ,
579de8d1bdSmiodor logical entities, designed to make the driver code simpler.
589de8d1bdSmiodUsually, the top-most devices are attached to the pseudo-device
599de8d1bdSmiod.Dq mainbus ,
60a3d129fcSderaadtwhich is itself reported as attached to a fictitious
619de8d1bdSmiod.Dq root
629de8d1bdSmiodnode.
639de8d1bdSmiodThere is no restriction on the
64a3d129fcSderaadt.Dq children
659de8d1bdSmioda device node may have;
66a3d129fcSderaadtsome device drivers can attach themselves to different kinds of parent devices.
679de8d1bdSmiodFor example, the logical
689de8d1bdSmiod.Xr scsibus 4
69a33cac81Sjmcdevice can either attach at a SCSI controller device,
70a33cac81Sjmcor at the logical
719de8d1bdSmiod.Xr atapiscsi 4
729de8d1bdSmiodbus.
73a33cac81Sjmc.Sh LOCATORS
749de8d1bdSmiodSome device attachments need to provide attachment information.
759de8d1bdSmiodFor example, an
769de8d1bdSmiod.Xr isa 4
77e746f150Sjmcdevice will use a range of I/O ports, one or more DMA channels, and one
789de8d1bdSmiodinterrupt vector.
799de8d1bdSmiodThis attachment information is known as the
809de8d1bdSmiod.Dq locators
819de8d1bdSmiodfor the device.
82df9fa2d9SjmcMost of the buses support default values for unspecified locators, for devices
839de8d1bdSmiodthat either do not require them
849de8d1bdSmiod.Po
859de8d1bdSmiodsuch as
869de8d1bdSmiod.Xr isa 4
879de8d1bdSmiodcards not using interrupts
889de8d1bdSmiod.Pc ,
899de8d1bdSmiodor which can autoconfigure themselves
90a3d129fcSderaadt.Po
91a3d129fcSderaadtsuch as
92b6407f16Smiod.Xr pci 4
93a3d129fcSderaadtdevices
94a3d129fcSderaadt.Pc .
959de8d1bdSmiod.Pp
969de8d1bdSmiodAttachment lines in the kernel configuration file must match the locators of
979de8d1bdSmiodthe device they are attaching to.
98a33cac81SjmcFor example:
99e746f150Sjmc.Bd -literal -offset indent
100e746f150Sjmcdefine pci {[dev = -1], [function = -1]}
101e746f150Sjmc.Ed
102e746f150Sjmc.Pp
103a33cac81SjmcWith the rule above,
104a33cac81Sjmcthe following kernel configuration lines are valid:
105e746f150Sjmc.Bd -literal -offset indent
106e746f150Sjmcpciknob0 at pci? dev 2 function 42 # use fixed values
107e746f150Sjmcpciknob* at pci? dev ? function ?  # use default values
108e746f150Sjmcpciknob* at pci?                   # use default locators
109e746f150Sjmc.Ed
110a3d129fcSderaadt.Pp
111a33cac81SjmcBut the following are not:
112e746f150Sjmc.Bd -literal -offset indent
113e746f150Sjmcpciknob* at pci? trick ? treat ?               # unknown locators
114e746f150Sjmcpciknob* at pci? dev ? function ? usefulness ? # unknown locators
115e746f150Sjmc.Ed
116a33cac81Sjmc.Sh ATTRIBUTES
117a33cac81SjmcThe following syntax defines a simple attribute,
118a33cac81Sjmcwhich can be later used to factorize code dependencies:
119e746f150Sjmc.Pp
120e746f150Sjmc.Dl define attribute
121e746f150Sjmc.Pp
122a33cac81SjmcAn attachment-like attribute will also require locators to be specified.
123a33cac81SjmcIf no locators are necessary:
124e746f150Sjmc.Pp
125e746f150Sjmc.Dl define attribute {}
126e746f150Sjmc.Pp
127a33cac81SjmcIf locators are provided:
128e746f150Sjmc.Pp
129e746f150Sjmc.Dl define attribute {[locator1 = default1], [locator2 = default2]}
130a33cac81Sjmc.Sh DEVICES
131a33cac81SjmcFor simple device attachment, the following syntax
132a33cac81Sjmcdefines a simple device, with no locators:
133e746f150Sjmc.Pp
13433e6cd54Stom.Dl device devicename {}
135e746f150Sjmc.Pp
1369de8d1bdSmiodIf locators are necessary, they are specified as:
137e746f150Sjmc.Pp
13833e6cd54Stom.Dl device devicename {[locator1 = default1], [locator2 = default2]}
139e746f150Sjmc.Pp
1409de8d1bdSmiodA device can also reference an attribute with locators.
1419de8d1bdSmiodThis is in fact a dependency rule.
1429de8d1bdSmiodFor example,
1433d530571Stdeval.Pa sys/conf/files
144a33cac81Sjmcdefines the following attribute for SCSI controllers:
145e746f150Sjmc.Pp
146e746f150Sjmc.Dl define scsi {}			# no locators
147e746f150Sjmc.Pp
148a33cac81SjmcAnd SCSI drivers can then be defined as:
149e746f150Sjmc.Pp
1507075b716Shshoexer.Dl device scsictrl: scsi
151e746f150Sjmc.Pp
1529de8d1bdSmiodA device may depend on as many attributes as necessary:
153e746f150Sjmc.Pp
1547075b716Shshoexer.Dl device complexdev: simpledev, otherdev, specialattribute
155a33cac81Sjmc.Sh PSEUDO DEVICES
156151b53bfSaanriotPseudo devices are defined as regular devices, except that they do not
157151b53bfSaanriotneed locators, and use a different keyword:
158e746f150Sjmc.Bd -literal -offset indent
159e746f150Sjmcpseudo-device loop: inet
160e746f150Sjmcpseudo-device ksyms
161e746f150Sjmc.Ed
162e746f150Sjmc.Pp
163a33cac81SjmcThe rules above define, respectively,
164a33cac81Sjmcthe loopback network interface and the kernel symbols pseudo-device.
165a33cac81Sjmc.Sh DEVICE ATTACHMENT RULES
1669de8d1bdSmiodDue to the tree structure of the device nodes, every device but the pseudo
1679de8d1bdSmioddevices need to attach to some parent node.
1689de8d1bdSmiodA device driver has to specify to which parents it can attach, with the
1699de8d1bdSmiodfollowing syntax:
170e746f150Sjmc.Pp
171e746f150Sjmc.Dl attach device at parent, parent2, parent3
172e746f150Sjmc.Pp
173a33cac81SjmcThe rule above lists all the parent attributes a device may attach to.
174a33cac81SjmcFor example, given the following:
175e746f150Sjmc.Bd -literal -offset indent
176e746f150Sjmcdevice smartknob: bells, whistles
177e746f150Sjmcattach smartknob at brainbus
178e746f150Sjmc.Ed
179e746f150Sjmc.Pp
180a33cac81SjmcThe following configuration line is then valid:
181e746f150Sjmc.Pp
182e746f150Sjmc.Dl smartknob* at brainbus?
183e746f150Sjmc.Pp
184a33cac81SjmcWhilst the following is not:
185e746f150Sjmc.Pp
186e746f150Sjmc.Dl smartknob* at dumbbus?
187e746f150Sjmc.Pp
1889de8d1bdSmiodIf a device supports attachments to multiple parents, using different
1899de8d1bdSmiod.Dq glue
1909de8d1bdSmiodroutines every time, the following syntax specifies the details:
191e746f150Sjmc.Bd -literal -offset indent
192e746f150Sjmcattach device at parent with device_parent_glue
193e746f150Sjmcattach device at parent2 with device_parent2_glue
194e746f150Sjmc.Ed
195e746f150Sjmc.Pp
196a33cac81SjmcThis will define more required attributes, depending on the kernel
1979de8d1bdSmiodconfiguration file's contents.
198a33cac81Sjmc.Sh RULE FILE INCLUSION
1999de8d1bdSmiodIt is possible to include other rules files anywhere in a file, using the
2009de8d1bdSmiod.Dq include
2019de8d1bdSmiodkeyword:
202e746f150Sjmc.Pp
203e746f150Sjmc.Dl include \&"dev/pci/files.pci\&"
204e746f150Sjmc.Pp
205a33cac81SjmcThe above rule will include the rules for machine-independent PCI code.
2069de8d1bdSmiod.Pp
2079de8d1bdSmiodThe files
2089de8d1bdSmiod.Pa sys/arch/machine/conf/files.machine ,
2099de8d1bdSmiodfor every
2109de8d1bdSmiod.Dq machine
2119de8d1bdSmiodlisted in the machine line in the kernel configuration file, as well as
2129de8d1bdSmiod.Pa sys/conf/files ,
2139de8d1bdSmiodare always processed, and do not need to be included.
214a33cac81Sjmc.Sh ATTRIBUTE REQUIREMENTS
2159de8d1bdSmiodThe kernel configuration file description passed to
2169de8d1bdSmiod.Xr config 8
2179de8d1bdSmiodlists several compilation options, as well as several device definitions.
2189de8d1bdSmiodFrom this list,
2199de8d1bdSmiod.Xr config 8
220a33cac81Sjmcwill build a list of required attributes, which are:
221e746f150Sjmc.Pp
222e746f150Sjmc.Bl -bullet -offset indent -compact
2239de8d1bdSmiod.It
224a33cac81SjmcThe
2259de8d1bdSmiod.Dq option
2269de8d1bdSmiodlines, with the option name translated to lowercase (for example, an
227bdd2cd72Sjmc.Dq option INET6
2289de8d1bdSmiodline will produce the
229bdd2cd72Sjmc.Dq inet6
2309de8d1bdSmiodattribute).
2319de8d1bdSmiod.It
232a33cac81SjmcThe device and pseudo-device names, except for
2339de8d1bdSmiod.Dq root .
2349de8d1bdSmiod.El
235a33cac81Sjmc.Sh KERNEL FILE LIST
2369de8d1bdSmiodKernel source files are defined as:
237e746f150Sjmc.Bd -literal -offset indent
238bfce9554Sderaadtfile file-list	dependencies	need-rules
239e746f150Sjmc.Ed
240e746f150Sjmc.Pp
241bfce9554Sderaadt.Dq file-list
242a33cac81Sjmctypically only specifies a single filename.
243a33cac81SjmcIf instead it contains a list of filenames separated by the
244a33cac81Sjmc.Sq \&|
245a33cac81Sjmccharacter,
246bfce9554Sderaadt.Xr config 8
247a33cac81Sjmcwill select the first file from the list which exists.
248bfce9554SderaadtIf
249bfce9554Sderaadt.Dq ${MACHINE_ARCH}
2503727a7fcSderaadtor
2513727a7fcSderaadt.Dq ${MACHINE}
252e0d38e3bStobiasis found in the filename, it will be substituted with the
2533727a7fcSderaadtrelevant base architecture name.
254bfce9554Sderaadt.Pp
2559de8d1bdSmiodIf the
2569de8d1bdSmiod.Dq dependencies
257a3d129fcSderaadtpart is empty, the file will always be compiled in.
2589de8d1bdSmiodThis is the case for the core kernel files.
2599de8d1bdSmiodOtherwise, the file will only be added to the list if the dependencies are met.
2609de8d1bdSmiodDependencies are based upon attributes and device names.
2619de8d1bdSmiodMultiple dependencies can be written using the
2629de8d1bdSmiod.Dq \&|
2639de8d1bdSmiodand
2643c407b27Sjmc.Dq &
2659de8d1bdSmiodoperators.
266a33cac81SjmcFor example:
267e746f150Sjmc.Pp
268e746f150Sjmc.Dl file netinet/ipsec_input.c	(inet | inet6) & ipsec
269e746f150Sjmc.Pp
270a33cac81SjmcThe above rule teaches
2719de8d1bdSmiod.Xr config 8
2729de8d1bdSmiodto only add
2739de8d1bdSmiod.Pa sys/netinet/ipsec_input.c
2749de8d1bdSmiodto the filelist if the
2759de8d1bdSmiod.Dq ipsec
2769de8d1bdSmiodattribute, and at least one of the
2779de8d1bdSmiod.Dq inet
2789de8d1bdSmiodand
2799de8d1bdSmiod.Dq inet6
280a3d129fcSderaadtattributes, are required.
2819de8d1bdSmiod.Pp
2829de8d1bdSmiodThe
2839de8d1bdSmiod.Dq need
2849de8d1bdSmiodrules can be empty, or one of the following keywords:
285e746f150Sjmc.Pp
2869de8d1bdSmiod.Bl -tag -width "needs-count" -compact
287a3d129fcSderaadt.It Ar needs-flag
2889de8d1bdSmiodCreate an attribute header file, defining whether or not this
2899de8d1bdSmiodattribute is compiled in.
290a3d129fcSderaadt.It Ar needs-count
2919de8d1bdSmiodCreate an attribute header file, defining how many instances of this
2929de8d1bdSmiodattribute are to be compiled in.
2939de8d1bdSmiodThis rule is mostly used for pseudo-devices.
2949de8d1bdSmiod.El
2959de8d1bdSmiod.Pp
2969de8d1bdSmiodThe
2979de8d1bdSmiod.Dq attribute header files
2989de8d1bdSmiodare simple C header files created in the kernel compilation directory,
2999de8d1bdSmiodwith the name
3009de8d1bdSmiod.Pa attribute.h
3019de8d1bdSmiodand containing the following line:
302e746f150Sjmc.Pp
303e746f150Sjmc.Dl #define NATTRIBUTE	0
304e746f150Sjmc.Pp
305a33cac81SjmcThis would substitute the attribute name and its uppercase form, prefixed with
3069de8d1bdSmiodthe letter
3079de8d1bdSmiod.Dq N ,
3089de8d1bdSmiodto
3099de8d1bdSmiod.Dq attribute
3109de8d1bdSmiodand
3119de8d1bdSmiod.Dq NATTRIBUTE ,
3129de8d1bdSmiodrespectively.
3139de8d1bdSmiodFor a
3149de8d1bdSmiod.Dq needs-flag
3159de8d1bdSmiodrule, the value on the
3169de8d1bdSmiod.Dq #define
3179de8d1bdSmiodline is either 1 if the attribute is required, or 0 if it is not required.
3189de8d1bdSmiodFor a
3199de8d1bdSmiod.Dq needs-count
3209de8d1bdSmiodrule, the value is the number of device instances required, or 0
3219de8d1bdSmiodif the device is not required.
3229de8d1bdSmiod.Pp
3239de8d1bdSmiodAttribute files are created for every attribute listed with a
3249de8d1bdSmiod.Dq need
3259de8d1bdSmiodrule, even if it is never referenced from the kernel configuration file.
326a33cac81Sjmc.Sh MISCELLANEOUS ITEMS
3279de8d1bdSmiod.Pa sys/arch/machine/conf/files.machine
3289de8d1bdSmiodmust also supply the following special commands:
329e746f150Sjmc.Bl -tag -width maxpartitions
330a3d129fcSderaadt.It Ar maxpartitions
3319de8d1bdSmiodDefines how many partitions are available on disk block devices, usually 16.
3329de8d1bdSmiodThis value is used by
3339de8d1bdSmiod.Xr config 8
3349de8d1bdSmiodto set up various device information structures.
335a3d129fcSderaadt.It Ar maxusers
3369de8d1bdSmiodDefines the bounds, and the default value, for the
3379de8d1bdSmiod.Dq maxusers
3389de8d1bdSmiodparameter in the kernel configuration file.
3399de8d1bdSmiodThe usual values are 2 8 64 ;
3409de8d1bdSmiod.Xr config 8
3419de8d1bdSmiodwill report an error if the
3429de8d1bdSmiod.Dq maxusers parameter
3439de8d1bdSmiodin the kernel configuration file does not fit in the specified range.
3449de8d1bdSmiod.El
3459de8d1bdSmiod.Sh FILES
346a33cac81Sjmc.Bl -tag -width Ds
3479de8d1bdSmiod.It Pa sys/arch/machine/conf/files.machine
3489de8d1bdSmiodRules for architecture-dependent files, for the
3499de8d1bdSmiod.Dq machine
3509de8d1bdSmiodarchitecture.
3519de8d1bdSmiod.It Pa sys/dev/class/files.class
3529de8d1bdSmiodRules for the
3539de8d1bdSmiod.Dq class
3549de8d1bdSmiodclass of devices.
3559de8d1bdSmiod.It Pa sys/scsi/files.scsi
356a33cac81SjmcRules for the common SCSI subsystem.
3579de8d1bdSmiod.El
3589de8d1bdSmiod.Sh SEE ALSO
3599de8d1bdSmiod.Xr config 8
360