6.t
来自「早期freebsd实现」· T 代码 · 共 240 行
T
240 行
.\" Copyright (c) 1983, 1993.\" The Regents of the University of California. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by the University of.\" California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)6.t 8.1 (Berkeley) 6/8/93.\".\".ds RH "Adding New Devices.ne 2i.NHADDING NEW SYSTEM SOFTWARE.PPThis section is not for the novice, it describessome of the inner workings of the configuration process aswell as the pertinent parts of the system autoconfiguration process.It is intended to givethose people who intend to install new device drivers and/orother system facilities sufficient information to do so in themanner which will allow others to easily share the changes..PPThis section is broken into four parts:.IP \(bu 3general guidelines to be followed in modifying system code,.IP \(bu 3how to add non-standard system facilities to 4.4BSD,.IP \(bu 3how to add a device driver to 4.4BSD, and.NH 2Modifying system code.PPIf you wish to make site-specific modifications to the systemit is best to bracket them with.DS#ifdef SITENAME\&...#endif.DEto allow your source to be easily distributed to others, andalso to simplify \fIdiff\fP\|(1) listings. If you choose notto use a source code control system (e.g. SCCS, RCS), andperhaps even if you do, it isrecommended that you save the old code with somethingof the form:.DS#ifndef SITENAME\&...#endif.DEWe try to isolate our site-dependent code in individual fileswhich may be configured with pseudo-device specifications..PPIndicate machine-specific code with ``#ifdef vax'' (or other machine,as appropriate).4.4BSD underwent extensive work to make it extremely portable tomachines with similar architectures\- you may someday findyourself trying to use a single copy of the source code onmultiple machines..NH 2Adding non-standard system facilities.PPThis section considers the work needed to augment .IR config 'sdata base files for non-standard system facilities..I Configuses a set of files that list the source modules that may be requiredwhen building a system.The data bases are taken from the directory in which.I configis run, normally /sys/conf.Three such files may be used:.IR files ,.IR files .machine,and.IR files .ident.The first is common to all systems,the second contains files unique to a single machine type,and the third is an optional list of modules for use on a specific machine.This last file may override specifications in the first two.The format of the .I filesfile has grown somewhat complex over time. Entries are normally ofthe form.IP.nf.DT\fIdir/source.c\fP \fItype\fP \fIoption-list\fP \fImodifiers\fP.LPfor example,.IP.nf.DT\fIvaxuba/foo.c\fP \fBoptional\fP foo \fBdevice-driver\fP.LPThe.I typeis one of.B standardor.BR optional .Files marked as standard are included in all system configurations.Optional file specifications include a list of one or more systemoptions that together require the inclusion of this module.The options in the list may be either names of devices that maybe in the configuration file,or the names of system options that may be defined.An optional file may be listed multiple times with different options;if all of the options for any of the entries are satisfied,the module is included..PPIf a file is specified as a.IR device-driver ,any special compilation options for device drivers will be invoked.On the VAX this results in the use of the.B \-ioption for the C optimizer. This is required when pointer referencesare made to memory locations in the VAX I/O address space..PPTwo other optional keywords modify the usage of the file..I Configunderstands that certain files are used especially forkernel profiling. These files are indicated in the.I filesfiles with a .I profiling-routinekeyword. For example, the current profiling subroutinesare sequestered off in a separate file with the followingentry:.IP.nf.DT\fIsys/subr_mcount.c\fP \fBoptional\fP \fBprofiling-routine\fP.fi.LPThe .I profiling-routinekeyword forces.I confignot to compile the source file with the .B \-pgoption..PPThe second keyword which can be of use is the.I config-dependentkeyword. This causes.I configto compile the indicated module with the global configurationparameters. This allows certain modules, such as.I machdep.cto size system data structures based on the maximum numberof users configured for the system..NH 2Adding device drivers to 4.4BSD.PPThe I/O system and.I confighave been designed to easily allow new device support to be added.The system source directories are organized as follows:.DS.TSlw(1.0i) l./sys/h machine independent include files/sys/sys machine-independent system source files/sys/conf site configuration files and basic templates/sys/net network-protocol-independent, but network-related code/sys/netinet DARPA Internet code/sys/netimp IMP support code/sys/netns Xerox NS code/sys/vax VAX-specific mainline code/sys/vaxif VAX network interface code/sys/vaxmba VAX MASSBUS device drivers and related code/sys/vaxuba VAX UNIBUS device drivers and related code.TE.DE.PPExisting block and character device drivers for the VAX reside in ``/sys/vax'', ``/sys/vaxmba'', and ``/sys/vaxuba''. Networkinterface drivers reside in ``/sys/vaxif''. Any new devicedrivers should be placed in the appropriate source code directoryand named so as not to conflict with existing devices.Normally, definitions for things like device registers are placed ina separate file in the same directory. For example, the ``dh''device driver is named ``dh.c'' and its associated include file isnamed ``dhreg.h''..PPOnce the source for the device driver has been placed in a directory,the file ``/sys/conf/files.machine'', and possibly``/sys/conf/devices.machine'' should be modified. The .I filesfiles in the conf directory contain a line for each C source or binary-onlyfile in the system. Those files which are machine independent arelocated in ``/sys/conf/files,'' while machine specific filesare in ``/sys/conf/files.machine.'' The ``devices.machine'' fileis used to map device names to major block device numbers. If the devicedriver being added provides support for a new diskyou will want to modify this file (the format is obvious)..PPIn addition to including the driver in the.I filesfile, it must also be added to the device configuration tables. Theseare located in ``/sys/vax/conf.c'', or similar for machines other thanthe VAX. If you don't understand what to add to this file, you shouldstudy an entry for an existing driver. Remember that the position in thedevice table specifies the major device number.The block major number is needed in the ``devices.machine'' fileif the device is a disk..PPWith the configuration information in place, your configurationfile appropriately modified, and a system reconfigured and rebootedyou should incorporate the shell commands needed to install the specialfiles in the file system to the file ``/dev/MAKEDEV'' or``/dev/MAKEDEV.local''. This is discussed in the document ``Installingand Operating 4.4BSD''.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?