Difference between revisions of "How to build bootloaders for Android"
[unchecked revision] | [quality revision] |
m (→Build the bootloaders)
|
m (→Load the bootloader sources)
|
This article explains how to rebuild the primary and the secondary bootloaders for the STM32 device families. It is intended for Distribution Package users.
Contents
1 Prerequisites[edit]
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
![]() |
The bspsetup instruction only needs to be run once for each distribution |
2 Partition layout[edit]
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
.
![]() |
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[edit]
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]
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]
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
This article explains how to rebuild the primary and the secondary bootloaders for the STM32 device families. It is intended for Distribution Package users. == Prerequisites == The environment must be installed using the Distribution Package adapted to the selected microprocessor device. See the list of Android<sup>TM</sup> [[Which_STM32MPU_Embedded_Software_Package_for_Android_better_suits_your_needs#Distribution_Package | 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_{{HighlightParam|''<BoardId>''}}-userdebug {{Info| The <code>bspsetup</code> instruction only needs to be run once for each distribution}} == 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 <code>fsbl</code> 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 <code>ssbl</code> partition. The binaries are available in <code>device/stm/{{HighlightParam|''<STM32Series>''}}-bootloader/prebuilt</code>. {{Info| 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 Android<sup>TM</sup>'''. Example: [[STM32MP15 Flash mapping for Android]] for the STM32MP15 boards. All ''Flash mapping for Android<sup>TM</sup>'' articles belong to the [[:Category:Flash mapping for Android]]. }} == Load the bootloader sources == By default, the bootloader sources are not part of the STM32MPU distribution for Android<sup>TM</sup>. To load the sources, execute the following instruction: {{PC$}} load_bootloader It will load both the TF-A and U-Boot sources. {{Info | The <code>load_bootloader</code> script uses the configuration file <code>android_fsbl.config</code> (resp. <code>android_ssbl.config</code>) available in the <code>device/stm/{{HighlightParam|''<STM32Series>''}}-bootloader/source/patch/{{HighlightParam|''<fsbl-version>''}}/</code> (resp. <code>.../{{HighlightParam|''<ssbl-version>''}}/</code>) directory. }} The bootloader sources are located in: *TF-A: <code>device/stm/{{HighlightParam|''<STM32Series>''}}-bootloader/tf-a-{{HighlightParam|''<STM32Series>''}}</code> *U-Boot: <code>device/stm/{{HighlightParam|''<STM32Series>''}}-bootloader/u-boot-{{HighlightParam|''<STM32Series>''}}</code> {{Info | By default, only the archive is loaded from the remote repository (reducing size). If required the remote repository with all the git history can be cloned instead. For that purpose, <code>BOOTLOADER_ARCHIVE_PATH</code> must be replaced by <code>BOOTLOADER_GIT_PATH</code>in the file <code>android_fsbl.config</code> (resp. <code>android_ssbl.config</code>) . Then execute <code>load_bootloader</code> again with <code>-f</code> option if previously loaded sources needhave to replacebe replaced. }} == 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 --{{HighlightParam|''<BootMode>''}} -b {{HighlightParam|''<BoardId>''}} -m {{HighlightParam|''<MemoryType>''}}<code>BootMode</code> option examples: * '''optee''' * '''trusted''' <code>MemoryType</code> option examples: * '''sd''' * '''emmc''' To get back more details on available options, run: {{PC$}} build_bootloader -h Here after, this the result for the version 1.4:<pre> 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)</pre> == 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 --{{HighlightParam|''<BootMode>''}} -b {{HighlightParam|''<BoardId>''}} -m {{HighlightParam|''<MemoryType>''}} To integrate the updated prebuilt images, execute from the root directory: {{PC$}} make -j Then update associated partitions on your device. Refer to [[How to populate boards for Android]] <noinclude> [[Category:How to Android]] [[Category:Android]] {{PublicationRequestId |13262| 2019-09-12}}</noinclude>
Line 47: | Line 47: | ||
By default, only the archive is loaded from the remote repository (reducing size). If required the remote repository with all the git history can be cloned instead. |
By default, only the archive is loaded from the remote repository (reducing size). If required the remote repository with all the git history can be cloned instead. |
||
− | For that purpose, <code>BOOTLOADER_ARCHIVE_PATH</code> must be replaced by <code>BOOTLOADER_GIT_PATH</code>in the file <code>android_fsbl.config</code> (resp. <code>android_ssbl.config</code>) . Then execute <code>load_bootloader</code> again with <code>-f</code> option if previously loaded sources |
+ | For that purpose, <code>BOOTLOADER_ARCHIVE_PATH</code> must be replaced by <code>BOOTLOADER_GIT_PATH</code>in the file <code>android_fsbl.config</code> (resp. <code>android_ssbl.config</code>) . Then execute <code>load_bootloader</code> again with <code>-f</code> option if previously loaded sources have to be replaced. |
}} |
}} |
||