Rockchip RK3326 Linux SDK: Boot Flow Overview

In this article, let's focus on the boot sequence of Rockchip SoCs running Linux and try to understand the terminology, what each component is, and what it is responsible for.
So, let's start with the simplified feature image above.
BootROM (aka Boot Code)
This is the code stored in the SoC itself. It is read-only and executes immediately after the chip powers up. The BootROM is fully closed-source, but some enthusiasts have managed to read it out of the chip and disassemble it (we won't delve into that in this topic).
Preloader (aka idbloader, SPL – Secondary Program Loader, Uboot TPL/SPL, MiniLoader, pre-loader)
The Preloader goes by multiple names, which can be confusing at first glance. In general, this is the loader that the BootROM attempts to load. The source code for the Preloader is closed, and it comes as a binary file. It has a fixed sector address of 0x40 in the storage medium.
The Preloader consists of two main parts:

- DRAM Initialization Program (
rkxx_ddr_vx.xx.bin
)
This binary is responsible for initializing the external DRAM (e.g., DDR SDRAM).
- It is loaded into the internal SRAM by the MaskROM.
- The initialization process is executed within the SRAM before transitioning to the external DRAM.
- Loader for the Next Stage (
rkxx_miniloader_vx.xx.bin
orrkxx_spl_vx.xx.bin
)
This is a small loader binary that prepares the system to load the next stage of the bootloader (U-Boot).
- Like the DRAM initialization program, it is loaded into the internal SRAM by the MaskROM.
- However, it runs in the initialized external DRAM after the DRAM has been successfully set up.
All the mentioned files can be found and built as part of the 'release loader' using the rkbin repository.
As an additional note, to create a 'release loader' that can be used with rkdeveloptool (or any tool utilizing the rockusb driver), a special file named rkxx_usbplug_vx.xx.bin must be included.

Finally lets check what binaries are avaialbel for RK3326 that we can use

rk3326_ddr_333MHz_v2.11.bin
This is the DDR initialization binary, responsible for configuring the external DRAM at a clock speed of 333 MHz.
rk3326_miniloader_aarch32_slc_v1.36.bin
A mini-loader binary compiled for AARCH32 and optimized for use with the SLC(System Level Cache).
rk3326_miniloader_aarch32_v1.36.bin
A mini-loader binary compiled for AARCH32 without explicit SLC(System Level Cache) optimization.
rk3326_miniloader_slc_v1.37.bin
A generic mini-loader binary optimized for use with the SLC(System Level Cache) using AARCH64.
rk3326_miniloader_v1.40.bin
A generic mini-loader binary using AARCH64.
rk3326_usbplug_slc_v1.37.bin
A USB plug binary optimized for use with the SLC(System Level Cache).
rk3326_usbplug_v1.36.bin
A generic USB plug binary using AARCH64.
rk3326_bl31_v1.34.elf
and rk3326_bl32_v2.18.bin
(Bootloader Stage 3-1) are the files related to Trusted Firmware-A (TF-A) runtime firmware
Uboot (aka U-boot)

This is the next-stage bootloader that executes immediately after the preloader. Its main purpose is to load the kernel, so it must initialize low-level peripherals such as:
- UART : For debugging and communication during the boot process.
- DRAM : To ensure the system has access to sufficient memory for loading the kernel and other components.
- Clocks and Power Management : To configure the necessary clock sources and power states for stable operation.
- Storage Controllers (e.g., eMMC, SD, USB): To access the storage medium where the kernel and file systems are located.
- GPIOs : For controlling basic input/output functions and interacting with external hardware.
- Graphical Output Devices : To enable visual feedback during the boot process. This includes:
- LCD : For driving integrated displays.
- HDMI : For connecting external high-definition displays.
- DSI (Display Serial Interface) : A serial interface used to communicate with display modules, often utilized in mobile and embedded systems.
- VOP (Video Output Processor) : Responsible for processing and delivering video data to the display interfaces.
Once these peripherals are initialized, the bootloader proceeds to load the kernel into memory
The Uboot is fully open-source and available here
Kernel (aka boot, Loader)

A kernel loader loads the operating system's kernel into memory and prepares the system for execution. It handles:
- Kernel Image (zImage/Image) : The core OS component for managing hardware and services.
- Device Tree Blob (DTB) (rkxx.dtb) : A binary file describing the hardware configuration for the kernel.
- extlinux.conf : Configuration file for SYSLINUX/ExtLinux, specifying kernel, DTB, and boot parameters.
- grub.efi : EFI-version of GRUB, providing a flexible interface for booting OSes or kernels.
- Ramdisk (Initramfs) : A temporary file system loaded early to initialize components needed before mounting the root file system.
The kernel 5.10 is fully open-source and available here
Trust

I haven’t extensively worked with this loader, but it is responsible for establishing a root of trust during system initialization. It ensures that only authenticated and trusted software components are executed on the device, thereby protecting against unauthorized modifications or malicious attacks.
Rootfs
RootFS (short for root file system ) is the primary file system that contains all the necessary files, directories, and structures required for an operating system to boot and function. It serves as the foundation of the system's directory hierarchy, with /
(the root directory) as its top-level directory.
In the Rockchip Linux SDK , there are three main options for building or using a RootFS:
- Buildroot : A lightweight and easy-to-use framework for generating embedded Linux systems. It is ideal for resource-constrained devices.
- Yocto : A powerful and flexible project for building custom Linux distributions. It offers advanced features and scalability for complex systems.
- Debian : A pre-built, full-featured Linux distribution based on Debian. It provides a ready-to-use RootFS with a wide range of packages and tools.