1.2. Building the SDK
1.2.1. Build PC setup
Please refer to the following pages from Android documentation 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 are mentioned in the SDK download page.
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
1.2.2. Downloading sources
Create a folder for downloading all sources
$ mkdir ~/09_02_00 && cd $_
$ export YOUR_PATH=$PWD
1.2.2.1. Bootloader components
$ mkdir ${YOUR_PATH}/ti-bootloader-aosp/ && cd $_
$ git clone -b 09.02.00.009 git://git.ti.com/atf/arm-trusted-firmware.git
$ git clone -b 09.02.00.009 git://git.ti.com/optee/ti-optee-os.git
$ git clone -b 09.02.00.009 git://git.ti.com/ti-u-boot/ti-u-boot.git
$ git clone -b 09.02.00.009 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 android14-release -m releases/RLS_09_02_Kernel.xml
$ repo sync
Note
To save some disk space, pass the --depth=1
option to repo init
:
$ repo init -u git://git.ti.com/android/manifest.git -b android14-release -m releases/RLS_09_02_Kernel.xml --depth=1
1.2.2.3. Android file system
Fetch the code using repo
:
$ mkdir ${YOUR_PATH}/ti-aosp-14 && cd $_
$ repo init -u git://git.ti.com/android/manifest.git -b android14-release -m releases/RLS_09_02.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 release.
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
Build ATF:
$ cd ${YOUR_PATH}/ti-bootloader-aosp/arm-trusted-firmware $ make E=0 CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=lite SPD=opteed CFLAGS+="-DK3_PM_SYSTEM_SUSPEND=1"
Build OPTEE-OS:
$ cd ${YOUR_PATH}/ti-bootloader-aosp/optee_os $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- CROSS_COMPILE64=aarch64-none-linux-gnu-
Build
tiboot3.bin
:
$ cd ${YOUR_PATH}/ti-bootloader-aosp/ti-u-boot/ $ make ARCH=arm am62x_evm_r5_defconfig $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- \ BINMAN_INDIRS=${YOUR_PATH}/ti-bootloader-aosp/ti-linux-firmware
Build
tispl.bin
andu-boot.img
:
$ cd ${YOUR_PATH}/ti-bootloader-aosp/ti-u-boot/ $ make ARCH=arm am62x_evm_a53_defconfig $ make ARCH=arm am62x_android_a53.config $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \ BL31=${YOUR_PATH}/ti-bootloader-aosp/arm-trusted-firmware/build/k3/lite/release/bl31.bin \ TEE=${YOUR_PATH}/ti-bootloader-aosp/optee_os/out/arm-plat-k3/core/tee-pager_v2.bin \ BINMAN_INDIRS=${YOUR_PATH}/ti-bootloader-aosp/ti-linux-firmware
Copy the
tiboot3.bin
,tispl.bin
andu-boot.img
generated in steps 3 and 4 to${YOUR_PATH}/ti-aosp-14/vendor/ti/am62x/bootloader
. If not copied, the prebuilt bootloader binaries already present invendor/ti/am62x/bootloader
will get used byflashall.sh
flashing script.
Note
To build bootloaders for AM62x LP board please do same step with this defconfig:
For step 3, use
am62x_lpsk_r5_defconfig
For step 4, use
am62x_lpsk_a53_defconfig
with same fragment
Note
To build bootloaders for the Beagle Play, follow same steps but change the defconfigs:
For step 3, use
am62x_evm_r5_defconfig
witham625_beagleplay_r5.config
andam625_beagleplay_android_r5.config
For step 4, use
am62x_evm_a53_defconfig
witham625_beagleplay_a53.config
,am62x_android_a53.config
andam625_beagleplay_android_a53.config
1.2.3.2. Kernel
1.2.3.2.1. Building everything from scratch
The kernel is compatible with all AM62x boards, such as the SK EVM and the Beagle Play.
$ cd ${YOUR_PATH}/ti-kernel-aosp/
$ export DIST_DIR=${YOUR_PATH}/ti-aosp-14/device/ti/am62x-kernel/kernel/6.1
$ tools/bazel run //common:ti_dist -- --dist_dir=$DIST_DIR
1.2.3.2.2. Rebuilding faster
$ cd ${YOUR_PATH}/ti-kernel-aosp/
$ export DIST_DIR=${YOUR_PATH}/ti-aosp-14/device/ti/am62x-kernel/kernel/6.1
$ tools/bazel run --config=fast //common:ti_dist -- --dist_dir=$DIST_DIR
1.2.3.3. Android File System
$ cd ${YOUR_PATH}/ti-aosp-14
$ source build/envsetup.sh
$ lunch <BUILD_TARGET>
$ m
Where BUILD_TARGET
is listed in the table below :
Android Build type |
Build target |
---|---|
AM62X-SK Tablet userdebug |
|
AM62X-SK Tablet user |
|
AM62X-SK Car userdebug |
|
AM62X-SK Car user |
|
The recommended BUILD_TARGET
to use is am62x-userdebug
.
Note
By default with user images AVB feature is enabled.
For userdebug images, if you want to enable AVB feature you need to build
with TARGET_AVB_ENABLE=true
build args:
After building all components, refer to instruction in next section for flashing the images to EVM
The android images generated for the AM62X-SK EVM are compatible with the Beagle Play board. For flashing the Beagle Play, see the dedicated application note.