lsg04.htm

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTM 代码 · 共 3,109 行 · 第 1/5 页

HTM
3,109 行
字号
<LI>Reboot the machine to boot BOOTACTV from the Master Boot Record.







<BR>







<BR>







</OL>







<P>Your machine should load BOOTACTV and allow you to boot any other operating system on a partition. If Linux or another operating system does not boot, use your boot floppy disk to start Linux. If only Linux doesn't boot, the boot sector LILO for the Linux partition is not working and can be rewritten using the setup or LILO configuration utilities. If none of the partitions boot, remove BOOTACTV by replacing the old Master Boot Record with the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">dd if=/fd/MBR of=/dev/hda bs=446 count=1</FONT></PRE>







<P>You can also reinstall the Master Boot Record from within DOS, if you have a DOS boot floppy disk. When in DOS, issue the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">fdisk /mbr</FONT></PRE>







<BLOCKQUOTE>







<BLOCKQUOTE>







<HR ALIGN=CENTER>







<BR>







<NOTE>If you don't want to alter your Master Boot Record but have more than one partition dedicated to Linux, you can install BOOTACTV on one of the partition's boot sectors and use the fdisk utility to toggle the active partition. However, if the hard disk is repartitioned or the filesystems are altered in size, the boot sector will have to be rewritten. To write BOOTACTV to the fourth primary hard disk partition, for example, copy the existing MBR to the partition's boot sector, and then install BOOTACTV with the following commands:







<BR>dd if=/dev/hda of=/dev/hda4 bs=512 count=1







<BR>dd if=bootactv.bin of=/dev/hda4 bs=446 count=1</NOTE>







<BR>







<HR ALIGN=CENTER>







</BLOCKQUOTE></BLOCKQUOTE>







<BR>







<A NAME="E69E49"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Installing DOS and Linux</B></FONT></CENTER></H4>







<BR>







<P>Most Linux installations coexist with DOS and use the DOS Master Boot Record. In this case, the MBR is read and the active partition (set by fdisk) is booted automatically. This installation method is one of the safest because no changes to the DOS-installed Master Boot Record are performed, and it is easy to remove or reconfigure partitions at any time without worrying about compatibility with the MBR.







<BR>







<BLOCKQUOTE>







<BLOCKQUOTE>







<HR ALIGN=CENTER>







<BR>







<NOTE>Later versions of DOS (6.00 or higher) will overwrite an existing MBR if they are installed after Linux. If this happens, you won't be able to boot Linux from the MBR, although DOS will boot. You can fix the problem by running LILO again or by making the Linux partition active.</NOTE>







<BR>







<HR ALIGN=CENTER>







</BLOCKQUOTE></BLOCKQUOTE>







<P>You can change the active partition at any time using the fdisk utility or the Linux utility activate. The setup program within Linux can usually change the boot partition, too. Only one partition on a hard disk can be active at a time. Some operating systems, including Linux, let you change your mind about which operating system to boot after the active partition has been read, assuming a delay was built into the boot process. Linux, for example, can display the boot prompt and wait for a reply or a timeout to occur before starting to boot Linux.







<BR>







<P>To use this type of approach for Linux, install LILO into the boot sector of the Linux partition. To make it bootable, run fdisk and set that partition number as the active partition. Rebooting the machine will boot into the active partition. When Linux is replaced or removed, the boot sector of the new operating system will overwrite the Linux partition's boot sector, requiring no changes to the MBR.







<BR>







<BR>







<A NAME="E69E50"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Using BOOTLIN</B></FONT></CENTER></H4>







<BR>







<P>With the Linux BOOTLIN configuration, which is also a common method of installation, the Master Boot Record does not change. During the boot process, the Master Boot Record is read, and then a decision about which operating system to load is made. This decision is usually based on a user prompt. Essentially, this boot process is the same as a normal DOS boot except the program BOOTLIN is invoked in either the CONFIG.SYS or AUTOEXEC.BAT files. This program can then execute a program that lets you choose the operating system to load. The program BOOT.SYS, for example, may be used to present a menu that enables you to choose between a Linux and DOS boot.







<BR>







<P>To install BOOTLIN in your DOS partition, follow these steps:







<BR>







<OL>







<LI>Boot Linux. Make sure you have a boot floppy disk in case of problems.







<BR>







<BR>







<LI>Place a copy of the Linux kernel in your DOS partition either through DOS or with one of the Linux Mtools. You only have to copy the kernel file into the home directory (or any subdirectory) of the DOS partition. You can even do this step from the floppy disk.







<BR>







<BR>







