5.1 U-BOOT Boot Flow
U-BOOT is the definitive bootloader responsible for importing the operating system kernel into physical memory. It can function as both a first-stage and a second-stage bootloader, loaded into RAM by the primary initialization routines embedded inside the on-chip boot ROM (such as the ROM firmware within NXP's ARM-based i.MX6 family of multimedia applications processors). After loading the image program into memory, the on-chip ROM forces an execution jump to the absolute address specified by the entry pointer entry within the Image Vector Table (IVT), triggering the execution of the U-BOOT bootstrap pipeline. When the platform is configured to leverage the SPL boot methodology, the complete multi-stage system boot lifecycle is organized as illustrated in the schematic below:
Figure 5-1 Linux Boot Flow
The U-BOOT binary components can reside across an array of storage mediums, including SD cards, SATA drives, parallel/serial NOR flash, or raw NAND flash arrays. For a typical embedded target, the primary boot device is logically partitioned into four operational areas. The first partition stores the initial program loader and image vectors detailed in the preceding chapters (the boot image payload). The second partition holds the persistent environment block containing the runtime boot parameters passed by the bootloader to the operating system kernel. The third partition isolates the compressed Linux kernel image (zImage or uImage), and the fourth partition hosts the root filesystem (rootfs) matrix.
Figure 5-2 Boot Medium Partition Layout
Figure 5-3 U-BOOT Boot Flow Across Different Boot Methods
As mapped out in the sequencing flowchart above, the U-BOOT startup pipeline supports several distinct boot modes, specifically: SPL (Secondary Program Loader), TPL (Tertiny Program Loader), or proper execution modes. These variants represent modular binary derivatives generated from a single consolidated U-BOOT source tree based on explicit compile-time configuration parameters. They can be freely stacked and combined like building blocks to adapt to localized silicon or memory boundary constraints.
These compilation targets maintain mutually independent operations yet execute sequentially based on system requirements. If the SoC features a high-capacity internal SRAM footprint, or if the hardcoded BootROM routines are explicitly engineered to initialize the external DDR layout before handing over execution, the platform can boot directly into the Proper image via a single-stage boot configuration. This single-stage approach is common among high-performance SoCs or system emulators. Conversely, if the physical internal RAM is highly constrained and the on-chip ROM lacks the capacity to initialize the external memory controller, the chip can initially parse and run only a minimal code footprint. In this scenario, a two-stage configuration joining U-BOOT Proper with an intermediary SPL (Proper + SPL) serves as the optimal layout; the on-chip ROM loads the lightweight SPL component into internal SRAM to initialize the system clocks and DDR lines, and the SPL subsequently fetches and unpacks the heavy U-BOOT Proper binary into the newly initialized external memory. Alternatively, the SPL can bypass the Proper stage entirely and branch straight into the Linux kernel initialization path (known as Falcon Mode). Under highly restrictive hardware constraints (for instance, a legacy layout exposing only 4 KB of internal SRAM where even a stripped SPL cannot fit), a three-stage boot pipeline joining U-BOOT Proper, SPL, and TPL (Proper + SPL + TPL) can be deployed, forcing the TPL to execute first from raw SRAM to bring up the core memory lines.
U-BOOT Proper represents the full-featured, standard variant of the bootloader. It encapsulates a highly complex command-line interface shell (CLI), granular environment variable parsing engines, a robust network protocol stack, and a comprehensive device driver model; its primary responsibility is loading the operating system kernel into memory. The SPL functions as a stripped-down, lightweight variant of U-BOOT, compiled without the text shell interpreter, environment subroutines, and superfluous peripheral drivers to optimize its binary size. Its exclusive objective is initializing foundational hardware blocks and loading the subsequent execution stage. The TPL represents a hyper-stripped, minimal variant of U-BOOT that typically isolates only the absolute baseline register loops needed to bring up the external DDR lines.
The selection of these U-BOOT boot stages is enforced at compile time using build flags (CONFIG_SPL=y, CONFIG_TPL=y), rather than being dynamically evaluated at runtime. Configuring these compilation switches is handled either via interactive menu-driven configuration utilities (menuconfig) or by editing the platform baseline configuration tables directly (such as defconfig templates or the active .config workspace).
While CONFIG_SPL and CONFIG_TPL act as global functional selection switches determining whether the compiler generates standalone SPL and TPL binary components, code blocks belonging to Proper, SPL, or TPL can coexist within a single function or source file. To isolate and separate these interleaved routines cleanly, the build system defines the CONFIG_SPL_BUILD and CONFIG_TPL_BUILD macro constants. If a block is bound by an #if !defined(CONFIG_SPL_BUILD) guard, it indicates that the enclosed code belongs strictly to the primary U-BOOT Proper image. An assignment matching #if defined(CONFIG_SPL_BUILD) wrapped alongside an inner #if !defined(CONFIG_TPL_BUILD) boundary indicates that the routine is compiled exclusively for the SPL layer. Finally, combining #if defined(CONFIG_SPL_BUILD) with an active #if defined(CONFIG_TPL_BUILD) filter designates that the target routine belongs exclusively to the TPL compilation pipeline. If code segments are written without these conditional macro envelopes, they are integrated globally into all three images.
When utilizing the Yocto Project compilation and build framework, the localized U-BOOT source tree leveraged by the NXP Linux release is extracted and tracked under the following workspace directory:
build/tmp/work/<board_name>/u-boot-imx/<version_number>/git/
Throughout all subsequent sections of this book, any explicit references detailing source code locations or file pathways are mapped assuming the git/ root directory as the absolute base path.