Oct. 25, 2020, 5:04 p.m.

Learn a bunch of shit by installing Arch Linux - Pt. 2 #0009

Learning Computations

This is the second article in a series called learn a bunch of shit while installing Arch Linux. This week we'll be talking about the boot process. Originally I was going to cover networking as well, but we won't be able to get to it this time.

As I was digging into the boot process for Arch I quickly realized just how much shit there is to understand. I mean there's just way more information than I ever imagined on booting. I did my best to understand the boot process, but I'm not an expert. So the plan is to do an overview of the boot process, and for those who want to learn more I've included resources that'll let you do that.

Alright let's jump into it.

The Boot Process under UEFI

So how does the Arch boot process work?

Under UEFI
    1. System switched on, the power-on self-test (POST) is executed.
    2. After POST, UEFI initializes the hardware required for booting (disk, keyboard controllers etc.).
    3. Firmware reads the boot entries in the NVRAM to determine which EFI application to launch and from where (e.g. from which disk and partition).
        A boot entry could simply be a disk. In this case the firmware looks for an EFI system partition on that disk and tries to find an EFI application in the fallback boot path \EFI\BOOT\BOOTX64.EFI (BOOTIA32.EFI on systems with a IA32 (32-bit) UEFI). This is how UEFI bootable removable media work.
    4. Firmware launches the EFI application.
        This could be a boot loader or the Arch kernel itself using EFISTUB.
        It could be some other EFI application such as a UEFI shell or a boot manager like systemd-boot or rEFInd.

Arch Boot Process

This is what happens at a high level when you turn on your computer. Let's dig through the terminology so we have a clearer picture of what's happening.

  1. What is POST? POST stands for "Power On Self Test" and it's generally firmware that runs right after a system is turned on in order to make sure the hardware is working properly. Firmware is software that tells hardware what to do.

    In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware.

    Firmware

  2. What is NVRAM? NVRAM means Non-Volatile Random Access Memory. Generally RAM loses whatever data was stored on it after it loses power. That's what makes it volatile. Hard disks on the other hand don't lose data after losing power. So they're non-volatile.

  3. What is the EFI system partition?

an OS independent partition that acts as the storage place for the EFI bootloaders, applications and drivers to be launched by the UEFI firmware

EFI system partition

What are bootloaders and bootmanagers?

Two similar terms are often used interchangeably, but in fact they refer to different things:
    - Boot managers: present a menu of boot options, or provide some other way to control the boot process. The user can then select an option, and the boot manager passes control to the selected tool.
    - Boot loaders: handle the task of loading an OS kernel into memory, often along with support files such as a Linux initial RAM disk (initrd) file, and starting the kernel running.

Managing EFI Boot Loaders for Linux: Basic Principles

Hopefully that's enough terminology for you to be able to review the high level process above and give you a better idea about what's happening.

As you've probably noticed by now there's a shit ton of stuff going on here. Unfortunately I don't have the time to cover all these components in this article so I'm going to do as one does and refer you to some great resources.

  • Arch Boot Process
  • UEFI boot: how does that actually work, then?
  • initial RAM disk

Other interesting resources

  • Inside the Linux boot process
  • Linux Startup Process
  • init
  • Mounting - There is talk about mounting in some of these recourse. If your not familiar with it then I recommend checking out this stack exchange question.

You just read issue #9 of Learning Computations. You can also browse the full archives of this newsletter.

Powered by Buttondown, the easiest way to start and grow your newsletter.