> ## 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 flow and architecture overview

A cold boot refers to the process of starting the system from a power-off state. The cold boot process involves the following steps:

1. Cold boot starts the execution from the primary boot loader (PBL) that sets up the initial system for the eXtensible Boot Loader (XBL).
2. The XBL performs wider system initialization including DDR initialization and loads a UEFI image.
3. UEFI provides a rich firmware interface that loads systemd-boot as a boot manager on Qualcomm<sup>®</sup> Linux to manage the OS images.

For more information, see [APSS cold boot flow](https://dragonwingdocs.qualcomm.com/System/Boot/apss-cold-boot-flow).

## UEFI boot managers

Qualcomm Linux supports systemd-boot as the Universal extensible firmware interface (UEFI) boot manager to load and boot the Linux kernel. The Qualcomm Linux kernel, in this case, is built as an EFI stub.

## Systemd-boot

Systemd-boot is a UEFI boot manager that executes EFI images, provides boot entries, and supports unified kernel images (UKI). Systemd-boot supports the following components:

* Boot entries: The type 1 boot loader specification entries are in the `loader/entries/` directory on the ESP. These files describe the Qualcomm<sup>®</sup> Linux kernel images with the associated initrd images and other EFI binaries.
* UKI: The type 2 boot loader specification EFI unified kernel images are executable EFI binaries located in the `/EFI/Linux/` directory on the ESP.
  For more information about the boot entries and unified kernel images, see [The Boot Loader Specification](https://uapi-group.org/specifications/specs/boot_loader_specification/).

Systemd-boot is a part of the systemd package of the meta Yocto layer. The Yocto recipe uses the `recipes-kernel/images/esp-qcom-image.bb` recipe file to handle the ESP image generation.

For more information about systemd-boot, see [UEFI and systemd-boot](./uefi-and-systemd-boot).

## Qualcomm Linux kernel as the EFI stub

The EFI boot stub allows booting the Qualcomm Linux kernel directly without a conventional EFI boot loader.

The boot firmware can load the EFI image as an executable file when the Qualcomm Linux kernel is compiled with the `CONFIG_EFI_STUB` kernel configuration option. In this case, the firmware loader navigates to the `EFI boot stub` location in the EFI image `drivers/firmware/efi/libstub/` to boot the kernel.

For Arm<sup>®</sup> (Arm64), where compressed kernel support is not available, the kernel image functions as a portable executable (PE) file format or common object file format (COFF) image, and the EFI stub is linked into the kernel.

For more information about booting the Linux kernel as an EFI image, see [The EFI Boot Stub](https://docs.kernel.org/admin-guide/efi-stub.html).

## Boot images and ESP or boot partition

The ESP or boot partition serves as a storage location for the `efi.bin` image that packages systemd-boot and UKI. The UKI includes kernel image, initramfs, and kernel command-line arguments.

The UEFI firmware launches the UEFI boot loader and loads the kernel boot images. The ESP is formatted with the file allocation table (FAT) file system supported in the UEFI specification. For more information about the UKI image format and the corresponding support in base Qualcomm<sup>®</sup> Linux<sup>®</sup> meta layers, see [UEFI and systemd-boot](./uefi-and-systemd-boot).

## Device tree blob selection

All the device tree blobs are packaged as part of `dtb.bin`. The UEFI selects and loads the right DTB for the Qualcomm Linux kernel.

To understand the boot time DTB selection, see [Boot-time DTB selection](./device-tree-architecture#boot-time-dtb-selection-flow).
