From d8d545d6448f9886d6d51da51605a16d4d1bc187 Mon Sep 17 00:00:00 2001 From: Shiva Tripathi Date: Fri, 19 Dec 2025 17:59:42 +0530 Subject: [PATCH 1/2] fix(optee): add sysroot flags to toolchain setup Current toolchain setup steps are missing sysroot flags required by OP-TEE and U-Boot build systems, causing "cannot find libgcc.a" linker errors. Add CFLAGS64, KCFLAGS, and LDFLAGS exports with sysroot for 64-bit builds. Add SYSROOT_32 and CFLAGS32 for 32-bit builds. Signed-off-by: Shiva Tripathi --- source/linux/Overview/GCC_ToolChain.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/linux/Overview/GCC_ToolChain.rst b/source/linux/Overview/GCC_ToolChain.rst index cd64f1d65..6787de926 100644 --- a/source/linux/Overview/GCC_ToolChain.rst +++ b/source/linux/Overview/GCC_ToolChain.rst @@ -23,7 +23,17 @@ Before compiling any of the sources referenced in this document, set the cross c host# export CROSS_COMPILE_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-" host# export SYSROOT_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/aarch64-oe-linux" host# export CC_64="${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64}" + host# export CFLAGS64="--sysroot=${SYSROOT_64}" + host# export KCFLAGS="--sysroot=${SYSROOT_64}" + host# export LDFLAGS="--sysroot=${SYSROOT_64}" + +.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X', 'AM62LX') + + .. code-block:: console + host# export CROSS_COMPILE_32="${SDK_INSTALL_DIR}/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi-" + host# export SYSROOT_32="${SDK_INSTALL_DIR}/k3r5-devkit/sysroots/armv7at2hf-vfp-oe-eabi" + host# export CFLAGS32="--sysroot=${SYSROOT_32}" If the Processor SDK is not installed, the Arm GNU toolchains can be downloaded and setup. Refer to :ref:`external-arm-toolchain` section for more details on usage. From 6137a68f447be6cf3b09a55f979d9ac1206b3f3b Mon Sep 17 00:00:00 2001 From: Shiva Tripathi Date: Mon, 22 Dec 2025 18:04:46 +0530 Subject: [PATCH 2/2] fix(build): AM62LX OP-TEE and U-Boot build steps Building U-Boot with current SDK documentation steps results in missing tee-os blob errors on AM62LX. Include OP-TEE support in U-Boot build steps to resolve this. AM62LX SDK does not include 32-bit ARM toolchain (k3r5-devkit), unlike other K3 platforms. Remove CROSS_COMPILE_32 requirement from OP-TEE build commands and add CFG_USER_TA_TARGETS=ta_arm64 to restrict OP-TEE to build only 64-bit TAs. This resolves "cannot find libgcc.a" errors during OP-TEE build and "missing external blobs" errors during U-Boot build. Signed-off-by: Shiva Tripathi --- .../U-Boot/BG-Build-K3.rst | 4 ++- .../linux/Foundational_Components_OPTEE.rst | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/source/linux/Foundational_Components/U-Boot/BG-Build-K3.rst b/source/linux/Foundational_Components/U-Boot/BG-Build-K3.rst index f042aee72..4a2ba0a22 100644 --- a/source/linux/Foundational_Components/U-Boot/BG-Build-K3.rst +++ b/source/linux/Foundational_Components/U-Boot/BG-Build-K3.rst @@ -447,6 +447,7 @@ Go :ref:`here ` to download and install the SDK. $ export UBOOT_DIR= $ export TI_LINUX_FW_DIR= $ export TFA_DIR= + $ export OPTEE_DIR= .. note:: @@ -465,7 +466,8 @@ Go :ref:`here ` to download and install the SDK. $ make CROSS_COMPILE="$CROSS_COMPILE_64" \ BL1=$TFA_DIR/build/k3/am62l/release/bl1.bin \ BL31=$TFA_DIR/build/k3/am62l/release/bl31.bin \ - BINMAN_INDIRS=$TI_LINUX_FW_DIR + BINMAN_INDIRS=$TI_LINUX_FW_DIR \ + TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin .. ifconfig:: CONFIG_part_variant not in ('AM64X', 'AM62X', 'AM62AX', 'AM62LX') diff --git a/source/linux/Foundational_Components_OPTEE.rst b/source/linux/Foundational_Components_OPTEE.rst index 73def3aa5..230fb8ca5 100644 --- a/source/linux/Foundational_Components_OPTEE.rst +++ b/source/linux/Foundational_Components_OPTEE.rst @@ -50,17 +50,33 @@ Building OP-TEE OS Building the OP-TEE image ************************* +.. ifconfig:: CONFIG_part_variant not in ('AM62LX') + .. parsed-literal:: $ make CROSS_COMPILE="$CROSS_COMPILE_32" CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y +.. ifconfig:: CONFIG_part_variant in ('AM62LX') + + .. parsed-literal:: + + $ make CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y CFG_USER_TA_TARGETS=ta_arm64 + Building the OP-TEE image with debug parameters *********************************************** +.. ifconfig:: CONFIG_part_variant not in ('AM62LX') + .. parsed-literal:: $ make CROSS_COMPILE="$CROSS_COMPILE_32" CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=2 CFG_TEE_CORE_DEBUG=y +.. ifconfig:: CONFIG_part_variant in ('AM62LX') + + .. parsed-literal:: + + $ make CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=2 CFG_TEE_CORE_DEBUG=y CFG_USER_TA_TARGETS=ta_arm64 + .. _building-optee-with-prng: Building OP-TEE with Pseudo RNG drivers @@ -71,9 +87,17 @@ detrimental effect to the overall system latency. Using the ``CFG_WITH_SOFTWARE_PRNG`` flag to use OP-TEE's Pseudo RNG drivers as a source of entropy can work around these issues. -.. parsed-literal:: +.. ifconfig:: CONFIG_part_variant not in ('AM62LX') + + .. parsed-literal:: + + $ make CROSS_COMPILE="$CROSS_COMPILE_32" CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=k3-|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y CFG_WITH_SOFTWARE_PRNG=y + +.. ifconfig:: CONFIG_part_variant in ('AM62LX') + + .. parsed-literal:: - $ make CROSS_COMPILE="$CROSS_COMPILE_32" CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=k3-|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y CFG_WITH_SOFTWARE_PRNG=y + $ make CROSS_COMPILE64="$CROSS_COMPILE_64" PLATFORM=k3-|__OPTEE_PLATFORM_FLAVOR__| CFG_ARM64_core=y CFG_WITH_SOFTWARE_PRNG=y CFG_USER_TA_TARGETS=ta_arm64 .. _secure-storage-with-rpmb: