Skip to content

Latest commit

 

History

History
81 lines (52 loc) · 2.15 KB

File metadata and controls

81 lines (52 loc) · 2.15 KB

What is GRUB?

GRUB (GRand Unified Bootloader) is an operating system bootloader. It acts as a "conduit" between turning on the computer and starting the kernel.


GRUB's Main Function

When the computer turns on:

  1. The device runs very simple code (BIOS/UEFI).
  2. This code looks for a bootloader, such as GRUB.
  3. GRUB loads the kernel into memory and transfers control to it.

In other words, without a bootloader, the kernel cannot start.


Why is GRUB needed?

The computer itself doesn't know where the kernel is located on the disk. GRUB can:

  • find the kernel on the disk
  • pass it startup parameters
  • select between multiple kernels or operating systems
  • support booting from different devices (HDD, SSD, USB, network)

How does GRUB work?

GRUB consists of several parts:

  1. Stage 1 — the minimal code at the very beginning of the disk. It knows where to find Stage 2.

  2. Stage 2 — the main bootloader code. It can:

  • read file systems
  • display the kernel selection menu
  • load the kernel into memory
  1. Configuration file — determines:
  • which kernels are available
  • command-line parameters for the kernel
  • timer and selection menu

GRUB Features

  • Kernel or OS selection: you can have multiple kernel versions and select the one you need.
  • Passing parameters to the kernel: for example, how much memory to use, which drivers to enable.
  • Works with different file systems: FAT, NTFS, ext4, and others.
  • Command line mode: allows you to manually load the kernel or fix errors.

Why is GRUB used almost everywhere?

  • Universal: supports different architectures and kernels.
  • Flexible: you can add your own scripts and menus.
  • Reliable: can correctly load the kernel even from multiple drives.

A Brief Introduction to GRUB's Role

BIOS/UEFI → GRUB → Kernel → Init/Userspace → Programs
  • BIOS/UEFI — minimal startup code
  • GRUB — finds and starts the kernel
  • Kernel — manages the hardware
  • Init/Userspace — starts the terminal, programs, and interfaces

Without GRUB (or another bootloader), the kernel cannot start.