1 .\" Copyright (c) 1983, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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 .\" 3. 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.
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
28 .\" @(#)6.t 8.1 (Berkeley) 6/8/93
31 .\".ds RH "Adding New Devices
34 ADDING NEW SYSTEM SOFTWARE
36 This section is not for the novice, it describes
37 some of the inner workings of the configuration process as
38 well as the pertinent parts of the system autoconfiguration process.
39 It is intended to give
40 those people who intend to install new device drivers and/or
41 other system facilities sufficient information to do so in the
42 manner which will allow others to easily share the changes.
44 This section is broken into four parts:
46 general guidelines to be followed in modifying system code,
48 how to add non-standard system facilities to 4.4BSD,
50 how to add a device driver to 4.4BSD, and
54 If you wish to make site-specific modifications to the system
55 it is best to bracket them with
61 to allow your source to be easily distributed to others, and
62 also to simplify \fIdiff\fP\|(1) listings. If you choose not
63 to use a source code control system (e.g. SCCS, RCS), and
64 perhaps even if you do, it is
65 recommended that you save the old code with something
72 We try to isolate our site-dependent code in individual files
73 which may be configured with pseudo-device specifications.
75 Indicate machine-specific code with ``#ifdef vax'' (or other machine,
77 4.4BSD underwent extensive work to make it extremely portable to
78 machines with similar architectures\- you may someday find
79 yourself trying to use a single copy of the source code on
82 Adding non-standard system facilities
84 This section considers the work needed to augment
86 data base files for non-standard system facilities.
88 uses a set of files that list the source modules that may be required
89 when building a system.
90 The data bases are taken from the directory in which
92 is run, normally /sys/conf.
93 Three such files may be used:
98 The first is common to all systems,
99 the second contains files unique to a single machine type,
100 and the third is an optional list of modules for use on a specific machine.
101 This last file may override specifications in the first two.
104 file has grown somewhat complex over time. Entries are normally of
109 \fIdir/source.c\fP \fItype\fP \fIoption-list\fP \fImodifiers\fP
115 \fIvaxuba/foo.c\fP \fBoptional\fP foo \fBdevice-driver\fP
123 Files marked as standard are included in all system configurations.
124 Optional file specifications include a list of one or more system
125 options that together require the inclusion of this module.
126 The options in the list may be either names of devices that may
127 be in the configuration file,
128 or the names of system options that may be defined.
129 An optional file may be listed multiple times with different options;
130 if all of the options for any of the entries are satisfied,
131 the module is included.
133 If a file is specified as a
135 any special compilation options for device drivers will be invoked.
136 On the VAX this results in the use of the
138 option for the C optimizer. This is required when pointer references
139 are made to memory locations in the VAX I/O address space.
141 Two other optional keywords modify the usage of the file.
143 understands that certain files are used especially for
144 kernel profiling. These files are indicated in the
148 keyword. For example, the current profiling subroutines
149 are sequestered off in a separate file with the following
154 \fIsys/subr_mcount.c\fP \fBoptional\fP \fBprofiling-routine\fP
161 not to compile the source file with the
165 The second keyword which can be of use is the
169 to compile the indicated module with the global configuration
170 parameters. This allows certain modules, such as
172 to size system data structures based on the maximum number
173 of users configured for the system.
175 Adding device drivers to 4.4BSD
179 have been designed to easily allow new device support to be added.
180 The system source directories are organized as follows:
184 /sys/h machine independent include files
185 /sys/sys machine-independent system source files
186 /sys/conf site configuration files and basic templates
187 /sys/net network-protocol-independent, but network-related code
188 /sys/netinet DARPA Internet code
189 /sys/netimp IMP support code
190 /sys/netns Xerox NS code
191 /sys/vax VAX-specific mainline code
192 /sys/vaxif VAX network interface code
193 /sys/vaxmba VAX MASSBUS device drivers and related code
194 /sys/vaxuba VAX UNIBUS device drivers and related code
198 Existing block and character device drivers for the VAX
199 reside in ``/sys/vax'', ``/sys/vaxmba'', and ``/sys/vaxuba''. Network
200 interface drivers reside in ``/sys/vaxif''. Any new device
201 drivers should be placed in the appropriate source code directory
202 and named so as not to conflict with existing devices.
203 Normally, definitions for things like device registers are placed in
204 a separate file in the same directory. For example, the ``dh''
205 device driver is named ``dh.c'' and its associated include file is
208 Once the source for the device driver has been placed in a directory,
209 the file ``/sys/conf/files.machine'', and possibly
210 ``/sys/conf/devices.machine'' should be modified. The
212 files in the conf directory contain a line for each C source or binary-only
213 file in the system. Those files which are machine independent are
214 located in ``/sys/conf/files,'' while machine specific files
215 are in ``/sys/conf/files.machine.'' The ``devices.machine'' file
216 is used to map device names to major block device numbers. If the device
217 driver being added provides support for a new disk
218 you will want to modify this file (the format is obvious).
220 In addition to including the driver in the
222 file, it must also be added to the device configuration tables. These
223 are located in ``/sys/vax/conf.c'', or similar for machines other than
224 the VAX. If you don't understand what to add to this file, you should
225 study an entry for an existing driver.
226 Remember that the position in the
227 device table specifies the major device number.
228 The block major number is needed in the ``devices.machine'' file
229 if the device is a disk.