067-070.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 115 行

HTML
115
字号
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Using LILO</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=4//-->

<!--PAGES=067-070//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch03/065-066.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="070-072.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H2><A NAME="Heading1"></A><FONT COLOR="#000077">Chapter 4<BR>Using LILO

</FONT></H2>

<P><I>by Kamran Husain</I></P>

<DL>

<DT><B>In This Chapter</B>

<DT>&#149;&nbsp;&nbsp; Installing LILO

<DT>&#149;&nbsp;&nbsp; Linux and hard disk layouts

<DT>&#149;&nbsp;&nbsp; The boot sector

<DT>&#149;&nbsp;&nbsp; The boot process

<DT>&#149;&nbsp;&nbsp; The map installer

<DT>&#149;&nbsp;&nbsp; Boot images

<DT>&#149;&nbsp;&nbsp; Removing or disabling LILO

<DT>&#149;&nbsp;&nbsp; Troubleshooting LILO

</DL>

<P>LILO (which means <I>LInux LOader</I>) is the boot loader used by Linux to load the operating system kernel. LILO is versatile: It can boot Linux kernels from any type of file system, including floppy disk as well as from other operating systems.</P>

<P>This chapter looks at LILO, the way hard disks are laid out with Linux, the boot process, and the most common boot processes and the interactions of LILO with each. This should help you install and use LILO efficiently and effectively.</P>

<P>There are several versions of LILO available. Most current versions support one of two different directory structures. The more traditional (and older) structure resides in the <TT>/etc/lilo</TT> directory. The newer structure has files scattered in several directories including <TT>/etc</TT>, <TT>/sbin</TT>, and <TT>/boot</TT>. Because the older <TT>/etc/lilo</TT> structure is the most common, it is used for examples in this chapter. If you are using the new structure (check for the existence of <TT>/etc/lilo</TT>), substitute the new pathnames as necessary.</P>

<H3><A NAME="Heading2"></A><FONT COLOR="#000077">Installing LILO</FONT></H3>

<P>Most systems have LILO already installed and configured. If your system already has LILO installed, you can skip this section unless you want to update your version.

</P>

<P>A quick installation procedure is available with most versions of Linux to install a minimum set of files required for LILO. This is described in the file <TT>QuickInst.old</TT> or <TT>QuickInst.new</TT>, in some versions of Linux (but not all). The <TT>QuickInst</TT> routines can be used only for a first-time LILO installation or to replace an existing LILO set. They should not be used for updates as any existing configuration information is overwritten.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>Before LILO can be compiled for use, the kernel has to be configured by executing <TT>makeconfig</TT>. All kernel header files must be in the directory <TT>/usr/include/linux</TT> for LILO to compile properly. The LILO installation and compilation process should be run from a Bourne shell (or complete compatible). Problems have been reported with versions of the Korn shell when LILO is compiled, so use <TT>/bin/sh</TT> or <TT>/bin/bash</TT>.<HR></FONT>

</BLOCKQUOTE>

<P>A full installation of LILO requires that all the files in the LILO distribution archive (usually called <TT>lilo.xxx.tar.gz</TT> where <TT>xxx</TT> is the version number) are extracted into a directory other than <TT>/etc/lilo</TT>. (This is because the installation will fail if the final destination is the same as the source directory.) After the distribution files are located in a temporary directory, follow these steps:</P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;Check the <TT>Makefile</TT> for valid configuration information (see the later &#147;LILO <TT>Makefile</TT>&#148; section).

<DD><B>2.</B>&nbsp;&nbsp;Compile LILO. If you want to use the older <TT>/etc/lilo</TT> directory structure, issue the first command that follows. If you want to use the new directory structure, issue the second command.

<!-- CODE SNIP //-->

<PRE>

make -f Makefile.old

make -f Makefile.new

</PRE>

<!-- END CODE SNIP //-->

<DD><B>3.</B>&nbsp;&nbsp;Copy all the LILO files to the target directory with one of the following commands, depending on whether the new or old directory structure is selected:

<!-- CODE SNIP //-->

<PRE>

make -f Makefile.old install

make -f Makefile.new install

</PRE>

<!-- END CODE SNIP //-->

<DD><B>4.</B>&nbsp;&nbsp;Check the <TT>lilo</TT> directories. You should see the following files: <TT>any_d.b</TT>, <TT>boot.b</TT>, <TT>chain.b</TT>, <TT>disktab</TT>, <TT>lilo</TT>, <TT>os2_d.b</TT>.

</DL>

<P>If the files do not exist or errors are generated in the process, restart the installation. You should check the <TT>Makefile</TT> for accurate information. After LILO has been installed properly, you can use it to install a boot process.</P>

<H4 ALIGN="LEFT"><A NAME="Heading3"></A><FONT COLOR="#000077">Handling Disk Problems</FONT></H4>

<P>Some systems may have difficulty with hard disks that do not allow the disk parameters (heads, sectors per track, and cylinders) to be read. If error messages about &#147;bad geometry&#148; are generated or the LILO installation fails with disk errors, the disk parameters are a likely source of trouble. This is especially true with SCSI disks and hard disks with a capacity of 1GB or more.

</P>

<P>In this case, the disk parameters must be manually entered into the file <TT>disktab</TT>. This is discussed in more detail in the section &#147;Disk Parameter Table&#148; later in this chapter. Edit the <TT>disktab </TT>file as explained to include the disk parameters, then follow these steps to test the new LILO configuration by copying it to a floppy disk and booting from it:</P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;Open the LILO directory (usually <TT>/etc/lilo</TT>).

<DD><B>2.</B>&nbsp;&nbsp;Execute the following command to copy the LILO configuration to the floppy. Substitute the kernel image name after the &#147;image&#148; parameter. (If you don&#146;t want to overwrite an existing map file on your system, add the <TT>-m</TT> option to the <TT>lilo</TT> command using another map filename to write to.)

<!-- CODE SNIP //-->

<PRE>

echo image=kernel_name | ./lilo -C - -b /dev/fd0 -v -v -v

</PRE>

<!-- END CODE SNIP //-->

<DD><B>3.</B>&nbsp;&nbsp;Reboot your system from the floppy disk.

</DL>

<P>If the configuration is correct, LILO reads the floppy for the boot loader, then loads the kernel from the hard disk. If everything boots properly and you can move around the file system, the disk parameters are correct. If you can&#146;t access the hard disk file system, the parameters are incorrect and should be re-entered.

</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch03/065-066.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="070-072.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?