<LI>Copy BOOT.SYS and BOOTLIN.SYS to the DOS partition, using the same process you used to copy the Linux kernel.







<BR>







<BR>







<LI>Add both the BOOT.SYS and BOOTLIN.SYS files to your CONFIG.SYS file.







<BR>







<BR>







<LI>Make sure DOS is the active partition, and reboot the machine.







<BR>







<BR>







</OL>







<P>When DOS starts, the BOOT device driver should give you the option of booting DOS or Linux. If you have problems, remove the BOOT.SYS and BOOTLIN.SYS files from the CONFIG.SYS file and you are back to normal.







<BR>







<P>Using the BOOT.SYS program has a useful advantage in that no boot sectors are altered to support several operating systems. As a result, loading and removing operating systems from a hard disk is easier. You can use both the Master Boot Record with active partition and BOOT.SYS approaches so that the hard disk starts to boot whichever operating system has the active flag, and then pauses and waits for confirmation from the user (or a timeout to occur). In this case, no changes to the Master Boot Record need to be made.







<BR>







<BR>







<A NAME="E69E51"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Automated LILO Creation</B></FONT></CENTER></H4>







<BR>







<P>Most recent versions of Linux, including the one supplied on this book's CD-ROM, let you manage LILO through a menu-driven routine usually started through setup. Typically, when you have made any changes to the installation (such as adding new software), the last component of the setup program asks you whether you want to work with LILO. Figure 4.3 shows this screen.







<BR>







<P><B> <A HREF="04LSG03.gif">Figure 4.3.</B>







<BR><B>Whenever you make changes to Linux through the </B><B>setup</B><B> utility, it asks </B><B>whether you want to use LILO.</A></B>







<BR>







<P>From the menu-driven system shown in Figure 4.3, select the Begin option. Usually, the first thing the program asks for is any boot-time instructions that need to be specified when Linux starts, as shown in Figure 4.4. Normally, there are no boot-time instructions, but if you had to enter any parameters to start the Linux installation process, specify the same options here.







<BR>







<P><B> <A HREF="04LSG04.gif">Figure 4.4.</B>







<BR><B>The LILO installation process starts by asking whether you need any </B><B>special boot-time instructions.</A></B>







<BR>







<P>The next prompt, shown in Figure 4.5, asks where you want your LILO instructions written. The primary options were discussed earlier in the chapter. This version of LILO lets you select the Master Boot Record (MBR), the master sector of the primary Linux partition (called a superblock on this screen), or a floppy disk. The method you select depends on how you want Linux to start and whether it coexists with another operating system. For a minimal impact on your system, select the floppy disk boot option. This option requires you to place the boot floppy disk in the floppy disk drive when starting the machine, but then it boots cleanly into Linux. If the boot floppy disk is left out of the floppy disk drive, any other active partition (such as DOS or OS/2) is booted. Because the LILO instructions are only written to floppy disk with this approach, existing MBRs or partition boot sectors don't change at all. This approach makes it very easy to remove Linux and prevent problems with other operating systems that exist on your drives.







<BR>







<P><B> <A HREF="04LSG05.gif">Figure 4.5.</B>







<BR><B>You are asked where you want to install LILO.</A></B>







<BR>







<P>If you are installing only Linux, or plan to have very rare use of existing DOS or OS/2 partitions, use the Master Boot Record of partition boot sector. The only drawback to this approach is that, you must low-level format your hard drive if you want to remove Linux in the future. The Linux MBR is not compatible with DOS'.







<BR>







<P>A compromise is to use the partition boot sector (superblock). This approach lets you boot straight into Linux when the partition is active or use fdisk to activate any other partition. Although this option has more impact than the floppy disk boot option, yo can easily remove it by reformatting the partition and installing a new operating system.







<BR>







<BLOCKQUOTE>







<BLOCKQUOTE>







<HR ALIGN=CENTER>







<BR>







<NOTE>If you are installing Linux to experiment with it and you are not sure whether you will leave it on your hard drive, use the boot floppy disk. This option provides the most hassle-free approach for backing out of Linux in the future. You can always rerun LILO and write the boot instructions to the MBR or superblock later.</NOTE>







<BR>







<HR ALIGN=CENTER>







</BLOCKQUOTE></BLOCKQUOTE>







<P>The LILO system asks you whether you want a delay before Linux starts to boot, as shown in Figure 4.6. You can decide to not pause, to wait either 5 or 30 seconds, or to wait until LILO is told explicitly to boot. This last option is useful if you have two operating systems on your hard drive because it saves you from fooling around with fdisk to alter the active partition. A good compromise is either 5 or 30 seconds.







<BR>







