What is the GRUB boot loader and what does it do?

0

Heard about the GRUB boot loader, but don’t know what it does? Here is a simple explanation with everything you need to know.


what is grub bootloader

A boot loader is one of the most important components in the boot process of your Linux operating system.

This article will show you what a boot loader is and the role it plays in a Linux system. In particular, this guide will focus on the Grand Unified Bootloader (GRUB), a powerful and very flexible boot loader program. But before looking at GRUB in detail, it’s important to understand the Linux boot process.

The Linux Boot Process

The Linux boot process is a series of activities that occur from the time you press the power button on your PC until the time the login screen appears.

There are four main steps in the process of booting your operating system and they take place in the following order:

  1. BIOS: stands for Basic Input / Output System and is primarily responsible for loading the bootloader. When the computer starts up, it runs a Power On Self Test (POST) to make sure that primary hardware such as memory and hard drive are functioning properly. Next, the BIOS will check the Master Boot Record (MBR) of the primary hard drives, which is a section of your hard drive where the boot loader is located.
  2. Boot loader: Loads the kernel into RAM with a set of kernel parameters.
  3. Core: The main function of the kernel is to initialize peripherals and memory. Then it loads the initialization process.
  4. Init: Responsible for starting and stopping essential services on your system.

To note: BIOS is not a process related to Linux, it is a process that occurs regardless of your operating system.

Learn more: Is a computer’s BIOS considered software, hardware, or firmware?

What is Grand Unified Bootloader?

GRUB is primarily responsible for providing you with a menu of options from which you can select the operating system or environment you wish to boot into. Additionally, GRUB is responsible for loading the Linux kernel.

This is what a GRUB menu option looks like. If multiple operating systems are installed, they will be listed here.

grub boot menu options

To note: GRUB is not only limited to booting on Linux operating systems, you can also use it to boot to other operating systems such as Windows.

There are two main versions of GRUB that are available at the time of writing this article.

  1. GRUB’s legacy: This is the first version of GRUB and was originally developed in 1995.
  2. GRUB 2: This is the latest version of GRUB used by many traditional Linux distributions such as Manjaro, Ubuntu, Fedora, and Red Hat Enterprise Linux (RHEL). GRUB 2 gives you better tools and configuration options than its predecessor.

Besides GRUB, Linux distributions also use other boot loaders such as Linux Loader (LILO), coreboot, and SYSLINUX.

The role of GRUB

Once you have selected the operating system to boot into, GRUB will load the selected kernel. GRUB uses kernel parameters to know where the kernel is located and other important parameters to use.

  • initrd: Used to specify the initial RAM disk.
  • BOOT_IMAGE: The location of the Linux kernel image.
  • root: specifies the location of the root file system. Used by the kernel to find init which in turn loads critical services.
  • ro: Responsible for mounting the filesystem in read-only mode.
  • calm: Hides some system-specific messages when your PC starts up.
  • splash: Used to display the splash screen when your system boots.

When you are in the GRUB options menu, you can change the kernel parameters by pressing the button E key on your keyboard.

Configuring the GRUB Bootloader

GRUB 2 gives you a lot of flexibility and power when it comes to configuring your boot loader.

the / boot / grub directory contains a file named grub.cfg, which is GRUB’s main configuration file. However, it is not recommended to change the grub.cfg file directly, instead you have to edit the / etc / default / grub drop off.

When you make changes to the / etc / default / grub file, you need to make sure to run the command below, so that your changes are written to the grub.cfg file automatically.

sudo update-grub

You can learn more about GRUB and some of its configuration options by running the following command:

info -f grub

Customizing GRUB on Linux

This guide has shown you that GRUB is a very powerful and flexible boot loader and plays a crucial role in the functioning of your operating system. Users have full control over the appearance of the GRUB splash screen. You can even easily customize the background image for the start screen.


change the background image of grub
How to customize the Grub start menu with a background image

Bored of the default Grub menu? Here’s how to personalize it with a background image of your choice.

Read more


About the Author

.


Source link

Share.

Leave A Reply