From a70d4f595a8c1ab0fb7b5e942b00a576a01eaed3 Mon Sep 17 00:00:00 2001 From: "Rodrigo M. Duarte" Date: Wed, 28 Oct 2026 16:26:25 -0300 Subject: imx-atf: Build out of tree and from a clean directory imx-atf built in the source tree, into ${S}/build, and do_compile never cleaned it. The TF-A Makefile does not track build options such as SPD or LOG_LEVEL, so after a PACKAGECONFIG change make finds every object up to date and relinks nothing. do_unpack does not depend on PACKAGECONFIG, so it does not rerun either, and do_deploy then ships the bl31.bin from the previous configuration. On imx8mq-evk this showed up after switching from the NXP BSP to the mainline BSP, which drops the optee PACKAGECONFIG. The deployed BL31 was still the SPD=opteed build. Its imx8mq setup sets the BL32 entry to BL32_BASE unconditionally, and the mainline boot container carries no OP-TEE, so the board hung right after the "BL31: Built" banner. The stale binary was reproduced byte for byte by building with SPD=opteed and then without it in the same build directory. Build into ${WORKDIR}/build through BUILD_BASE, clean it before every compile, and deploy from there. The Makefile stays in ${S}, so do_compile runs make with -C ${S}; the default do_compile would skip make, as ${B} has no Makefile. Tested on imx8mq-evk with the mainline BSP by building imx-atf with the optee PACKAGECONFIG and then without it. Each build recompiles everything, the optee bl31 carries the opteed service and the plain one does not. With u-boot-fslc 2026.10, core-image-weston then boots on an imx8mq-evk board through BL31, U-Boot and Linux to Weston. Signed-off-by: Rodrigo M. Duarte --- recipes-bsp/imx-atf/imx-atf_2.14.bb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/recipes-bsp/imx-atf/imx-atf_2.14.bb b/recipes-bsp/imx-atf/imx-atf_2.14.bb index 407808b40..daf74d016 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.14.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.14.bb @@ -29,6 +29,12 @@ ATF_SRC ?= "git://github.com/nxp-imx/imx-atf.git;protocol=https" SRCBRANCH = "lf_v2.14" SRCREV = "af9eb2c1748ee3abc0ead7dc76e462f50c573036" +# Build out of tree and from scratch: the TF-A Makefile does not track +# build options such as SPD, so an incremental build after a +# PACKAGECONFIG change would relink nothing and deploy a stale bl31.bin. +B = "${WORKDIR}/build" +do_compile[cleandirs] = "${B}" + inherit deploy PACKAGECONFIG ??= "\ @@ -52,6 +58,7 @@ ATF_SYS_PWR_FULL_CTRL ?= "0" EXTRA_OEMAKE += "\ CROSS_COMPILE=${TARGET_PREFIX} \ PLAT=${ATF_PLATFORM} \ + BUILD_BASE=${B} \ ${PACKAGECONFIG_CONFARGS} \ bl31 \ " @@ -81,6 +88,11 @@ EXTRA_OEMAKE += 'SYS_PWR_FULL_CTRL=${ATF_SYS_PWR_FULL_CTRL}' do_configure[noexec] = "1" +# The Makefile is in ${S}, while the build output goes to ${B}. +do_compile() { + oe_runmake -C ${S} +} + do_install[noexec] = "1" # The appends join without a leading space to build the contiguous bl31 @@ -97,7 +109,7 @@ addtask deploy after do_compile do_deploy() { OUTPUT_FOLDER="${@bb.utils.contains('PACKAGECONFIG', 'debug', 'debug', 'release', d)}" for deploydir in ${DEPLOYDIR} ${DEPLOYDIR}/imx-boot-tools; do - install -Dm 0644 ${S}/build/${ATF_PLATFORM}/${OUTPUT_FOLDER}/bl31.bin $deploydir/${ANNOTATED_NAME} + install -Dm 0644 ${B}/${ATF_PLATFORM}/${OUTPUT_FOLDER}/bl31.bin $deploydir/${ANNOTATED_NAME} done ln -sf ${ANNOTATED_NAME} ${DEPLOYDIR}/bl31.bin } -- cgit v1.2.3-54-g00ecf