Product SiteDocumentation Site

E.2. GRUB

The GNU GRand Unified Boot loader (GRUB) is a program which enables the selection of the installed operating system or kernel to be loaded at system boot time. It also allows the user to pass arguments to the kernel.

E.2.1. GRUB and the boot process on BIOS-based x86 systems

This section describes the specific role GRUB plays when booting a BIOS-based x86 system. For a look at the overall boot process, refer to Section F.2, “A Detailed Look at the Boot Process”.
GRUB consists of the following images:
  • boot.img: the first image to load in GRUB on BIOS-based x86 systems, which is written to either a master boot record (MBR) or the boot sector of a partition.[6].Because a PC boot sector is 512 bytes, the size of this image is exactly 512 bytes.
    BIOS cannot read partition tables or file systems. It initializes the hardware, reads the MBR, then depends entirely on boot.img to continue the boot process. This image is similar to Stage 1 in GRUB Legacy.
  • diskboot.img: the first sector of the core image once the system boots from a hard disk. It reads the remaining parts of the core image to memory before initializing the kernel.
  • cdboot.img: the first sector of the core image once the system is booted from a CD-ROM drive, similar to diskboot.img.
  • core.img: GRUB's core image, built dynamically by the grub-mkimage program using the kernel image and a list of modules. It typically has sufficent modules to access /boot/grub2, and loads the rest from the file system at run-time.
  • kernel.img: the location of GRUB's basic run-time functions. Although built into all core images, it is rarely used directly.
  • *.mod: the remainder of GRUB is located in dynamically loadable modules. These modules load automatically or are built into the core image if they are essential, or can be initialized manually by the insmod command.
The method used to boot Linux is called direct loading 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, the Microsoft® Windows® operating system, as well as other operating systems, are loaded using chain loading. Under this method, the MBR points to the first sector of the partition holding the operating system, where 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.

Warning

During installation, Microsoft's DOS and Windows installation programs completely overwrite the MBR, destroying any existing boot loaders. If creating a dual-boot system, it is best to install the Microsoft operating system first.


[6] For more on the system BIOS and the MBR, refer to Section F.2.1.1, “BIOS-based x86 systems”.