How to build bootloaders for Android
This article explains how to rebuild the primary and the secondary bootloaders for the STM32 device families. It is intended for Distribution Package users.
The environment must be installed using the Distribution Package adapted to the selected microprocessor device. See the list of AndroidTM Distribution Packages.
To be able to execute following instructions, work from the distribution root directory and initialize the environment with the following instructions:
PC $> source build/envsetup.sh PC $> bspsetup PC $> lunch aosp_<BoardId>-userdebug
2 Partition layout
The Trusted Firmware (TF-A) is used as the primary bootloader in the STM32MPU distribution for Android™.
The TF-A binary file is part of the
The Universal Bootloader (U-Boot) is used as the secondary bootloader in the STM32MPU distribution for Android™.
The U-Boot binary file is part of the
The binaries are available in
For information on the complete partition layout for the corresponding development platform, refer to the corresponding Flash mapping article named Your_development_platform Flash mapping for AndroidTM. Example: STM32MP15 Flash mapping for Android for the STM32MP15 boards.
All Flash mapping for AndroidTM articles belong to the Category:Flash mapping for Android.
3 Load the bootloader sources
By default, the bootloader sources are not part of the STM32MPU distribution for AndroidTM. To load the sources, execute the following instruction:
PC $> load_bootloader
It will load both the TF-A and U-Boot sources.
The bootloader sources are located in:
4 Build the bootloaders
To build both the FSBL and the SSBL, run:
PC $> build_bootloader
This instruction generates both the TF-A and the U-Boot for every available board, memory and boot mode in the optee and trusted configuration.
To generate the FSBL and the SSBL for a single configuration set:
PC $> build_bootloader --<BootMode> -b <BoardId> -m <MemoryType>
BootMode option examples:
MemoryType option examples:
Usage: build_bootloader [Options] [Mode options] [Board options] This script triggers the building of the bootloaders source (TF-A and U-Boot) Options: -h/--help: print this message -v/--version: get script version -i/--install: update prebuilt images --verbose <level>: enable verbosity (1 or 2 depending on level of verbosity required) Mode options (exclusive, default = both optee and trusted): -o/--optee: set optee mode for bootloaders or -t/--trusted: set trusted mode for bootloaders (non op-tee option) or -p/--programmer: build dedicated programmer version (-i option is mandatory) Board options: (exclusive, default = all possibilities) -c/--current: builds only for current configuration (board and memory) or -b/--board <name>: set board name = eval or disco (default: all) -m/--mem <name>: set memory configuration = sd or emmc (default: all), ignored if board = disco
5 Integrate the bootloaders
To update prebuilt images add -i option:
PC $> build_bootloader -i
Or use the specific configuration method with -i option.
PC $> build_bootloader -i --<BootMode> -b <BoardId> -m <MemoryType>
To integrate the updated prebuilt images, execute:
PC $> make -j
Then update associated partitions on your device. Refer to How to populate boards for Android