3.2. Android Bootloaders

Getting toolchain for u-boot builds

The toolchains are automatically downloaded by the build scripts.

Install OPTEE-OS build dependencies

Check OPTEE-OS docs to know list of dependencies needed to be installed : https://optee.readthedocs.io/en/latest/building/prerequisites.html

Install additional dependencies

$ sudo apt install bc bison build-essential curl u-boot-tools flex git libssl-dev python3 python3-pip wget -y
$ pip3 install pycryptodome pyelftools shyaml --user

3.2.1. Downloading sources

Fetch the code using repo:

$ mkdir ${YOUR_PATH}/ti-bootloader-aosp/ && cd $_
$ repo init -u https://git.ti.com/git/android/manifest.git -b android16-release -m releases/RLS_11_00_00_Bootloader.xml
$ repo sync

For more information about repo, visit Android’s official documentation

3.2.2. Build Instructions

  1. Build bootloaders images using:

    $ cd ${YOUR_PATH}/ti-bootloader-aosp/
    $ ./build/build_all.sh --config=build/config/boards/am62x-sk.yaml
    

    This will generate all the required bootloaders in out/am62x-sk/release:

    $ tree out
    out/am62x-sk/
    └── release
        ├── bl31-release.bin
        ├── tee-release.bin
        ├── tiboot3-release-gp.bin
        ├── tiboot3-release-hsfs.bin
        ├── tispl-release.bin
        └── u-boot-release.img
    

    These binaries are valid for an AM62X SoC. To build for other boards, look at build/config/boards. We can see the following valid combinations:

  2. From out/am62x-sk/release, copy the tiboot3.bin, tispl.bin and u-boot.img generated to $YOUR_PATH/ti-aosp-16/vendor/ti/am62x/bootloader.

    If not copied, the prebuilt bootloader binaries already present in vendor/ti/am62x/bootloader will get used by flashall.sh flashing script.

  3. Finally, rebuild Android by following Build Instructions.

Warning

If you also modify Trusted Applications (TA), it’s recommended to use the release_android.sh script to avoid copying all the TAs manually as it’s quite error prone.

3.2.3. Release Instructions

In addition to building and copying manually to $YOUR_PATH/ti-aosp-16, it’s also possible to automatically build all supported variants and copy them to Android.

Assuming Android has already been downloaded following Downloading sources, This can be done using:

$ cd ${YOUR_PATH}/ti-bootloader-aosp/
$ ./build/release_android.sh --aosp=${YOUR_PATH}/ti-aosp-16 --commit
# [...] lots of build logs later

After that, rebuild Android by following Build Instructions to use the new bootloaders.

Tip

To only release for a particular board, pass the --config option to release_android.sh.