Выбрать главу

GRUB numbers partitions starting at 0, while Linux numbers them starting at 1. 

The remainder of this file configures the two menu options. The first one consists of these four lines:

title Fedora Core (2.6.31-1.3420_fc6 )

 root (hd0,1)

 kernel /vmlinuz-2.6.31-1.3420_fc6 ro root=/dev/main/root rhgb quiet

 initrd /initrd-2.6.31-1.3420_fc6.img

Each line provides specific information:

title Fedora Core (2.6.31-1.3420_fc6)

The title displayed on the menu. The number in parentheses is the kernel version number; since it's standard practice to keep the second-most-recent kernel installed when the kernel is updated, just in case the new kernel does not boot properly, this information enables you to identify which kernel is newer.

root (hd0,1)

The root filesystem for the boot process, written using GRUB notation. Note that this may not be the root directory of the Fedora Core installation; it's usually the filesystem mounted at /boot when the system is running.

kernel /vmlinuz-2.6.31-1.3420_fc6 ro root=/dev/main/root rhgb quiet

The kernel location within the root filesystem, plus boot options. These boot options specify that the root filesystem for Linux is /dev/main/root (logical volume root in volume group main ), and the root filesystem will be mounted read-only ( ro ), that the Red Hat Graphical Boot ( rhgb ) display is enabled, and that noncritical kernel boot messages will be suppressed ( quiet ).

initrd /initrd-2.6.31-1.3420_fc6.img

The location of the initrd ramdisk file. This file contains a compressed filesystem image that contains all of the files other than the kernel necessary for the initial phases of the Fedora system startup, including device drivers, programs, and scripts.

The other title entry is simpler:

title Other

 rootnoverify (hd0,0)

 chainloader +1

The lines in this entry invoke the Windows Stage 2 bootloader, found at the start of the Windows partition:

rootnoverify (hd0,0)

Similar to the root option in the Fedora Core entry, except that this partition will not be mounted, and therefore files cannot be accessed within the partition by GRUB.

chainloader +1

Specifies that the boot process should be turned over to the bootloader found in sector 1 of the partition.

10.5.1.1. Customizing the GRUB menu

You can directly edit the GRUB configuration file to change the appearance of the boot process.

To eliminate the boot menu entirely and directly boot the default entry, set the timeout value to zero:

timeout=0

This is a useful setting for end-user, single-boot systems with a stable kernel. On the other hand, if you have several operating systems installed, it may be convenient to remove the hiddenmenu line and use a longer timeout:

timeout=20

To turn the timeout off and wait indefinitely for the user to select the operating system, remove the timeout line from the file.

10.5.1.2. Using your own splash image

You can also customize or replace the boot image to include your company logo or a personalized message.

Use the GIMP graphics editor to create a 640x480 image. Reduce the number of colors by using the GIMP menu option Image→Mode→Indexed and selecting 14 colors.

When converting an existing image to 14 colors, the result may look better if you select the No Dithering option, especially if the original image contains large areas of solid color. If you are creating a new image, select the indexed mode before you start drawing. 

Save the image in the /boot/grub directory, using the file extension .xpm.gz .

Another way to generate a splash image is to convert an existing landscape-oriented digital photo or a desktop wallpaper file using the ImageMagick convert program:

# convert -resize 640x480 -colors 14 photo.jpg /boot/grub/new_splash.xpm.gz

Finally, edit the splashimage line to point to your new creation:

splashimage=(hd0,1)/grub/new_splash.xpm.gz

An example of a modified splash image is shown in Figure 10-22 .

Figure 10-22. Modified splash image  

10.5.1.3. Creating additional boot entries

Creating additional boot entries is simply a matter of entering additional lines with the options that you want.

For example, you could create two separate entries for Fedora Coreone for runlevel 5 (GUI) and one for runlevel 3 (text mode):

title Fedora Core - Graphical Login ( 2.6.31-1.3420_fc6 )

 root (hd0,1)

 kernel /vmlinuz- 2.6.31-1.3420_fc6 ro root=/dev/main/root rhgb quiet

 initrd /initrd- 2.6.31-1.3420_fc6 .img

title Fedora Core - Text Login ( 2.6.31-1.3420_fc6 )

 root (hd0,1)

 kernel /vmlinuz- 2.6.31-1.3420_fc6 ro root=/dev/main/root rhgb quiet 3

 initrd /initrd- 2.6.31-1.3420_fc6 .img

These two options are identical except for the descriptions on the title lines and the addition of the number 3 to the end of the kernel line for text-mode entry.

Installing a new kernel RPM will add an additional boot option and make it the default. If you are using yum to perform updating, a maximum of two versions of the kernel will be installed at once (configurable in /etc/yum/pluginconf.d/installonlyn.conf), so old kernel versions and their corresponding GRUB entries may be removed from the menu by yum when updating.

10.5.1.4. Installing GRUB's boot record from Fedora

Anaconda normally installs the GRUB boot record on the first disk drive automatically.

There are two situations where it may be necessary to manually install GRUB on an existing system:

 When you're using a RAID 1 /boot partition, Anaconda will install the Grub boot record only on the first disk drive. Having a mirrored copy of /boot won't help if the first disk drive fails and you can't boot from the second drivea situation easily remedied by installing the GRUB boot record on the second drive as well.