Zonggen's Blog


[TLDR] GRUB, dracut, systemd and Bootup Process

Posted at — Jun 27, 2019

  1. BIOS POST: issues interrupt INT13H to find boot sectors on bootable device
  2. Boot Loaders (LILO / GRUB / GRUB2): loads Linux Kernel into memory and running
    • stage1: runs bootstrap code that loaded by BIOS POST in Master Boot Record (MBR)
      • stage1 does not understand file system, the only purpose of stage1 is to locate and load stage1.5
    • stage2: locates the stage 2 files in the /boot filesystem and load the needed drivers.
      • understands common filesystem drivers, e.g. EXT, FAT, NTFS, etc.
      • stored in core.img
    • stage3: locates and loads a Linux kernel into RAM and turns control over to the kernel
      • located in /boot/grub2
      • runtime kernel modules located in /boot/grub2/i386-pc
  3. Kernel: located in /boot along with initramfs image and device maps of the hard drives
    • de-compressed in memory
    • executes initrd, an initial RAM disk image generated by dracut
      • note: The initramfs has (basically) one purpose in life – getting the rootfs mounted so that we can transition to the real rootfs.
    • systemd: PID=1, init process, daemon
      • responsible for probing all remaining hardware, mounting all necessary file systems and spawning all configured services.

References: