📄 ch56.htm
字号:
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">cp Image /dev/fd0
</FONT></PRE>
<P>Use a different device driver, if necessary, to place it somewhere else on the
hard drive file system. Alternatively, if you plan to use LILO to boot the operating
system, you can install the new kernel by running a setup program or the utility
<TT>/usr/lilo/lilo</TT>. (See Chapter 4, "Booting Linux.")</P>
<P>Now all that remains is to reboot the system and see if the new kernel loads properly.
If there are any problems, boot from a floppy, restore the old kernel, and start
the process again. Check the documentation supplied with the release source code
for any information about problems you may encounter or steps that may have been
added to the process.
<H3 ALIGN="CENTER"><A NAME="Heading7<FONT COLOR="#000077">Adding Drivers to
the Kernel</FONT></H3>
<P>You may want to link in new device drivers or special software to the kernel without
going through the upgrade process of the kernel itself. This is often necessary when
you add a new device to the system (such as a multiport board or an optical drive)
that should be loaded during the boot process. Alternatively, you may be adding special
security software that must be linked into the kernel.</P>
<P>The add-in kernel software usually has installation instructions provided, but
the general process is to locate the source in a directory that can be found by the
kernel recompilation process (such as the <TT>/usr/src</TT> directory). To instruct
the <TT>make</TT> utility to add the new code to the kernel, you often need to modify
the <TT>Makefile</TT>. These modifications may be performed manually or by an installation
script. Some software has its own <TT>Makefile</TT> supplied for this reason.</P>
<P>Then, it's time to begin the kernel recompilation with the new software added
into the load. The process is the same as shown in the preceding section; the kernel
is installed in the boot location or is set by LILO. Typically, the entire process
takes about 10 minutes and is quite trouble-free, unless the vendor of the kernel
modification did a sloppy job. Make sure that the source code provided for the modification
will work with your version of the Linux kernel by reading any text files that accompany
the code as well as the software compatibility files included with most distributions
of Linux.
<H3 ALIGN="CENTER"><A NAME="Heading8<FONT COLOR="#000077">Upgrading Libraries</FONT></H3>
<P>Most of the software on a Linux system is set to use shared libraries (a set of
subroutines used by many programs). When you see the message<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Incompatible library version
</FONT></PRE>
<P>displayed after you have performed an upgrade to the system and you try to execute
a utility, it means that the libraries have been updated and need to be recompiled.
Most libraries are backward-compatible, so existing software should work properly
even after a library upgrade.</P>
<P>Library upgrades occur less frequently than kernel upgrades, and you can find
them in the same places. There are usually documents that guide you to the latest
version of a library, or there may be a file explaining which libraries are necessary
with new versions of the operating system kernel.</P>
<P>Most library upgrades are gzipped <TT>tar</TT> files, and the process for unpacking
them is the same as for kernel source code--except that the target directories are
usually <TT>/lib</TT>, <TT>/usr/lib</TT>, and <TT>/usr/include</TT>. Usually, any
files that have the extension <TT>.a</TT> or <TT>.aa</TT> belong in the <TT>/usr/lib</TT>
directory. Shared library image files, which have the format <TT>libc.so.version</TT>,
are installed into <TT>/lib</TT>.</P>
<P>You may have to change symbolic links within the file system to point to the latest
version of the library. For example, if you are running library version <TT>libc.so.4.4.1</TT>
and upgrade to <TT>libc.so.4.4.2</TT>, you must alter the symbolic link set in <TT>/lib</TT>
to this file. The command is<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">ln -sf /lib/libc/so/4/4/1 /lib/libc.so.4
</FONT></PRE>
<P>where the last filename in the link command is the name of the current library
file in <TT>/lib</TT>. Your library name may be different, so check the directory
and release or installation notes first.</P>
<P>You would also need to change the symbolic link for the file <TT>libm.so.version</TT>
in the same manner. Do not delete the symbolic links because all programs that depend
on the shared library (including <TT>ls</TT>) would be unable to function without
them.
<H3 ALIGN="CENTER"><A NAME="Heading9<FONT COLOR="#000077">An Introduction to
the Linux Source Tree</FONT></H3>
<P>You will need to look at the source code if you want to make enhancements to the
kernel. The Linux source code can be found in the <TT>/usr/src/linux</TT> directory.
For the reader interested in kernels, this directory is a very good reference.</P>
<P>The first place to start is to see what header files you have available in the
<TT>include</TT> directory. This way, you can tell what system services are available.
(See Table 56.1.) I have deliberately left out redundant or unused header files.
By examining the header files, you can see what files and hardward configurations
are available for you in Linux. <BR>
<CENTER>
<P><FONT SIZE="4"><B>Table 56.1. Linux header files in /usr/src/linux/include/linux.
</B></FONT>
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><B><I>File </I></B></TD>
<TD ALIGN="LEFT"><B><I>Description </I></B></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>a.out.h</TT> </TD>
<TD ALIGN="LEFT">Generated for the GNU C compilers. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>atalk.h</TT> </TD>
<TD ALIGN="LEFT">Appletalk network structures and definitions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>autoconf.h</TT> </TD>
<TD ALIGN="LEFT">Automatically generated C <TT>config</TT> file. Don't edit it! </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>ax25.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the AX.25 protocol. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>aztcd.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for a AztechCD268 CD-ROM interface. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>binfmts.h</TT> </TD>
<TD ALIGN="LEFT">Binary formats for the files. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>bios32.h</TT> </TD>
<TD ALIGN="LEFT">BIOS32, PCI BIOS functions and defines. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>blkdev.h</TT> </TD>
<TD ALIGN="LEFT">Block device information. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>busmouse.h</TT> </TD>
<TD ALIGN="LEFT">Header file for Logitech Bus Mouse driver. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>cdrom.h</TT> </TD>
<TD ALIGN="LEFT">General header for all CD-ROM drives. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>cdu31a.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for a Sony interface CD-ROM drive. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>cm206.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for a CM206 CD-ROM drive and adapter. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>coff.h</TT> </TD>
<TD ALIGN="LEFT">The COFF file format definitions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>config.h</TT> </TD>
<TD ALIGN="LEFT">Linux kernel configuration header. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>ctype.h</TT> </TD>
<TD ALIGN="LEFT">Standard C types header. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>cyclades.h</TT> </TD>
<TD ALIGN="LEFT">For the Cyclades devices. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>debugreg.h</TT> </TD>
<TD ALIGN="LEFT">Debug registers header file. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>delay.h</TT> </TD>
<TD ALIGN="LEFT">Delay routines using a precomputed <TT>loops_per_second</TT> value. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>elf.h</TT> </TD>
<TD ALIGN="LEFT">The Executable and Linking Format (ELF) definitions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>errno.h</TT> </TD>
<TD ALIGN="LEFT">The standard error return definitions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>etherdevice.h</TT> </TD>
<TD ALIGN="LEFT">Ethernet device handlers declarations. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>ext2_fs.h</TT> </TD>
<TD ALIGN="LEFT">The new extended file system (<TT>e2fs</TT>) declarations. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>ext_fs.h</TT> </TD>
<TD ALIGN="LEFT">The <TT>ext</TT> file system (<TT>efs</TT>) definitions for older Linux versions.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>fcntl.h</TT> </TD>
<TD ALIGN="LEFT">The standard file control declaration. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>fd.h</TT> </TD>
<TD ALIGN="LEFT">Floppy disk software control definitions. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>fdreg.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the floppy disk controller. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>fs.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for some important file table structures. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>genhd.h</TT> </TD>
<TD ALIGN="LEFT">Generic hard disk header declarations. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>gscd.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for a GoldStar R420 CD-ROM interface. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>hdreg.h</TT> </TD>
<TD ALIGN="LEFT">Declarations for the AT hard disk controllers. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>head.h</TT> </TD>
<TD ALIGN="LEFT">Headers for Intel Global and Interrupt Descriptor tables. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>hpfs_fs.h</TT> </TD>
<TD ALIGN="LEFT">OS/2 HPFS file system. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>icmp.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the ICMP protocol. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the INET interface module. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if_arp.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the ARP (RFC 826) protocol. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if_ether.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for the Ethernet IEEE 802.3 interface. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if_fw.h</TT> </TD>
<TD ALIGN="LEFT">Definitions for an IP firewall module. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if_plip.h</TT> </TD>
<TD ALIGN="LEFT">PLIP tuning facilities for the new Niibe PLIP. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if_ppp.h</TT> </TD>
<TD ALIGN="LEFT">Constants and structures for use with the PPP module. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>if_slip.h</TT> </TD>
<TD ALIGN="LEFT">Constants for special use with the SLIP/CSLIP/KISS TNC driver. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>igmp.h</TT> </TD>
<TD ALIGN="LEFT">Internet Gateway Management Protocol (IGMP). </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>in.h</TT> </TD>
<TD ALIGN="LEFT">Definitions of the Internet Protocol. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>in_systm.h</TT> </TD>
<TD ALIGN="LEFT">Miscellaneous Internetwork definitions for the Linux kernel. </TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -