
Chapter 4.
GRUB
Before Red Hat Linux can load on a system, it must be told to boot by special instructions placed on
a boot loader, a program that exists on the system’s primary hard drive or other media device that
knows how to start the Linux kernel.
If using an x86 system that only boots Red Hat Linux and only one version of the Linux kernel, then
the exact process used by the boot loader to start Red Hat Linux is not very important. The Red Hat
Linux installation program allows users to quickly and easily configure the boot loader in the primary
hard drive’s Master Boot Record (MBR) to load the operating system.
However, in order to have the choice to boot from multiple Linux kernels or other operating systems,
it is essential to have the knowledge of the method used by Red Hat Linux to provide the necessary
boot options, as well as an understanding of the boot process and what to change.
This chapter discusses GRUB, the default method Red Hat Linux uses to launch operating systems
on x86 systems. The chapter will also detail various commands and configuration options that enable
control over the boot process.
4.1. Defining GRUB
GNU GRUB (GRand Unified Bootloader) is a program that installs a boot loader to the MBR, which
exists at the beginning sectors of a disk. It allows the placement of specific instructions in the MBR
that loads a GRUB menu or command environment, which enables users to start the operating system
of choice, pass special instructions to kernels when they boot, or discover system parameters (such as
available RAM) before booting.
4.1.1. x86 Boot Process
When an x86 machine first starts up, the BIOS of the system checks for particular system parameters,
such as the amount of RAM in the machine, the date and time, disk devices present, and the order
in which those disk devices should be checked for bootable media. Usually, the BIOS is configured
to check the machine’s floppy disk drive or CD-ROM drive (or both) before attempting to boot from
the hard drive. If no bootable media can be found in those removable devices, the BIOS usually turns
to the first few sectors of the first hard drive for instructions on where to find and load an operating
system. These first few sectors — the MBR — start the process of loading a pre-selected operating
system, a GRUB menu of operating system options, or a GRUB command line interface to execute
special options.
The process of loading GRUB, and then the operating system, involves several stages of operation:
1. Load the primary boot loader, commonly called Stage 1. The primary boot loader must exist in
the very small space allocated for the MBR, which is less than 512 bytes. Therefore, the only
thing the primary boot loader accomplishes is loading the secondary boot loader, due to the fact
that there is not enough space in the MBR for anything else.
2. Load the secondary boot loader, commonly called Stage 2. The secondary boot loader actually
brings up the advanced functionality that allows you to load a specific operating system. With
GRUB, this is the code that allows you to display a menu or type commands.
3. Load the operating system, such as the Linux kernel, on a specified partition. Once GRUB has
received the correct instructions for the operating system to start, either from its command line
or configuration file, it finds the necessary boot file and hands off control of the machine to that
operating system.
Commenti su questo manuale