Specifics: Build U-Boot for TI AM62x-based SoMs
Introduction
This article describes additional specific steps about the compilation and the configuration of the boot container of the Toradex TI AM62x-based System on Module.
Prerequisites
Before continuing with this article, one must follow the steps in the article Build U-Boot From Source Code.
Make sure swig
, yamllint
, python3-pyelftools
and python3-jsonschema
packages are installed on the host machine.
Since the TI AM62 SoC has cores with 32-bit and 64-bit architectures, the cross-compilation environment must be setup for both architectures in the Prepare the Host Machine for Cross-Compilation section of the article Build U-Boot From Source Code.
Build U-Boot
For the TI AM62x-based modules, the U-Boot build process must be done for both the A53 and R5 processors. Thus, the steps bring instructions on how to build them.
Get the Sources
The following steps are intended to be run from the ~/workdir
directory, created previously.
Get the U-Boot source code: For Verdin AM62, which is a downstream-based module, U-Boot is fetched from https://git.toradex.com/u-boot-toradex.git.
$ git clone -b <u-boot-git-branch> https://git.toradex.com/u-boot-toradex.git
$ export UBOOT_DIR=$(pwd)/u-boot-toradexGet the binary-only System Firmware (SYSFW):
$ git clone git://git.ti.com/k3-image-gen/k3-image-gen.git
$ export K3_DIR=$(pwd)/k3-image-genGet the TI Linux Firmware:
$ git clone -b ti-linux-firmware git://git.ti.com/processor-firmware/ti-linux-firmware.git
$ export TI_LINUX_FW_DIR=$(pwd)/ti-linux-firmwareGet the ARM Trusted Firmware (ATF/TF-A):
$ git clone https://github.com/ARM-software/arm-trusted-firmware.git
$ export TFA_DIR=$(pwd)/arm-trusted-firmwareGet the OP-TEE image source code:
$ git clone https://github.com/OP-TEE/optee_os.git
$ export OPTEE_DIR=$(pwd)/optee_osGet the K3 Security development package:
$ git clone https://git.ti.com/git/security-development-tools/core-secdev-k3.git -b master
$ export CORE_SECDEV_K3_DIR=$(pwd)/core-secdev-k3
The next steps include commands which are intended to be run from the root of the U-Boot source tree unless otherwise specified. The root of the U-Boot tree is the top-level directory u-boot-toradex
.
Build ARM Trusted Firmware (ATF/TF-A):
ATF is used as the initial start code on ARMv8-A cores for all K3 platforms. To compile it, go to the directory where you cloned the ARM Trusted Firmware and compile it for the ARM64 architecture.
$ cd $TFA_DIR
$ export ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
$ unset TFA_EXTRA_ARGS
$ make PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS TARGET_BOARD=lite
Build OP-TEE Image:
Quoting the TI documentation:
OP-TEE is a Trusted Execution Environment (TEE) designed as a companion to a non-secure Linux kernel running on Arm Cortex-A cores using the TrustZone technology.
To build the OP-TEE image, go to the directory where you clone it and perform the steps below:
$ cd $OPTEE_DIR
$ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
$ export ARCH=arm
$ export CROSS_COMPILE=arm-none-linux-gnueabihf-
$ export CROSS_COMPILE64=aarch64-none-linux-gnu-
$ make PLATFORM=k3-am62x CFG_ARM64_core=y $OPTEE_EXTRA_ARGS
Build U-Boot for R5
In the U-boot directory, compile the source code for the R5 core:
$ cd $UBOOT_DIR
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- verdin-am62_r5_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- BINMAN_INDIRS=$TI_LINUX_FW_DIRGo to the System Firmware directory and build it.
$ cd $K3_DIR
$ make SOC=am62x SOC_TYPE="hs-fs" TI_SECURE_DEV_PKG=$CORE_SECDEV_K3_DIR SBL=$UBOOT_DIR/spl/u-boot-spl.bin SYSFW_DIR=$TI_LINUX_FW_DIR/ti-sysfw
$ cp tiboot3-am62x-hs-fs-evm.bin ../tiboot3-am62x-hs-fs-verdin.bin
Build U-Boot for A53
In the U-boot directory, compile the source code for the A53 cores:
$ cd $UBOOT_DIR
$ export ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
$ make verdin-am62_a53_defconfig
$ make BINMAN_INDIRS=$TI_LINUX_FW_DIR \
BL31=$TFA_DIR/build/k3/lite/release/bl31.bin \
TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-raw.bin
$ cp tispl.bin ../
$ cp u-boot.img ../
Deploy the U-Boot binary to an Image
Now that the adjustments were made, return to the Build U-Boot From Source Code article to deploy the U-Boot binary to an image.