From 7496beb1a474e191890725c3ddaa2ea99eb213ce Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Wed, 12 Feb 2025 18:45:58 +0100 Subject: [PATCH] fip-stm32mp: move function to create symlinks from tf-a recipe We had a SYSROOT_PREPROCESS_FUNCS on the tf-a-stm32mp recipe to create symlinks to both TF-A and FIP binaries, but the FIP binaries are now produced by fip-stm32mp recipe. This had the effect that the files might not be ready. Duplicate the function in the fip-stm32mp recipe and create the symlinks for the FIP images there. Signed-off-by: Hector Palacios --- .../fip-stm32mp/fip-stm32mp.bbappend | 32 +++++++++++++++++++ .../tf-a-stm32mp_2.10.bbappend | 25 ++------------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/fip-stm32mp/fip-stm32mp.bbappend b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/fip-stm32mp/fip-stm32mp.bbappend index 43a71610c..db8e28501 100644 --- a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/fip-stm32mp/fip-stm32mp.bbappend +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/fip-stm32mp/fip-stm32mp.bbappend @@ -136,3 +136,35 @@ do_deploy() { done } addtask deploy before do_build after do_compile + +FWDDR_SUFFIX ?= "bin" + +# This runs after 'sysroot_populate()' which populates all +# FIP artifacts on the image deploy dir. +# The purpose of this function is to create symlinks to the files needed +# by the uuu installer that are located in subdirectories. +deploy_symlinks_fip() { + # Create symlinks in DEPLOY_DIR_IMAGE + + # Remove trailing slash (/) from ST variables + FIP_BASEDIR="$(echo ${FIP_DIR_FIP} | cut -c2-)" + unset i + for config in ${FIP_CONFIG}; do + i="$(expr ${i} + 1)" + dt_config=$(echo ${FIP_DEVICETREE} | cut -d',' -f${i}) + for dt in ${dt_config}; do + FIP_FILENAME="${FIP_BASENAME}-${dt}-${config}${FIP_SIGN_SUFFIX}.${FIP_SUFFIX}" + if [ -f "${DEPLOY_DIR_IMAGE}/${FIP_BASEDIR}/${FIP_FILENAME}" ]; then + cd "${DEPLOY_DIR_IMAGE}" + # symlink FIP + ln -sf "${FIP_BASEDIR}/${FIP_FILENAME}" "${DEPLOY_DIR_IMAGE}/" + fi + if [ -f "${DEPLOY_DIR_IMAGE}/${FIP_BASEDIR}/${FIP_BASENAME}-${dt}-ddr-${config}.${FWDDR_SUFFIX}" ]; then + cd "${DEPLOY_DIR_IMAGE}" + # symlink DDR firmware (needed for USB recovery) + ln -sf "${FIP_BASEDIR}/${FIP_BASENAME}-${dt}-ddr-${config}.${FWDDR_SUFFIX}" "${DEPLOY_DIR_IMAGE}/" + fi + done + done +} +SYSROOT_PREPROCESS_FUNCS += "deploy_symlinks_fip" diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.10.bbappend b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.10.bbappend index b2774d761..cb1c39ec7 100644 --- a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.10.bbappend +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.10.bbappend @@ -67,7 +67,7 @@ python set_fip_sign_key() { # TF-A artifacts on the image deploy dir. # The purpose of this function is to create symlinks to the files needed # by the uuu installer that are located in subdirectories. -deploy_symlinks() { +deploy_symlinks_atf() { # Remove trailing slash (/) from ST variable TF_A_BASEDIR="$(echo ${FIP_DIR_TFA_BASE} | cut -c2-)" unset i @@ -94,29 +94,8 @@ deploy_symlinks() { ln -sf "${TF_A_BASEDIR}/${TF_A_METADATA_BINARY}" "${DEPLOY_DIR_IMAGE}/${TF_A_METADATA_NAME}-${dt}.${TF_A_METADATA_SUFFIX}" fi fi - - # Remove trailing slash (/) from ST variables - FIP_BASEDIR="$(echo ${FIP_DIR_FIP} | cut -c2-)" - unset i - for config in ${FIP_CONFIG}; do - i="$(expr ${i} + 1)" - dt_config="$(echo ${FIP_DEVICETREE} | cut -d',' -f${i})" - for dt in ${dt_config}; do - FIP_FILENAME="${FIP_BASENAME}-${dt}-${config}${FIP_SIGN_SUFFIX}.${FIP_SUFFIX}" - if [ -f "${DEPLOY_DIR_IMAGE}/${FIP_BASEDIR}/${FIP_FILENAME}" ]; then - cd "${DEPLOY_DIR_IMAGE}" - # symlink FIP - ln -sf "${FIP_BASEDIR}/${FIP_FILENAME}" "${DEPLOY_DIR_IMAGE}/" - fi - if [ -f "${DEPLOY_DIR_IMAGE}/${FIP_BASEDIR}/${FIP_BASENAME}-${dt}-ddr-${config}.${FWDDR_SUFFIX}" ]; then - cd "${DEPLOY_DIR_IMAGE}" - # symlink DDR firmware (needed for USB recovery) - ln -sf "${FIP_BASEDIR}/${FIP_BASENAME}-${dt}-ddr-${config}.${FWDDR_SUFFIX}" "${DEPLOY_DIR_IMAGE}/" - fi - done - done } -SYSROOT_PREPROCESS_FUNCS += "deploy_symlinks" +SYSROOT_PREPROCESS_FUNCS += "deploy_symlinks_atf" # Sign TF-A image do_deploy[postfuncs] += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'tfa_sign', '', d)}"