This article explains how to rebuild the primary and the secondary bootloaders for the STM32 device families. It is intended for Distribution Package users.
1. Prerequisites[edit source]
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:
source build/envsetup.sh
bspsetup
lunch aosp_<BoardId>-userdebug
2. Partition layout[edit source]
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 fsbl
partition.
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 ssbl
partition.
The binaries are available in device/stm/<STM32Series>-bootloader/prebuilt
.
3. Load the bootloader sources[edit source]
By default, the bootloader sources are not part of the STM32MPU distribution for AndroidTM. To load the sources, execute the following instruction:
load_bootloader
It will load both the TF-A and U-Boot sources.
The bootloader sources are located in:
- TF-A:
device/stm/<STM32Series>-bootloader/tf-a-<STM32Series>
- U-Boot:
device/stm/<STM32Series>-bootloader/u-boot-<STM32Series>
4. Build the bootloaders[edit source]
To build both the FSBL and the SSBL, run:
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:
build_bootloader --<BootMode> -b <BoardId> -m <MemoryType>
BootMode
option examples:
- optee
- trusted
MemoryType
option examples:
- sd
- emmc
To get back more details on available options, run:
build_bootloader -h
Here after, this the result for the version 1.4:
Usage: build_bootloader [Options] [Mode Options] [Board Options] This script allows building the bootloaders source (TF-A and/or 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 forced) Board options: (default = all possibilities) -b <name> / --board=<name>: set board name from following list = eval (default: all) -m <config> / --mem=<config>: set memory configuration from following list = sd emmc (default: all)
5. Integrate the bootloaders[edit source]
To update prebuilt images add -i option:
build_bootloader -i
Or use the specific configuration method with -i option.
build_bootloader -i --<BootMode> -b <BoardId> -m <MemoryType>
To integrate the updated prebuilt images, execute from the root directory:
make -j
Then update associated partitions on your device. Refer to How to populate boards for Android