📄 ch56.htm
字号:
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>tcp.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the TCP protocol. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>termios.h</TT> </TD>
<TD ALIGN="LEFT">Terminal I/O declarations. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>time.h</TT> </TD>
<TD ALIGN="LEFT">Standard declarations for use with timers. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>timer.h</TT> </TD>
<TD ALIGN="LEFT">Do not modify this timer declarations file. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>times.h</TT> </TD>
<TD ALIGN="LEFT">For use with Linux kernel timers. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>timex.h</TT> </TD>
<TD ALIGN="LEFT">For TIMEX devices. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>tpqic02.h</TT> </TD>
<TD ALIGN="LEFT"><TT>include</TT> file for the QIC-02 driver for Linux. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>tqueue.h</TT> </TD>
<TD ALIGN="LEFT">The task queue handling information for Linux. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>tty.h</TT> </TD>
<TD ALIGN="LEFT">Defines some structures used by <TT>tty_io.c</TT>. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>tty_driver.h</TT> </TD>
<TD ALIGN="LEFT">Defines interface between low-level <TT>tty</TT> driver and its routines. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>types.h</TT> </TD>
<TD ALIGN="LEFT">Standard Linux variable type definitions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>udp.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the UDP protocol. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>ultrasound.h</TT> </TD>
<TD ALIGN="LEFT">For Ultrasound CD-ROM devices. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>umsdos_fs.h</TT> </TD>
<TD ALIGN="LEFT">The UMSDOS file system header. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>un.h</TT> </TD>
<TD ALIGN="LEFT">Linux header for socket programming. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>unistd.h</TT> </TD>
<TD ALIGN="LEFT">Standard UNIX file header. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>user.h</TT> </TD>
<TD ALIGN="LEFT">For use with core dumps and user segments. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>utime.h</TT> </TD>
<TD ALIGN="LEFT">Time information. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>utsname.h</TT> </TD>
<TD ALIGN="LEFT">Time information and structures. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>version.h</TT> </TD>
<TD ALIGN="LEFT">Linux version information. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>vfs.h</TT> </TD>
<TD ALIGN="LEFT">Virtual file system headers. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>vm86.h</TT> </TD>
<TD ALIGN="LEFT">Virtual memory management routines. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>vt.h</TT> </TD>
<TD ALIGN="LEFT">For use with virtual terminals. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>xd.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the I/O ports, and so forth, for XT hard disk contollers.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>modules/</TT> </TD>
<TD ALIGN="LEFT">Contains the file <TT>ksyms.ver</TT>, a symbol version table generated by <TT>genksyms</TT>.
</TD>
</TR>
</TABLE>
<BR>
</CENTER>
<P>Let's give an example of how you would use this header file information. Suppose
that using the default kernel for the <TT>sbcpd</TT> (Panasonic CD-ROM) drive takes
a long time to boot because it probes the I/O ports to see where the drive is in
the I/O port memory space. You know you have set your jumpers on the drive to 0x260,
so why not just have it look there and keep going? You are sick of typing in the
<TT>sbpcd=0x260,SoundBlaster</TT> sequence every time you boot.</P>
<P>Sounds good. Let's look at the <TT>sbpcd.h</TT> file in <TT>/usr/src/linux/include/linux</TT>.</P>
<P>First, log in as root and make sure that you have write privileges to this header
file to save your changes. Look at the part of the file where it says to define your
CD-ROM port base I/O address as <TT>CDROM_PORT</TT> and specify the type of your
interface card as <TT>SBPRO</TT>. You can change the address lines in file after
line 90 as the following:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">#undef CDROM_PORT /* get rid of previous declarations. */
#undef SBPRO /* get rid of previous declarations. */
#undef SOUND_BASE /* get rid of previous declarations. */
/* override these values. */
#define CDROM_PORT 0x230 /* port address */
#define SBPRO 0 /* interface type */
#define SOUND_BASE 0x220 /* sound address of this card or 0 */
</FONT></PRE>
<P>Now exit the editor after making the changes. Rebuild the kernel and install it
as discussed earlier in this chapter. Reboot, and there you have it--a fast boot.</P>
<P>This is only a quick example of how to use this valuable resource of information
to customize your Linux system. I am sure that with some exploring, you can come
across some more examples.
<CENTER>
<H3><A NAME="Heading10<FONT COLOR="#000077">Making Loadable Modules for Linux</FONT></H3>
</CENTER>
<P>We briefly covered modules in Chapter 5, "Special Installations." This
section describes the basic strategy for making dynamically loadable modules in the
Linux kernel. Let's look at how to use them. However, how modules work is really
beyond the scope of this book. Sorry.</P>
<P>In this kernel version (2.0.0 or later versions), you can also create modules
by enabling <TT>CONFIG_MODVERSIONS</TT> when making a kernel. Also, you have to install
the latest module support package <TT>modules-2.0.0.tar.gz</TT> (or later version.)
Next, compile and install the kernel (as explained earlier).</P>
<P>When you have made the kernel, create the modules by typing the following command:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">make modules
</FONT></PRE>
<P>This compiles all modules and updates the modules directory. In this directory,
you can then find a bunch of symbolic links, pointing to the various object files
in the kernel tree.</P>
<P>The set of modules is rapidly increasing, and you have the following list of items
with this CD-ROM. You can find descriptions for each of these modules by following
each of the links in the files in the directory <TT>usr/src/linux/modules</TT>:
<UL>
<LI><TT>3c501</TT>
<P>
<LI><TT>3c509</TT>
<P>
<LI><TT>BLOCK_MODULES</TT>
<P>
<LI><TT>FS_MODULES</TT>
<P>
<LI><TT><BR>
NET_MODULE</TT>
<P>
<LI><TT>apricot</TT>
<P>
<LI><TT>arcnet</TT>
<P>
<LI><TT>aztcd</TT>
<P>
<LI><TT>de4x5</TT>
<P>
<LI><TT>de600</TT>
<P>
<LI><TT>de620</TT>
<P>
<LI><TT>depca</TT>
<P>
<LI><TT>eexpress</TT>
<P>
<LI><TT>ewrk3</TT>
<P>
<LI><TT>plip</TT>
<P>
<LI><TT>sonycd535</TT>
<P>
<LI><TT>sysv</TT>
<P>
<LI><TT>wavelan</TT>
<P>
<LI><TT>xiafs</TT>
</UL>
<P>As soon as you have rebooted the newly made kernel, you can install and remove
modules at will with the utilities <TT>insmod</TT> and <TT>rmmod</TT>.</P>
<P>Now, after you have made all modules, you can also type the following command:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">make modules_install
</FONT></PRE>
<P>This copies all newly made modules into subdirectories under <TT>/lib/modules/</TT>kernel<TT>_</TT>release<TT>/</TT>where
kernel_release is something like 1.2.13, or later.</P>
<P>Using the <TT>modprobe</TT> utility, you can load any module like this:</P>
<PRE><FONT COLOR="#0066FF">/sbin/modprobe module
</FONT></PRE>
<P>To use <TT>modprobe</TT> successfully, you should place the following command
in your <TT>/etc/rc.d/rc.S</TT> script:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">/sbin/depmod -a
</FONT></PRE>
<P>This computes the dependencies between the different modules. Then type the following
line, for example:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">/sbin/modprobe umsdos
</FONT></PRE>
<P>Now you automatically load both the MS-DOS and UMSDOS modules, because UMSDOS
runs piggyback on MS-DOS.
<CENTER>
<H3><A NAME="Heading11<FONT COLOR="#000077">The rc.modules File</FONT></H3>
</CENTER>
<P>Another important file to look at is the <TT>rc.modules</TT> file. This file is
located in the <TT>/etc/rc.d</TT> directory and is executed when the system first
boots up. The latest version of this <TT>rc.modules</TT> file is version 1.11 by
Sam Volkerding for Slackware Linux. More documentation for specific modules is listed
in the <TT>/docs</TT> directory on the CD-ROM.</P>
<P>Edit the <TT>rc.modules</TT> file carefully and keep a backup copy of this file
before you make too many edits. Each line in the <TT>rc.modules</TT> corresponds
to a binary file to execute to load a module into Linux. Most of the entries in the
<TT>rc.modules</TT> file will be commented out. Uncomment only the lines you need.
It'll probably be easier if you uncomment one line at a time instead of uncommenting
all the lines at once. Some modules might require other modules to be loaded before
being loaded themselves, or might not allow the code to be loaded more than once.
These exceptions are special cases indeed. For example, you have to load the MS-DOS
module before you load USMSDOS. For example, you cannot load the NE2000 module twice
if you have more than one Ethernet card in your system. In some cases, you will simply
have to rebuild a kernel and statically link in the features you need.</P>
<P>Be prepared to boot several times to get the exact sequence of loaded modules
for your custom setup. In general, the modules in <TT>rc.modules</TT> are listed
in the order they should be in to satisfy any interdependencies between modules.
<CENTER>
<H3><A NAME="Heading12<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P>Recompiling kernel source and adding new features to the kernel proceeds smoothly,
as long as you know what you are doing. Don't let the process scare you, but always
keep boot disks on hand. Follow instructions wherever available, because most new
software has special requirements for linking into the kernel or replacing existing
systems.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -