📄 ch04.htm
字号:
for you in the <TT>/etc</TT> directory. (See Listing 4.2.) Keep an old copy of the
original file in a safe place such as <TT>lilo.conf.safe</TT>. If you already have
this file in your <TT>/etc</TT> directory, you can edit it too. Of course, depending
on how your system is set up, the contents of your Linux installation might vary.
<H3 ALIGN="CENTER"><A NAME="Heading12<FONT COLOR="#000077">Listing 4.2. The
/etc/lilo.conf file.</FONT></H3>
<PRE><FONT COLOR="#0066FF">
#
# LILO configuration file
# Start LILO global section
append="sbpcd=0x260,SoundBlaster ether=10,0x300,eth0 ether=9,0x340,eth1"
boot = /dev/hda
#compact # faster, but won't work on all systems.
delay = 50
vga = normal # force sane state
ramdisk = 0 # paranoia setting
# End LILO global section
# Linux bootable partition config begins
image = /vmlinuz
root = /dev/hda2
label = linux
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
# DOS bootable partition config begins
other = /dev/hdb1
label = dos
loader = /boot/any_d.b
table = /dev/hdb
# DOS bootable partition config ends
</FONT></PRE>
<DL>
<DT><FONT COLOR="#0066FF"></FONT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading13<FONT COLOR="#000077"><B>TIP:</B> </FONT>Read the file <TT>INCOMPAT</TT>
in the LILO release for compatibility notes.
<HR>
</DL>
<P>In this <TT>lilo.conf</TT> file, you can see two different kernels that can be
booted from <TT>/dev/hda2</TT>. This system includes a <TT>/dev/hdb1</TT> from which
you can boot into DOS if you have to. The first image will be the default image into
which you will boot. This image is called <TT>vmlinuz</TT> and has the label <TT>linux</TT>.
The other image is labeled <TT>DOS</TT> for the DOS partition.</P>
<P>If you uncomment the delay line, LILO waits five seconds for you to make a choice.
A delay of <TT>0</TT> causes LILO to boot immediately.</P>
<P>If you are really stingy about disk space, uncomment the compact button. There
is a risk, though, that the compact version will not work with your system. Normally,
this line should be commented out. Compact modes are designed for use with floppy
disks.</P>
<P>Exit the program to install LILO for you. After the installation is over, restart
the machine with the following command:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">/sbin/shutdown -r now
</FONT></PRE>
<DL>
<DT><FONT COLOR="#0066FF"></FONT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading14<FONT COLOR="#000077"><B>NOTE:</B> </FONT><TT>QuickInst</TT>
can be used only for first-time installations or to entirely replace an existing
installation, not to update or modify an existing installation of LILO. Be sure that
you've extracted LILO into a directory that doesn't contain any files of other LILO
installations.
<HR>
</DL>
<P>The <TT>/sbin/lilo</TT> command installer accepts several command-line options.
Check the <TT>README</TT> file or <TT>man lilo(8)</TT> with your installation package
for more details. It's better to use configuration parameters in a file unless you
already know what you are doing.
<H4 ALIGN="CENTER"><A NAME="Heading15<FONT COLOR="#000077">Configuration Parameters</FONT></H4>
<P>The <TT>/etc/lilo/config</TT> or <TT>/etc/lilo.conf</TT> file can have the following
parameters. All of these can be set from the command line, but storing them in a
configuration file is more reliable. The following options are available to you:
<UL>
<LI><TT>append=</TT>string--The string is appended to the boot prompt and is sent
to the kernel verbatim. This line is what you would normally type at the <TT>boot:</TT>
prompt from LILO when the machine boots.
<P>
<LI><TT>boot=</TT>boot_device--Specifies the device with the boot sector. Assumes
the current device if boot_device is omitted.
<P>
<LI><TT>delay=</TT>tsecs--Specifies in tenths of a second how long LILO should wait
before booting the first image. Omitting the delay value is like setting it to <TT>0</TT>,
which tells the boot loader not to wait.
<P>
<LI><TT>message=</TT>message_file--Specifies a file containing a message that is
displayed before the boot prompt. No message is displayed when LILO is waiting for
a Shift key and after printing <TT>"LILO"</TT>. By default, messages are
stored in the <TT>/etc/boot.message</TT> file.
<P>
<LI><TT>password=</TT>password--Sets a password for all images. You can set different
passwords for different images. If you forget your password, boot off of a floppy
and reconfigure LILO.
<P>
<LI><TT>prompt</TT>--Forces a user to enter a boot prompt and prevents unattended
reboots if <TT>timeout</TT> isn't set.
<P>
<LI><TT>timeout=</TT>tsecs--Sets a timer (in tenths of a second) for keyboard input.
If no timeout is specified, or set to <TT>0</TT>, LILO waits forever. If no key is
pressed for the specified time, LILO uses the first image in the <TT>lilo.conf</TT>
file.
<P>
<LI><TT>verbose=</TT>level--Turns on lots of progress reporting. The higher the number,
the more output you are likely to get.
<P>
<LI><TT>vga=</TT>mode--Tells LILO which VGA mode to use in place of the default VGA
mode. The mode values for the <TT>vga</TT> option are <TT>NORMAL</TT>, <TT>EXTENDED</TT>,
<TT>ASK</TT>, or a decimal (not hex) number for the BIOS video mode command. (You
can get a list of available modes by typing <TT>vga=ASK</TT>.)
</UL>
<P>The kernel configuration parameters <TT>append</TT>, <TT>root</TT>, and <TT>vga</TT>
can be set in the options section. They are used as defaults if they aren't specified
in the configuration sections of the respective kernel images.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading16<FONT COLOR="#000077"><B>NOTE:</B> </FONT>You can use different
settings for the same image because LILO stores them in the image descriptors and
not in the images themselves.
<HR>
</DL>
<H4 ALIGN="CENTER"><A NAME="Heading17<FONT COLOR="#000077">The boot: Prompt</FONT></H4>
<P>When the system boots up, after the keyboard test, press and hold down one of
these keys: Alt, Shift, or Ctrl (or you can use the Caps Lock or Scroll Lock keys).
If one (or more) of these keys is pressed, LILO displays the <TT>boot:</TT> prompt
and waits for the name of a boot image. So if you want to boot into MS-DOS, you can
type <TT>DOS</TT> here and press Enter. The names you type here are the labels you
assign in the <TT>lilo.conf</TT> file. Pressing the Tab key or typing <TT>?</TT>
presents you with a list of names recognized by LILO.</P>
<P>If you do not press any of the keys listed in the preceding paragraph, LILO boots
up the first kernel (in this case, <TT>vmlinuz</TT>) it finds in the <TT>lilo.conf</TT>
file.</P>
<P>LILO can also pass command-line options to the kernel. Command-line options are
words that follow the name of the boot image and are separated by spaces. The Linux
kernel recognizes the options <TT>root=</TT>device, <TT>ro</TT>, and <TT>rw</TT>
for the device to use, whether the device is read-only or can be written to. The
read-only option is useful if the image is on a CD-ROM or a "safe" disk.
The device is the name of the device you want to boot (<TT>/dev/hda1</TT>, <TT>/dev/hda2</TT>,
and so on). This allows you to change the root device from that in the <TT>lilo.conf</TT>
file.</P>
<P>The option <TT>single</TT> boots the system in single-user mode. This bypasses
all system- initialization procedures and directly starts a root shell on the console.
Reboot later to enter multiuser mode.</P>
<P>The option <TT>vga</TT> is processed by the boot loader itself and not the Linux
kernel. You can specify the <TT>vga</TT> option in the append line.</P>
<P>The information you type at the boot prompt is sent to the Linux kernel. For multiple
devices, use commas to separate each parameter. Avoid the use of spaces between parameters.
Following are some examples of these boot prompts:
<UL>
<LI>For reserving ports from being auto-probed by device drivers in special hardware
device conflict situations, you can use <TT>reserve=</TT>port<TT>,</TT>size. For
example, <TT>reserve=0x200,8</TT> will reserve 8 ports starting at 0x200 from being
probed by device drivers.
<P>
<LI>For a Panasonic CD-ROM with SoundBlaster support, use <TT>sbpcd=0x340, SoundBlaster</TT>.
This prevents the module from auto-probing IO ports for locations for the CD-ROM
drive. The result is a much faster boot time for the machine.
<P>
<LI>For a bus mouse, use <TT>bmouse=</TT>irq, which is used for testing the mouse.
It's better to set this in the <TT>lilo.conf</TT> after you have debugged the mouse.
<P>
<LI>Ethernet cards usually take parameters from the <TT>ether=</TT>x<TT>,</TT>x<TT>,</TT>x
command. The actual parameters sent depend on the type of card.
<P>
<LI>For Mitsumi CD-ROM, use <TT>mcd=</TT>port<TT>,</TT>irq. For example, you might
use <TT>mcd=0x340,11</TT>. (Note how the interrupt number here is given after the
port number.)
<P>
<LI>If your Ethernet card is not recognized, try <TT>ether=10,0x340</TT> to probe
for it at port 0x340 using interrupt 10. (Note how the interrupt number here is given
before the port number.)
</UL>
<P>The parameters for each type of device will come with their documentation, so
do not assume anything. Check the man pages in <TT>man lilo</TT> for more information.
Use only specified values. If you do not follow instructions, you might wind up causing
irrecoverable errors, which might lead to a corrupt file system.</P>
<P>Here is an example. For my system I have a SoundBlaster card at 0x260, an Ethernet
card using interrupt 10, and another using interrupt 9. The append line for this
setup looks like this:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">append="sbpcd=0x260,SoundBlaster ether=10,0x300,eth0 ether=9,0x340,eth1"
</FONT></PRE>
<P>At the boot prompt, if I want to override any of these values, I can type a new
line like the following one to swap the interrupts on the hardware (but don't do
this unless it really applies to your hardware!):<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">linux sbpcd=0x260,SoundBlaster ether=9,0x300,eth0 ether=10,0x340,eth1
</FONT></PRE>
<P>Basically, what the preceding line is saying is that my SoundBlaster card sits
on port 0x260 for the sbpcd device driver. The values specified for the Ethernet
cards are in the form<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">ether=interrupt,port,deviceName
</FONT></PRE>
<P>The deviceName will show up in the device list as <TT>/dev/eth0</TT> and <TT>/dev/eth1</TT>
for each Ethernet card. The interrupts and ports are specified in hex; they must
match up or your device will not work.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading18<FONT COLOR="#000077"><B>TIP:</B> </FONT>Remember that all
hex numbers to the boot prompt must be entered with <TT>0x</TT> in front of them.
The default interpretation is that of decimal digits and decimal numbers.
<HR>
</DL>
<H4 ALIGN="CENTER"><A NAME="Heading19<FONT COLOR="#000077">Updating the Kernel</FONT></H4>
<P>Whenever any of the kernel files that are accessed by LILO are moved or overwritten,
the map has to be rebuilt. (Always keep a second, stable kernel image you can boot
if you forget to update the map after a change to your usual kernel image.)</P>
<P>Run <TT>/etc/lilo/lilo as root</TT> to update the MBR. When rebuilding the kernel,
you have to run the command <TT>make target zlilo</TT>, which copies the kernel to
<TT>/vmlinuz</TT> and runs <TT>/etc/lilo/install</TT> for you.
<H4 ALIGN="CENTER"><A NAME="Heading20<FONT COLOR="#000077">Uninstalling LILO</FONT></H4>
<P>Do not remove any files related to LILO until you have removed LILO from the system
with the <TT>lilo -u</TT> command. That command is not enough either; you also must
remove the MBR from the hard disk.</P>
<P>If you want to restore the MBR to the original DOS MBR, you can use the following
procedure:
<DL>
<DD><B>1. </B>Boot from a DOS floppy with FDISK on it.<BR>
<B><BR>
2. </B>Run <TT>fdisk /MBR</TT> from the DOS prompt. (You can also use the command
<TT>SYS C:</TT>.)<BR>
<B><BR>
3.</B> Reboot with the same floppy or through Linux.<BR>
<B><BR>
4.</B> Run FDISK or fdisk.<BR>
<B><BR>
5.</B> Activate a partition to boot from.<BR>
<B><BR>
6.</B> Reboot (to test whether it all still works!).
</DL>
<H3 ALIGN="CENTER"><A NAME="Heading21<FONT COLOR="#000077">BOOTLIN</FONT></H3>
<P>With the BOOTLIN package, you can use DOS MBR to boot off the hard drive. To install
this package, take the following steps:
<DL>
<DD><B>1.</B> From within Linux, copy a bootable kernel to your DOS partition.<BR>
<B><BR>
2.</B> Edit <TT>config.sys</TT> on the DOS partition to include two files: <TT>BOOT.SYS</TT>
and <TT>BOOTLIN.SYS</TT>. The <TT>README</TT> files for these packages tell you how.<BR>
<B><BR>
3.</B> Reboot.
</DL>
<P>Now when you reboot, the <TT>BOOT.SYS</TT> and <TT>BOOTLIN.SYS</TT> files boot
into Linux for you.</P>
<P>To get back to running only DOS, remove the <TT>BOOTLIN.SYS</TT> and <TT>BOOT.SYS</TT>
files.</P>
<P>The primary site for the BOOTLIN package is at <TT>txs-11.mit.edu</TT>, in the
<TT>/pub/linux/INSTALL/dos</TT> directory.
<H3 ALIGN="CENTER"><A NAME="Heading22<FONT COLOR="#000077">Summary</FONT></H3>
<P>In this chapter, we covered the topics of installing, configuring, and using LILO.
We also covered some of the basic errors you can face and how to set up LILO using
the liloconfig utility. The information you have learned here should get you started
in setting up LILO to boot Linux on your machine off the hard drive.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -