> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Boot architecture

The boot architecture uses boot loaders and Board Support Package (BSP) images at each stage of boot. The boot loaders manage each boot stage until the Linux Kernel and the applications are ready to run.

## **Boot loader**

The system runs the boot loader software when powered on, serving as an interface for loading the operating system and other required applications.

Qualcomm chipsets, including the ones supported by Qualcomm Linux, use a multistage boot process as follows:

<img src="https://mintcdn.com/qualcomm-prod/eYaEBFH0xlFq53OY/System/Boot/media/k2c-qli-boot/boot-loader.svg?fit=max&auto=format&n=eYaEBFH0xlFq53OY&q=85&s=1de77bbe1e586f7d71279987cae7ac13" alt="Boot architecture" width="1100" height="165" data-path="System/Boot/media/k2c-qli-boot/boot-loader.svg" />

### **Primary boot loader (PBL)**

* Establishes a secure root-of-trust (RoT) and secure boot process for applications. For more information, see [Secure boot](https://dragonwingdocs.qualcomm.com/System/Security/security-features).
* Identifies the primary storage device and loads the secondary boot loader called the eXtensible Boot Loader (XBL).
  If the system encounters any recoverable error while loading the XBL image, the PBL enters the emergency download (EDL) mode. For more information about how to detect EDL mode, see [Enumeration of EDL device manager](./enumeration-of-edl-device-manager).
* Loads XBL segments into the boot SoC internal memory. For more information about how PBL loads the XBL segments, see [APSS cold boot flow](./apss-cold-boot-flow).

### **eXtensible Boot Loader (XBL)**

* Initializes the hardware, firmware images, CPU cache, MMU, boot device, PMIC, and DDR.
* Sets up the RAM dump USB driver, USB charging, thermal check, power management integrated circuit (PMIC), and low-power double data rate (LPDDR) clock functions.
* Collects the RAM dump over USB onto the host computer.
* Loads and verifies the Qualcomm<sup>®</sup> Trusted Execution Environment (Qualcomm TEE), Qualcomm Hypervisor, and UEFI image.
* Provides the XBL configuration (`XBL_CFG`), which is part of the cold boot flow and includes PMIC and other driver settings.
* Provides XBL with a Qualcomm-signed ELF segment to initialize the external protection units (xPU).
* XBL\_CFG is a standalone binary with platform-specific configurations and settings. The XBL uses the XBL\_CFG driver to load and configure the required settings. The driver uses the binary to provide on-demand read access to each setting of XBL\_CFG.

### **Unified extensible firmware interface (UEFI)**

<iframe src="https://players.brightcove.net/1414329538001/4JiZQnWhg_default/index.html?videoId=6362756918112" width="100%" height="450" allow="encrypted-media; fullscreen" allowFullScreen title="Boot QLI video" />

UEFI is the software interface between an operating system (OS) and the platform firmware.

It includes data tables with platform information, along with the boot and runtime service calls that the OS and its loader can use. Together, they create a standard environment for booting an OS and running the UEFI applications.

Qualcomm uses Tianocore EDK-II, an open-source implementation available at [http://www.tianocore.org/edk2/](http://www.tianocore.org/edk2/), which follows the [UEFI specification](https://uefi.org/specs/UEFI/2.10/).

The system offers the following build options:

* Retail build: Has minimal debug features and an optimal memory footprint, making it ideal for production environments.
* Debug build: Ideal for development environments, with all debug features enabled.

For developing a UEFI application, see [Unified Extensible Firmware Interface (UEFI)](./develop-uefi-applications).

### **U-Boot**

U-Boot is an open-source boot loader that can be used as an alternative to EDK II in the Qualcomm Linux boot flow. In this configuration, U-Boot replaces the EDK II while all other stages remain unchanged.

U-Boot provides the following functionality:

* Initializes and configures platform hardware and peripherals required for boot
* Loads and transfers control to the systemd-boot EFI image, which subsequently loads the Operating System (OS)
* Implements UEFI boot services and limited runtime services for OS
* Provides an interactive command-line interface for system configuration and debugging
* Supports secure boot mechanisms by verifying OS image using trusted cryptographic signatures

For more details on U-Boot, please refer [U-Boot on Qualcomm Linux](./u-boot-on-qualcomm-linux).

### **systemd-boot OS manager**

systemd-boot is a UEFI boot manager that executes configured EFI images. It only supports systems with UEFI firmware and does the following:

* Loads boot entry information from the EFI system partition (ESP), mounted at `/efi`, `/boot`, or `/boot/efi` during the Linux OS runtime and from the extended boot loader partition (XBOOTLDR) (mounted to `/boot`).
  You must locate the configuration file fragments, kernels, initial RAM disk (initrd), and other EFI images within the ESP or XBOOTLDR.
* Reads simple and generic boot loader configuration files, and selects one file per boot loader entry. All the files are in the ESP partition.

To ensure that the Qualcomm Linux Kernel can run as an EFI image, use the `CONFIG_EFI_STUB` compilation option.

## **Next steps**

* For EFI boot stub, see [https://docs.kernel.org/admin-guide/efi-stub.html](https://docs.kernel.org/admin-guide/efi-stub.html).
* For a sample structure of the EFI partition, see [systemd-boot in Qualcomm Linux Yocto Guide](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/configure-and-secure-boot-with-systemd-boot-and-uki).
