Skip to content

Commit 0f0fd2b

Browse files
committed
docs: add part 1 of the secure boot blog series
1 parent 5574d7b commit 0f0fd2b

File tree

5 files changed

+250
-0
lines changed

5 files changed

+250
-0
lines changed

docs/rocky_insights/blogs/.pages

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
nav:
3+
- ... | index*.md
4+
- ...
6.71 MB
Loading
7.86 MB
Loading
124 KB
Loading
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
---
2+
title: Modern PC Boot Process
3+
author: Wale Soyinka
4+
ai-contributor: Gemini 3 Flash Image (Nano Banana 2)
5+
---
6+
7+
8+
# UEFI, SHIMs, and Secure Boot
9+
10+
When you press the power button on a modern computer, a complex sequence of events begins long before Linux starts.
11+
Firmware initializes hardware, discovers bootable devices, loads early boot software, and eventually transfers control to an operating system kernel.
12+
For decades this process relied on firmware that performed little or no verification of what it executed. That design made the early boot process an attractive target for malware.
13+
UEFI and Secure Boot were introduced to address this problem.
14+
15+
This article introduces the modern PC boot architecture and explains why Secure Boot exists. Later posts in this series will build on this foundation and explore how Linux distributions integrate with Secure Boot.
16+
17+
18+
## The Boot Process at a High Level
19+
20+
Before diving into technical details, it helps to understand the overall stages of system startup.
21+
22+
A simplified version of the modern boot sequence looks like this:
23+
24+
1. System power on
25+
2. Firmware initialization
26+
3. Hardware discovery
27+
4. Bootloader discovery
28+
5. Bootloader execution
29+
6. Operating system kernel loading
30+
31+
Each stage runs with extremely high privilege. If an attacker can insert malicious code early in this sequence, that code may control everything that runs later.
32+
33+
Because of this, the boot process is a critical security boundary.
34+
35+
36+
## Legacy BIOS Boot
37+
38+
For many years, PCs used the Basic Input Output System aka - BIOS.
39+
40+
BIOS firmware performs hardware initialization and then attempts to load the first sector of a bootable disk into memory.
41+
42+
This sector is called the Master Boot Record.
43+
44+
The Master Boot Record contains both a partition table and a small piece of executable code that loads the next stage of the bootloader.
45+
46+
The process looks roughly like this:
47+
48+
1. BIOS initializes CPU, memory, and hardware devices
49+
2. BIOS selects a boot device
50+
3. BIOS reads the Master Boot Record
51+
4. The MBR code loads additional bootloader code
52+
5. The bootloader loads the operating system
53+
54+
This design has two major limitations.
55+
56+
First, the Master Boot Record is only 512 bytes, which severely limits functionality.
57+
58+
Second, BIOS performs no cryptographic verification of what it loads.
59+
60+
If malicious software modifies the MBR, the firmware will execute it without question.
61+
62+
This weakness allowed the creation of a class of malware called bootkits.
63+
64+
## Bootkits and Early Boot Malware
65+
66+
Bootkits are designed to infect the earliest stages of the boot process.
67+
68+
Unlike normal malware that runs inside the operating system, bootkits execute before the operating system kernel loads.
69+
70+
This makes them particularly potent because:
71+
72+
- They can hide from operating system security tools
73+
- They can intercept kernel loading
74+
- They can modify system memory before protections activate
75+
76+
Historically, bootkits targeted components like - The Master Boot Record, Bootloader code, and Firmware extensions
77+
78+
Because BIOS performed no signature verification, attackers only needed write access to disk or firmware to persist across reboots.
79+
80+
These weaknesses motivated the industry to rethink the boot architecture.
81+
82+
![Legacy BIOS Boot Process](images/fig_1_secure_boot_1.png)
83+
84+
85+
## The Move to UEFI
86+
87+
The Unified Extensible Firmware Interface replaces the legacy BIOS model.
88+
89+
UEFI provides a more flexible firmware environment and introduces the concept of executing EFI applications during boot.
90+
91+
Instead of loading a tiny 512 byte sector, UEFI loads full executable files stored on a dedicated partition called the EFI System Partition.
92+
93+
These files use the PE executable format and typically have the extension `.efi`.
94+
95+
Examples include:
96+
97+
- Bootloaders such as GRUB
98+
- Boot managers such as systemd-boot
99+
- Firmware utilities
100+
101+
!!! note "Bootloader vs Boot Manager"
102+
103+
A *boot manager* is responsible for selecting which operating system or boot entry should be started. It presents a menu of choices and decides which boot target to launch. A *bootloader*, on the other hand, is responsible for loading the operating system kernel into memory and transferring control to it.
104+
105+
In many Linux systems these roles are combined in the same program. For example, GRUB2 can present a boot menu (acting as a boot manager) and then load the Linux kernel (acting as a bootloader).
106+
107+
108+
The modern boot flow looks roughly like this:
109+
110+
1. System power on
111+
2. UEFI firmware initializes hardware
112+
3. Firmware loads configuration variables
113+
4. Firmware searches for EFI boot entries
114+
5. Firmware loads an EFI application
115+
6. The EFI application loads the operating system kernel
116+
117+
This architecture allows much richer functionality than the legacy BIOS model.
118+
119+
However, it also creates a larger attack surface.
120+
121+
![UEFI Boot Process](images/fig_2_secure_boot_1.png)
122+
123+
## The EFI System Partition
124+
125+
UEFI systems store bootloaders in a dedicated partition known as the EFI System Partition.
126+
127+
This partition is usually formatted with FAT32 and mounted at `/boot/efi` in Linux systems.
128+
129+
Use the `tree or ls command to view the contents of the EFI System Partition:
130+
131+
```
132+
# tree /boot/efi/
133+
/boot/efi/
134+
└── EFI
135+
├── BOOT
136+
│   ├── BOOTX64.EFI
137+
│   └── fbx64.efi
138+
└── rocky
139+
├── BOOTX64.CSV
140+
├── grub.cfg
141+
├── grubx64.efi
142+
├── mmx64.efi
143+
├── shim.efi
144+
├── shimx64.efi
145+
└── shimx64-rocky.efi
146+
```
147+
148+
You'll notice some important EFI executables under the `/boot/efi/EFI/rocky/` sub-folder such as `shimx64.efi`, `grubx64.efi`, and so on. Because these files are executed directly by the firmware, they act as critical security components.
149+
150+
These EFI binaries/executables form the beginning of the Linux boot chain.
151+
152+
Later articles will explore how these files are signed and verified.
153+
154+
155+
## Why Secure Boot Was Introduced
156+
157+
UEFI alone does not automatically make systems secure.
158+
159+
Without verification, firmware would still execute any EFI binary it encounters.
160+
161+
Secure Boot adds a cryptographic verification step.
162+
163+
When Secure Boot is enabled, firmware verifies that EFI binaries are signed by trusted certificates before executing them.
164+
165+
If a binary is not signed by a trusted key, the firmware refuses to run it.
166+
167+
This mechanism establishes the beginning of a trust chain that continues through the bootloader and eventually to the operating system kernel.
168+
169+
170+
171+
## The Concept of a Chain of Trust
172+
173+
Secure Boot works by extending trust from one component to the next.
174+
175+
Each stage verifies the next stage before executing it.
176+
177+
The process follows this pattern:
178+
179+
1. Firmware verifies an EFI application
180+
2. The EFI application verifies the next boot component
181+
3. The bootloader verifies the operating system kernel
182+
183+
If any stage fails verification, the boot process stops.
184+
185+
Later articles will explore how this trust chain works in detail.
186+
187+
188+
189+
## Hands-On: Determine Whether Your System Uses UEFI
190+
191+
You can quickly determine whether a Linux system booted using UEFI.
192+
193+
Run the following command:
194+
195+
```
196+
ls /sys/firmware/efi
197+
```
198+
199+
If the directory exists, the system booted using UEFI.
200+
201+
If the directory does not exist, the system booted using legacy BIOS mode.
202+
203+
204+
205+
## Hands-On: View UEFI Boot Entries
206+
207+
UEFI firmware stores boot configuration entries that point to EFI executables.
208+
209+
You can inspect them using the `efibootmgr` tool.
210+
211+
Install it if necessary:
212+
213+
```
214+
sudo dnf -y install efibootmgr
215+
```
216+
217+
Then run:
218+
219+
```
220+
efibootmgr -v
221+
```
222+
223+
This displays boot entries stored in firmware along with the paths to EFI executables.
224+
225+
Example output is shown in the figure below:
226+
227+
![UEFI Boot Entries](images/fig_3_secure_boot_1.png)
228+
229+
These entries tell firmware which EFI applications to launch during boot.
230+
231+
232+
## Summary
233+
234+
In this article we explored how modern systems boot and why Secure Boot was created.
235+
236+
Key ideas introduced here include:
237+
238+
- The limitations of legacy BIOS boot
239+
- The design of UEFI firmware
240+
- The role of EFI applications
241+
- The importance of early boot security
242+
243+
In the next installment of this secure boot series, we will examine the cryptographic foundations that make Secure Boot possible.
244+
245+
We will introduce digital signatures, public key cryptography, and the concept of a chain of trust.
246+

0 commit comments

Comments
 (0)