1.2. Building the SDK

1.2.1. Build PC Setup

Please refer to the following pages from Android documentatio to setup your environment for Android build:

Getting the Repo tool

You will need the Repo tool to retrieve repositories. To install it, please refer to this webpage : https://source.android.com/setup/develop#installing-repo

Getting toolchain for u-boot builds

Links to download toolchains for building u-boot is mentioned in the SDK download page.

1.2.2. Downloading Sources

Create a folder for downloading all sources

mkdir ~/08_03_00 && cd $_
export YOUR_PATH=$PWD

1.2.2.1. Bootloader components

mkdir ${YOUR_PATH}/ti-bootloader-aosp/ && cd $_
git clone -b 08.03.00.005 git://git.ti.com/k3-image-gen/k3-image-gen.git
git clone -b 08.03.00.005 git://git.ti.com/atf/arm-trusted-firmware.git
git clone -b 08.03.00.005 git://git.ti.com/optee/ti-optee-os.git
git clone -b 08.03.00.005 git://git.ti.com/ti-u-boot/ti-u-boot.git
git clone -b 08.03.00.005 git://git.ti.com/processor-firmware/ti-linux-firmware.git

1.2.2.2. Kernel

Fetch the code using repo:

mkdir ${YOUR_PATH}/ti-kernel-aosp/ && cd $_
repo init -u git://git.ti.com/android/manifest.git -b android12-core-release -m releases/RLS_08_03_Kernel.xml
repo sync

1.2.2.3. Android File System

Fetch the code using repo:

mkdir ${YOUR_PATH}/ti-aosp-12 && cd $_
repo init -u git://git.ti.com/android/manifest.git -b android12-core-release -m releases/RLS_08_03.xml
repo sync

1.2.3. Build Instructions

Note

The Bootloader and Kernel builds below are optional if they are used as is from TI relase. Prebuilt copies of these binaries are already part of Android file system sources in device/ti/am62x-kernel and vendor/ti/am62x/bootloader folder.

1.2.3.1. Bootloader components

  1. Build tiboot3.bin
cd ${YOUR_PATH}/ti-bootloader-aosp/ti-u-boot/
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_evm_r5_defconfig O=/tmp/r5
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=/tmp/r5
cd ${YOUR_PATH}/ti-bootloader-aosp/k3-image-gen
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x SBL=/tmp/r5/spl/u-boot-spl.bin SYSFW_PATH=${YOUR_PATH}/ti-bootloader-aosp/ti-linux-firmware/ti-sysfw/ti-fs-firmware-am62x-gp.bin

Use the tiboot3.bin generated from last command in ${YOUR_PATH}/ti-bootloader-aosp/k3-image-gen

  1. Build tispl.bin and u-boot.img

In order to build tispl.bin and u-boot.img, OPTEE and ATF (arm trusted firmware) need to be built.

cd ${YOUR_PATH}/ti-bootloader-aosp/arm-trusted-firmware
make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=lite SPD=opteed
cd ${YOUR_PATH}/ti-bootloader-aosp/ti-optee-os
make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- CROSS_COMPILE64=aarch64-none-linux-gnu-

It is now possible to generate tispl.bin and u-boot.img.

cd ${YOUR_PATH}/ti-bootloader-aosp/ti-u-boot/
make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig O=/tmp/a53
make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=${YOUR_PATH}/ti-bootloader-aosp/arm-trusted-firmware/build/k3/lite/release/bl31.bin TEE=${YOUR_PATH}/ti-bootloader-aosp/ti-optee-os/out/arm-plat-k3/core/tee-pager_v2.bin DM=${YOUR_PATH}/ti-bootloader-aosp/ti-linux-firmware/ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f O=/tmp/a53

Use tispl.bin and u-boot.img located in /tmp/a53

  1. Copy the tiboot3.bin, tispl.bin and u-boot.img generated in steps 1 and 2 to ${YOUR_PATH}/ti-aosp-12/vendor/ti/am62x/bootloader. If not copied, the prebuilt bootloader binaries already present in vendor/ti/am62x/bootloader will get use by flashall.sh flashing script.

1.2.3.2. Kernel

1.2.3.2.1. Building everything from scratch

cd ${YOUR_PATH}/ti-kernel-aosp/
export DIST_DIR=${YOUR_PATH}/ti-aosp/device/ti/am62x-kernel/kernel/5.10
export BUILD_CONFIG=./imgtech-module/build.config.imgtech
build/build.sh

1.2.3.2.2. Rebuilding incrementally

Add the SKIP_MRPROPER=1 flag:

$ cd ${YOUR_PATH}/ti-kernel-aosp/
$ export DIST_DIR=${YOUR_PATH}/ti-aosp/device/ti/am62x-prebuilts/kernel/5.10
$ export BUILD_CONFIG=./imgtech-module/build.config.imgtech
$ export SKIP_MRPROPER=1
$ build/build.sh

1.2.3.2.3. Defconfig/menuconfig changes

The usual (make menuconfig ) is done via config.sh:

cd ${YOUR_PATH}/ti-kernel-aosp/
export BUILD_CONFIG=./imgtech-module/build.config.imgtech
build/config.sh

Note

Users must have built the android kernel image prior to building the Android file system. Otherwise pre-built Kernel images present in device/ti/am62x-kernel will be used to create boot.img

1.2.3.3. Android File System

cd ${YOUR_PATH}/ti-aosp-12
source build/envsetup.sh
lunch am62x-userdebug
m

After building all components, refer to instruction in next section for flashing the images to EVM