Linux VS Solaris boot processes - unix1998/technical_notes GitHub Wiki

Sun Solaris does use a boot block on the boot disk to locate and load the kernel into memory. Similarly, Linux also has a mechanism to achieve this, although the specifics of the process and terminology differ slightly between the two operating systems.

Sun Solaris Boot Process:

  1. Boot PROM (BIOS equivalent):

    • Initializes hardware and performs a Power-On Self-Test (POST).
    • Loads the boot block from the boot disk.
  2. Boot Block:

    • Contains a small program to locate and load the primary boot program.
    • The primary boot program then locates and loads the kernel into memory.
  3. Kernel:

    • Initializes the system and mounts the root filesystem.
    • Starts the init process to bring up user space.

Linux Boot Process:

The Linux boot process is somewhat similar but uses different components and terminology:

  1. BIOS/UEFI:

    • Initializes hardware and performs POST.
    • Locates and loads the bootloader from the boot disk's Master Boot Record (MBR) or GUID Partition Table (GPT).
  2. Bootloader (GRUB):

    • Stage 1: The initial stage of the bootloader is loaded by the BIOS/UEFI from the MBR/GPT. This stage is very small and typically loads the second stage.
    • Stage 1.5 (optional): Sometimes used to understand the filesystem and locate Stage 2.
    • Stage 2: Displays a boot menu, allows the user to select an operating system, and loads the selected kernel into memory along with an initial RAM disk (initrd or initramfs).
  3. Kernel:

    • Initializes system hardware, including CPU, memory, and device drivers.
    • Mounts the root filesystem.
    • Starts the init process (or systemd in modern distributions).
  4. init/systemd:

    • Initializes user space and manages system processes.
    • Brings the system to the desired state (e.g., multi-user mode, graphical mode).

Key Similarities and Differences:

  • Boot Block vs. Bootloader: In Solaris, the boot block directly handles locating the kernel. In Linux, this functionality is handled by a more sophisticated bootloader (like GRUB).
  • Bootloader Stages: Linux bootloaders, especially GRUB, are multi-stage and capable of presenting a user interface for OS selection and configuration. Solaris uses a simpler boot block mechanism.
  • Kernel Loading: Both systems ultimately load a kernel into memory, which then initializes the system and starts the init process.

Linux Example:

Here's a high-level view of the Linux boot process with GRUB as the bootloader:

  1. BIOS/UEFI Initialization:

    • Initializes hardware and POST.
    • Loads the bootloader from the MBR or EFI system partition.
  2. GRUB Loading:

    • Stage 1: Minimal boot code in the MBR/GPT loads Stage 1.5 or Stage 2.
    • Stage 1.5 (if used): Understands filesystem formats and locates Stage 2.
    • Stage 2: Displays a boot menu and loads the selected kernel and initrd/initramfs.
  3. Kernel Initialization:

    • Loads necessary drivers and initializes hardware.
    • Mounts the root filesystem.
    • Starts the init system.
  4. init/systemd Initialization:

    • Reads configuration files to determine which services to start.
    • Brings the system to the desired runlevel or target.

Conclusion

While both Solaris and Linux have mechanisms to locate and load the kernel into memory, the specific processes and tools used differ. Solaris uses a boot block, whereas Linux typically uses a bootloader like GRUB, which offers more flexibility and features during the boot process.

UEFI and BIOS

UEFI (Unified Extensible Firmware Interface), which is indeed newer than the traditional BIOS (Basic Input/Output System). Let's clarify the comparison between UEFI and BIOS:

BIOS (Basic Input/Output System)

  • Role: BIOS is the traditional firmware interface used in older PCs.
  • Purpose: It initializes hardware during the boot process and provides a basic interface between the operating system and the hardware.
  • Features:
    • Limited to 16-bit CPU mode.
    • Relatively simple, text-based user interface.
    • Limited support for modern hardware and features like large hard drives.
  • Lifecycle: BIOS is loaded when the system powers on and runs before the operating system and its bootloader.

UEFI (Unified Extensible Firmware Interface)

  • Role: UEFI is a modern firmware interface that replaces BIOS in newer PCs.
  • Purpose: It initializes hardware and firmware during the boot process and provides a more flexible pre-boot environment than BIOS.
  • Features:
    • Supports 32-bit and 64-bit CPU modes.
    • Provides a more user-friendly graphical interface.
    • Supports larger hard drives (over 2 TB) using the GPT partitioning scheme.
    • Allows for faster boot times and more advanced boot management.
  • Lifecycle: UEFI is loaded when the system powers on and runs before the operating system and its bootloader.

Interaction Between UEFI and Bootloaders (e.g., GRUB)

  • With UEFI: Modern systems with UEFI firmware can load bootloaders like GRUB directly from an EFI system partition. GRUB can be configured as a UEFI application that UEFI firmware loads during the boot process.
  • Boot Process:
    1. UEFI Firmware Initialization: UEFI initializes hardware, checks the boot order, and locates the bootloader in the EFI system partition.
    2. Bootloader Execution: The bootloader (e.g., GRUB) is loaded by UEFI. It presents a boot menu or directly loads the operating system kernel based on its configuration.
    3. Kernel Loading: The bootloader loads the kernel into memory and transfers control to it, starting the operating system.

Timeline

  • BIOS: The traditional firmware interface used in PCs for decades.
  • UEFI: Developed to overcome the limitations of BIOS, UEFI started becoming more common in the mid-2000s.
  • GRUB: First released in 1995, GRUB has been continually updated to support modern firmware interfaces like UEFI.

Summary

  • UEFI is a modern firmware interface that initializes hardware and firmware, replacing the older BIOS system.
  • UEFI is newer and provides advanced features and capabilities compared to BIOS.
  • UEFI and Bootloaders (like GRUB) can work together, with UEFI initializing the system and then loading the bootloader, which in turn loads the operating system.

In short, UEFI is indeed newer than BIOS and offers several advantages over the older BIOS system, including support for modern hardware, larger hard drives, faster boot times, and a more user-friendly interface.