GRUB

GNU GRand Unified Boot loader or GRUB is a program which enable the user to select which installed operating system or kernel to load at system boot time. It also allows the user to pass arguments to the kernel.

GRUB and the x86 Boot Process

This section will discuss in more detail the specific role GRUB plays when booting an x86 system. For a detailed look at the overall boot process, see the Section called A Detailed Look at the Boot Process in Chapter 3.

GRUB loads itself into memory in the following stages:

  1. The Stage 1 or primary boot loader is read into memory by the BIOS from the MBR[1]. The primary boot loader exists on less than 512 bytes of disk space within the MBR. The only thing it does is load the Stage 1.5 or Stage 2 boot loader.

  2. The Stage 1.5 boot loader is read into memory by the Stage 1 boot loader only if necessary. Some hardware requires an intermediate step to get to the Stage 2 boot loader. This is sometimes true when the /boot partition is above the 1024 cylinder head of the hard drive or when using LBA mode. The Stage 1.5 boot loader is found either on the /boot partition or on a small part of the MBR and the /boot partition.

  3. The Stage 2 or secondary boot loader is read into memory. The secondary boot loader displays the GRUB menu and command environment. This interface allows you to select which operating system or Linux kernel to boot, pass arguments to the kernel, or look at system parameters, such as available RAM.

  4. The secondary boot loader reads the operating system or kernel and initrd into memory. Once GRUB determines which operating system to start, it loads it into memory and hands control of the machine to that operating system.

The boot method used to boot Red Hat Linux is called the direct loading method because the boot loader loads the operating system directly. There is no intermediary between the boot loader and the kernel.

The boot process used by other operating systems may differ. For example, Microsoft's DOS and Windows operating systems, as well as various other proprietary operating systems, are loaded using a chain loading boot method. Under this method, the MBR simply points to the first sector of the partition holding the operating system. There it finds the files necessary to actually boot that operating system.

GRUB supports both direct and chain-loading boot methods, allowing it to boot almost any operating system.

WarningWarning
 

During installation, Microsoft's DOS and Windows installer completely overwrites the MBR, destroying any existing boot loader. If creating a dual boot system, it is best to install the Microsoft operating system first. For instructions on how to do this, see the appendix titled Installing Red Hat Linux in a Dual-Boot Environment in the Official Red Hat Linux Installation Guide.

Features of GRUB

GRUB contains a number of features that make it preferable to other boot loaders available for the x86 architecture. Below is a list of some of the more important features:

Notes

[1]

For more on the system BIOS and the MBR, see the Section called The BIOS in Chapter 3.