📄 3.t
字号:
.\" 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..\".\" @(#)3.t 8.1 (Berkeley) 6/8/93.\".\".ds RH "System Building Process.ne 2i.NHSYSTEM BUILDING PROCESS.PPIn this section we consider the steps necessary to build a bootable systemimage. We assume the system source is located in the ``/sys'' directoryand that, initially, the system is being configured from source code..PPUnder normal circumstances there are 5 steps in building a system..IP 1) 3Create a configuration file for the system..IP 2) 3Make a directory for the system to be constructed in..IP 3) 3Run.I configon the configuration file to generate the files requiredto compile and load the system image..IP 4)Construct the source code interdependency rules for theconfigured system with.I make dependusing.IR make (1)..IP 5)Compile and load the system with .IR make ..PPSteps 1 and 2 are usually done only once. When a system configurationchanges it usually suffices to just run.I configon the modified configuration file, rebuild the source code dependencies,and remake the system. Sometimes,however, configuration dependencies may not be noticed in which caseit is necessary to clean out the relocatable object files savedin the system's directory; this will be discussed later..NH 2Creating a configuration file.PPConfiguration files normally reside in the directory ``/sys/conf''.A configuration file is most easily constructed by copying anexisting configuration file and modifying it. The 4.4BSD distributioncontains a number of configuration files for machines at Berkeley;one may be suitable or, in worst case, a copyof the generic configuration file may be edited..PPThe configuration file must have the same name as the directory inwhich the configured system is to be built. Further,.I configassumes this directory is located in the parent directory ofthe directory in which itis run. For example, the genericsystem has a configuration file ``/sys/conf/GENERIC'' and an accompanyingdirectory named ``/sys/GENERIC''.Although it is not required that the system sources and configurationfiles reside in ``/sys,'' the configuration and compilation proceduredepends on the relative locations of directories within that hierarchy,as most of the system code and the files created by.I configuse pathnames of the form ``../''.If the system files are not located in ``/sys,''it is desirable to make a symbolic link there for use in installationof other parts of the system that share files with the kernel..PPWhen building the configuration file, be sure to include the itemsdescribed in section 2. In particular, the machine type,cpu type, timezone, system identifier, maximum users, and root devicemust be specified. The specification of the hardware present may takea bit of work; particularly if your hardware is configured at non-standardplaces (e.g. device registers located at funny places or devices notsupported by the system). Section 4 of this documentgives a detailed description of the configuration file syntax,section 5 explains some sample configuration files, andsection 6 discusses how to add new devices tothe system. If the devices to be configured are not alreadydescribed in one of the existing configuration files you should checkthe manual pages in section 4 of the UNIX Programmers Manual. For eachsupported device, the manual page synopsis entry gives asample configuration line..PPOnce the configuration file is complete, run it through.I configand look for any errors. Never try and use a system which.I confighas complained about; the results are unpredictable.For the most part,.IR config 'serror diagnostics are self explanatory. It may be the case thatthe line numbers given with the error messages are off by one..PPA successful run of.I configon your configuration file will generate a number of files inthe configuration directory. These files are:.IP \(bu 3A file to be used by \fImake\fP\|(1)in compiling and loading the system,.IR Makefile ..IP \(bu 3One file for each possible system image for this machine,.IR swapxxx.c ,where.I xxxis the name of the system image,which describes where swapping, the root file system, and othermiscellaneous system devices are located..IP \(bu 3A collection of header files, one per possible device thesystem supports, which define the hardware configured..IP \(bu 3A file containing the I/O configuration tables used by the systemduring its .I autoconfigurationphase,.IR ioconf.c ..IP \(bu 3An assembly language file of interrupt vectors whichconnect interrupts from the machine's external buses to the mainsystem path for handling interrupts,and a file that contains counters and names for the interrupt vectors..PPUnless you have reason to doubt .IR config ,or are curious how the system's autoconfiguration schemeworks, you should never have to look at any of these files..NH 2Constructing source code dependencies.PPWhen .I configis done generating the files needed to compile and link your system itwill terminate with a message of the form ``Don't forget to run make depend''.This is a reminder that you should change over to the configurationdirectory for the system just configured and type ``make depend''to build the rules used by .I maketo recognize interdependencies in the system source code.This will insure that any changes to a piece of the systemsource code will result in the proper modules being recompiledthe next time.I makeis run..PPThis step is particularly important if your site makes changesto the system include files. The rules generated specify which source codefiles are dependent on which include files. Without these rules,.I makewill not recognize when it must rebuild modulesdue to the modification of a system header file.The dependency rules are generated by a pass of the C preprocessorand reflect the global system options.This step must be repeated when the configuration file is changedand.I configis used to regenerate the system makefile..NH 2Building the system.PPThe makefile constructed by.I configshould allow a new system to be rebuilt by simply typing ``make image-name''.For example, if you have named your bootable system image ``vmunix'',then ``make vmunix''will generate a bootable image named ``vmunix''. Alternate system image namesare used when the root file system location and/or swapping configurationis done in more than one way. The makefile which.I configcreates has entry points for each system image defined inthe configuration file.Thus, if you have configured ``vmunix'' to be a system with the root filesystem on an ``hp'' device and ``hkvmunix'' to be a system with the rootfile system on an ``hk'' device, then ``make vmunix hkvmunix'' will generatebinary images for each.As the system will generally use the disk from which it is loadedas the root filesystem, separate system images are only requiredto support different swap configurations..PPNote that the name of a bootable image is different from the systemidentifier. All bootable images are configured for the same system;only the information about the root file system and paging devices differ.(This is described in more detail in section 4.).PPThe last step in the system building process is to rearrange certain commonlyused symbols in the symbol table of the system image; the makefilegenerated by .I configdoes this automatically for you.This is advantageous for programs such as\fInetstat\fP\|(1) and \fIvmstat\fP\|(1),which run much faster when the symbols they need are located atthe front of the symbol table. Remember also that many programs expectthe currently executing system to be named ``/vmunix''. If you installa new system and name it something other than ``/vmunix'', many programsare likely to give strange results..NH 2Sharing object modules.PPIf you have many systems which are all built on a single machinethere are at least two approaches to saving time in building systemimages. The best way is to have a single system image which is run onall machines. This is attractive since it minimizes disk space usedand time required to rebuild systems after making changes. However,it is often the case that one or more systems will require a separatelyconfigured system image. This may be due to limited memory (buildinga system with many unused device drivers can be expensive), or toconfiguration requirements (one machine may be a development machinewhere disk quotas are not needed, while another is a production machinewhere they are), etc. In these cases it is possiblefor common systems to share relocatable object modules which are notconfiguration dependent; most of the modules in the directory ``/sys/sys''are of this sort..PPTo share object modules, a generic system should be built. Then, foreach system configure the system as before, but before recompiling andlinking the system, type ``make links'' in the system compilation directory.This will cause the systemto be searched for source modules which are safe to share between systemsand generate symbolic links in the current directory to the appropriateobject modules in the directory ``../GENERIC''. A shell script,``makelinks'' is generated with this request and may be checked forcorrectness. The file ``/sys/conf/defines'' contains a list of symbolswhich we believe are safe to ignore when checking the source codefor modules which may be shared. Note that this list includes the definitionsused to conditionally compile in the virtual memory tracing facilities, andthe trace point support used only rarely (even at Berkeley). It may be necessaryto modify this file to reflect local needs. Note further thatinterdependencies which are not directly visiblein the source code are not caught. This means that if you placeper-system dependencies in an include file, they will not be recognizedand the shared code may be selected in an unexpected fashion..NH 2Building profiled systems.PPIt is simple to configure a system which will automaticallycollect profiling information as it operates. The profiling datamay be collected with \fIkgmon\fP\|(8) and processed with\fIgprof\fP\|(1)to obtain information regarding the system's operation. Profiledsystems maintain histograms of the program counter as well as thenumber of invocations of each routine. The \fIgprof\fPcommand will also generate a dynamic call graph of the executingsystem and propagate time spent in each routine along the arcsof the call graph (consult the \fIgprof\fP documentation for elaboration).The program counter sampling can be driven by the system clock, orif you have an alternate real time clock, this can be used. The latter is highly recommended, as use of the system clock will resultin statistical anomalies, and time spent in the clock routine willnot be accurately attributed..PPTo configure a profiled system, the.B \-poption should be supplied to \fIconfig\fP.A profiled system is about 5-10% larger in its text space due tothe calls to count the subroutine invocations. When the systemexecutes, the profiling data is stored in a buffer which is 1.2times the size of the text space. The overhead for running aprofiled system varies; under normal load we see anywhere from 5-25%of the system time spent in the profiling code..PPNote that systems configured for profiling should not be shared asdescribed above unless all the other shared systems are also to beprofiled.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -