SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: Armv8 Boot Sequence
SUBSCRIBE
SoCSoC
Font ResizerAa
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Search
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Have an existing account? Sign In
Follow US
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
© S-O-C.ORG, All Rights Reserved.
Arm

Armv8 Boot Sequence

Andrew Irwin
Last updated: September 22, 2023 12:13 pm
Andrew Irwin 7 Min Read
Share
SHARE

When an Arm v8-based system powers on, it goes through a complex boot process to load and initialize the operating system. This boot process involves multiple stages, from low-level firmware executing to load the kernel, to starting init processes that fully initialize userspace. Understanding the full Arm v8 boot flow provides insight into the boot architecture and timing.

Contents
Boot Stages1. System Boot Stage2. Firmware Boot Stage3. Bootloader Stage4. Kernel InitializationBoot TimingBoot CustomizationSecurity ConsiderationsDebugging the Boot SequenceConclusion

Boot Stages

The Arm v8 boot process can be divided into four high-level stages:

  1. System Boot Stage – Power on, perform basic SoC initialization
  2. Firmware Boot Stage – Initialize hardware, load bootloader
  3. Bootloader Stage – Locate, load, and transfer control to the kernel
  4. Kernel Initialization Stage – Mount filesystems, start init process, begin scheduling applications

Within these stages are more detailed steps that progressively initialize more complex hardware and software components.

1. System Boot Stage

When power is first applied to an Arm v8 system, the system boot stage begins. This involves the initial SoC bring up and initialization:

  1. Power on reset sequence
  2. Execute boot ROM code
  3. Initialize CPU and memory
  4. Configure clock circuitry and I/O pins
  5. Initialize on-chip RAM and any boot devices

These low-level actions are governed by proprietary code in the SoC boot ROM. This establishes a basic hardware environment sufficient to load and run more complex firmware.

2. Firmware Boot Stage

After the system boot stage, firmware boot routines take over:

  1. Load system firmware (e.g. UEFI)
  2. Perform hardware initialization – buses, peripherals
  3. Initialize DRAM and memory controllers
  4. Verify/initialize persistent storage
  5. Load bootloader to RAM

Arm development boards like the Juno board utilize UEFI as firmware. UEFI initializes hardware, drives device detection, and contains services for loading images from storage. The end goal is to load a bootloader like U-Boot into memory and transfer control to it.

3. Bootloader Stage

With the bootloader loaded into RAM, it takes over to handle OS booting duties:

  1. Parse boot configuration and parameters
  2. Initialize networking and drivers
  3. Locate kernel image on boot device
  4. Load kernel image into RAM
  5. Parse kernel image format to find entry point
  6. Decompress kernel if needed
  7. Transfer control to kernel entry point

The bootloader stage handles key tasks like locating the kernel image, loading it into the right memory region, and setting up any kernel arguments before jumping into it.

4. Kernel Initialization

With the uncompressed kernel image loaded into RAM and control passed to its entry point, the lengthy kernel initialization can begin:

  1. Set up kernel stack and heap memory regions
  2. Parse kernel image format
  3. Initialize kernel subsystems
  4. Mount root filesystem
  5. Start init process (systemd)
  6. Begin scheduling other userspace processes

The kernel handles critical mounting of disks and starting of the userspace init daemon. After init starts, normal system services and eventually applications can begin.

Boot Timing

A typical Arm v8 system goes through the four boot stages in a matter of seconds. Measuring boot timing provides insight into performance:

  • System Boot Stage – 10s of milliseconds
  • Firmware Boot Stage – 100s of milliseconds
  • Bootloader Stage – 100s of milliseconds
  • Kernel Initialization Stage – 1-5 seconds

The system boot stage is quite fast since it involves only basic SoC initialization. The firmware and bootloader stages take longer since they initialize hardware and load images from storage. Finally, kernel initialization takes several seconds depending on hardware detected and services started.

Optimization opportunities exist in the firmware, bootloader, and kernel stages to improve boot speed. For example, transitioning to a faster bootloader like LK can dramatically speed up the bootloader phase.

Boot Customization

While the four boot stages are generally standard across Arm v8 systems, there are many implementation details that can vary:

  • Boot ROM – Proprietary per SoC
  • Firmware – UEFI, U-Boot SPL, or custom
  • Bootloader – U-Boot, UEFI, LK, or custom
  • Kernel – Linux, FreeBSD, Android, or other
  • Filesystems – ext4, F2FS, initramfs, etc

Boot firmware, bootloader, kernel, and other boot components can be customized. This allows tuning boot timing, capabilities, security policies, and other attributes.

For example, Android systems combine a bootloader and kernel into a single Android boot image. This streamlines boot but provides less flexibility.

Security Considerations

As the Arm v8 boot process advances through progressive stages, security capabilities also increase:

  • Boot ROM – Permanently immutable code
  • Firmware – Read-only updatable code
  • Bootloader – Read-only or mutable code with verification
  • Kernel – Enforces process isolation and permissions

Secure boot capabilities in firmware and bootloaders verify that the boot chain loads only authentic software. ARM TrustZone also supports trusted execution environments isolated from normal software.

These capabilities prevent attackers from modifying boot components or injecting malicious code during boot. Securely booting to an immutable root of trust is critical for security.

Debugging the Boot Sequence

When bringing up new Arm v8 hardware, debugging boot issues is often needed. Common techniques include:

  • Print debug output – Many boot components print logs if enabled
  • Use a debug UART – Low level console that works before OS
  • Debug registers and exceptions in bootloader
  • Kernel panics on failures
  • Analyze boot timing – Find slow components

Debug UART consoles allow interactive debugging and inspection. The OS provides many tools for analyzing crashes and issues during later boot stages.

Conclusion

The Arm v8 boot process stages progressively initialize hardware and software components vital to starting an OS. Understanding this boot flow is key to successfully bringing up and debugging Arm v8 platforms. While the four high-level stages are standardized, many implementation details can vary and customize the boot process.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article ARM Cortex-M3 Programming Techniques
Next Article How to Write a Bootloader for Microcontrollers?
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2k Followers Like
3k Followers Follow
10.1k Followers Pin
- Sponsored-
Ad image

You Might Also Like

Cortex-M3 Memory Region Shareability and Cache Policies (Explained)

The Cortex-M3 memory system allows configuring memory regions to be…

9 Min Read

What are the exception numbers for the Cortex-M4 processor?

The Cortex-M4 processor handles exceptions and interrupts using vector numbers.…

6 Min Read

Cortex-M3 Flash Memory Limitations and Workarounds

The Cortex-M3 processor has some limitations when it comes to…

11 Min Read

Bootloading Cortex-M1 with RTX Application

Booting a Cortex-M1 processor with an RTX real-time operating system…

8 Min Read
SoCSoC
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
Welcome Back!

Sign in to your account