<P><B> <A HREF="04LSG06.gif">Figure 4.6.</B>







<BR><B>You can set a delay before booting into Linux with one of the options </B><B>shown in this menu.</A></B>







<BR>







<P>After you set the delay, LILO returns you to the main LILO menu (shown in Figure 4.3). The next step is to identify the partitions that LILO will know about. The menu lists three operating systems: DOS, OS/2, and Linux. If you have either DOS or OS/2, you can give the partition information to LILO to allow it to boot this operating system instead of Linux (assuming you have a delay in the boot process). Begin with the Linux operating system, though. Select Linux on the menu (the menu choices are in order of most common use from top to bottom, generally) to display the Linux partition information screen shown in Figure 4.7.







<BR>







<P><B> <A HREF="04LSG07.gif">Figure 4.7.</B>







<BR><B>Use this screen to identify the boot Linux partition. In this example, </B><B>only a single Linux data partition exists.</A></B>







<BR>







<P>The example shown in Figure 4.7 shows a single Linux data partition on the hard drive, called /dev/sda3. The Linux swap partitions never show up on these lists (unless they were misidentified when they were installed). Enter the name of the Linux partition that is to be used for the boot partition (in the example, /dev/sda3 would be typed in the entry field). The next screen, shown in Figure 4.8, asks for a name for this partition. This name is used to identify the partition at boot time. For Linux partitions, just enter the word Linux to provide an unambiguous name for the partition.







<BR>







<P><B> <A HREF="04LSG08.gif">Figure 4.8.</B>







<BR><B>You need to assign a name to the Linux partition.</A></B>







<BR>







<P>After entering the partition name, you are back to the main LILO menu. Now, add any other operating systems, such as DOS or OS/2. To install a DOS partition, for example, select DOS from the menu. A screen very similar to the one for selecting the Linux partition appears, as shown in Figure 4.9. Enter the name of the DOS partition (in this case, /dev/sda1).







<BR>







<P><B> <A HREF="04LSG09.gif">Figure 4.9.</B>







<BR><B>When you add another operating system to LILO, the partitions that apply </B><B>are displayed. You can add this partition to the LILO boot table.</A></B>







<BR>







<P>After the partition has been identified, name the partition as shown in Figure 4.10. Again, a simple name is best, so enter DOS or OS/2 as applicable. Don't bother with fancy names; they are more trouble than they are worth!







<BR>







<P><B> <A HREF="04LSG10.gif">Figure 4.10.</B>







<BR><B>As with the Linux partition, you need to assign a name to the other </B><B>partitions LILO will know about.</A></B>







<BR>







<P>After you name all the partitions, you are brought back yet again to the LILO menu. The next step is to install the LILO information. Select the Install option from the menu. The system writes all the partition details you've supplied, and then you can exit LILO. The other options on the LILO menu allow you to modify an existing LILO table. In most cases, it's easier to just start again. You can use this automated LILO installation any time you want. Take care that you enter the proper information, though, as an error can make it impossible to access a partition. Keep an emergency boot disk handy!







<BR>







<BR>







<A NAME="E69E52"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Setting Boot Parameters</B></FONT></CENTER></H4>







<BR>







<P>Regardless of which boot process you use, LILO pauses momentarily when Linux is booting to check that the Shift, Ctrl, and Alt keys are not pressed and that Caps Lock and Scroll Lock are set. If none of the keys are pressed and the locks are on, LILO displays the boot prompt. At this point, LILO is waiting for the name of the boot image to use to be entered. If a timeout occurs or Enter is pressed, the default boot image is loaded. The boot image is the kernel of whichever operating system is to be loaded, including DOS.







<BR>







<P>If you want to boot an image other than the default, you can enter its name at the boot prompt. To obtain a list of all known boot images, enter a question mark or hit the Tab key (depending on the image and keyboard setting). Recent versions of Linux set the boot image name in a LILO file, as described in the next section. With some earlier versions of Linux, the name of the default boot image is located in the file /etc/rc (or in a file in the subdirectory /etc/rc.d) on a line with the keyword







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">BOOT_IMAGE=</FONT></PRE>







<P>You also can specify parameters for the kernel by entering them at the boot prompt. Unless overridden, the parameters will be used by the default image when it boots. Valid parameters differ a little depending on the version of Linux, but most versions support the following:







<BR>







<UL>







<LI>The no387 parameter disables any on-board floating-point unit (FPU).







<BR>







<BR>







<LI>The root parameter boots from a device specified after the root parameter, such as root=/dev/sda1. The root command takes either a hexadecimal device number or the full path name of the device.







<BR>



⌨️ 快捷键说明

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