When a processor powers on, it goes through a series of steps to initialize hardware, configure memory, and load the operating system. This sequence of events is referred to as the boot process or boot sequence. The exact steps vary between processor architectures, but generally involve the following high-level phases:
The first phase in the processor boot sequence is the Power-on Self-Test, or POST. When power is first applied to the processor, it will begin executing firmware contained in read-only memory. The firmware POST code will initialize and test critical hardware components like the CPU, RAM, and basic peripherals to ensure they are functioning properly before handing control over to the operating system.
Typical POST tasks include:
- Testing CPU registers and caches
- Initializing memory controllers and RAM
- Enabling cache
- Configuring and testing PCI, PCIe, and other device buses
- Initializing secondary processors (in multi-core or multi-CPU systems)
- Performing power-on self-tests for different hardware modules
The POST process outputs any diagnostic codes or messages to the display, commonly beeps, to indicate the status of the tests. Once POST has completed, the boot process can continue to the next phase.
After POST, the next step is to load and execute the boot loader. The boot loader is a small program stored in non-volatile memory that is responsible for loading the larger operating system. It provides an intermediary step between the firmware POST process and the operating system kernel.
On most systems, the boot loader is stored in the master boot record of the boot disk and includes two stages:
- Stage 1 Boot Loader – This is a tiny program that fits in the master boot record and can access the filesystem on the boot disk. It locates and loads the next stage boot loader program.
- Stage 2 Boot Loader – This second-stage boot loader is more capable and can load files from disk, configure hardware, and provide a user interface for selecting boot options. Examples include GRUB for Linux and Bootmgr for Windows.
The boot loader may perform tasks such as:
- Selecting a kernel image to launch
- Passing kernel parameters from boot options
- Loading the initial RAM disk or initrd
- Setting the initial video mode
- Checking and comparing kernel version numbers
- Detecting other OS installations and enabling multi-boot
Once the boot loader has prepared the system, it can jump to the kernel code and begin booting the operating system.
Initialize and Launch Kernel
The kernel forms the core of the operating system. It includes the software that manages the computer’s resources – CPU, memory, I/O, and peripherals. The bootloader loads the compressed kernel image and any initial RAM disks or filesystems into memory, and then decompresses and executes the kernel code.
The initialization stage of the kernel typically involves:
- Setting CPU registers and modes
- Initializing kernel subsystems
- Mounting the root filesystem
- Starting essential background processes
- Launching initial userspace programs
The final step of the boot process is to switch from kernel mode to user mode, and hand over control to the init system, the first process launched by the kernel at startup. The init system handles starting all other user applications. At this point, the system is fully booted and operational for users to log in.
ARM Boot Sequence Specifics
ARM processors have some unique elements in their boot process that differ from the standard PC sequence described above:
- BootROM – Contains fundamental bootstrap code invoked on processor reset. Initializes critical hardware and loads next stage bootloader.
- First-stage Bootloader – Typically contained in device on-chip flash memory. Locates and loads OS image from boot device.
- Second-stage Bootloader – More advanced bootloader that can unpack kernel images, load device drivers, and start the OS. Example: U-Boot.
There are also some common variations in ARM boot sequences:
- Trusted Boot – Cryptographically verifies integrity of bootloader and kernel images before launching.
- Secure Boot – Prevents unauthorized or modified code from running during boot process.
- Fastboot – Optimized boot process that loads Android OS and gets to home screen quickly.
Boot Sequence Customization
While the general boot steps are defined by the hardware and platforms, there are many points where the sequence can be customized, including:
- Selecting which device to boot from via BIOS/UEFI settings
- Choosing alternate operating systems via boot manager menu
- Editing bootloader configs to change boot options or kernel parameters
- Modifying init scripts or systemd units to launch different programs on startup
- Implementing security measures like UEFI Secure Boot or Trusted Platform Module (TPM)
- Bypassing certain steps for faster booting, such as directly launching OS from bootloader
Understanding the boot process helps troubleshoot issues when customizing or optimizing system startup. The boot sequence establishes the hardware and software stack that supports everything running on the processor.
The processor boot sequence goes through a standard series of phases to ready the hardware and boot the operating system: Power-on Self-Test initializes hardware; bootloader reads from disk and loads the kernel; kernel initializes and starts essential processes; and finally user applications launch. ARM boot processes follow a similar order, with some variations. Customizations like boot options, alternate OS loading, and optimized startup are also possible during the sequence.