u-boot-dey: split do_deploy:append to postfuncs

The do_deploy:append did three things:
- adapt the U-Boot filenames to 'u-boot-<platform>-<config>.<ext>'
- sign/encrypt the U-Boot files (only for iMX6 family)
- sign the boot scripts

Convert the first two actions into functions (the third already was) and
call them conditionally as postfuncs.
Also skip the signing of U-Boot files if the platform is not based on
iMX6 family.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2023-02-14 17:10:21 +01:00
parent 9b165196bb
commit 762a4a8315
1 changed files with 31 additions and 6 deletions

View File

@ -63,6 +63,16 @@ def tf_bootscript_sedfilter(d):
tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE') or ""
return "s,\(^[[:blank:]]*\)true.*,\\1setenv boot_initrd true\\n\\1setenv initrd_file %s-${MACHINE}.cpio.gz.u-boot.tf,g" % tf_initramfs if tf_initramfs else ""
SIGN_UBOOT ?= ""
SIGN_UBOOT:ccimx6 = "sign_uboot"
SIGN_UBOOT:ccimx6ul = "sign_uboot"
do_deploy[postfuncs] += " \
adapt_uboot_filenames \
${@oe.utils.ifelse('BUILD_UBOOT_SCRIPTS', 'build_uboot_scripts', '')} \
${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', '${SIGN_UBOOT}', '', d)} \
"
build_uboot_scripts() {
for f in $(echo ${INSTALL_FW_UBOOT_SCRIPTS} | sed -e 's,file\:\/\/,,g'); do
f_ext="${f##*.}"
@ -107,7 +117,7 @@ build_uboot_scripts() {
fi
}
do_deploy:append() {
adapt_uboot_filenames() {
# Remove canonical U-Boot symlinks for ${UBOOT_CONFIG} currently in the form:
# u-boot-<platform>.<ext>-<type>
# u-boot-<type>
@ -124,7 +134,26 @@ do_deploy:append() {
cd ${DEPLOYDIR}
rm -r ${UBOOT_BINARY}-${type}
ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
if [ "${TRUSTFENCE_SIGN}" = "1" ] && [ "${BOOTLOADER_IMAGE_RECIPE}" = "u-boot" ]; then
fi
done
unset j
done
unset i
fi
}
sign_uboot() {
# This function only applies to CC6, CC6Plus and CC6UL
if [ -n "${UBOOT_CONFIG}" ]
then
for config in ${UBOOT_MACHINE}; do
i=$(expr $i + 1);
for type in ${UBOOT_CONFIG}; do
j=$(expr $j + 1);
if [ $j -eq $i ]
then
cd ${DEPLOYDIR}
if [ "${BOOTLOADER_IMAGE_RECIPE}" = "u-boot" ]; then
install ${B}/${config}/SRK_efuses.bin SRK_efuses-${PV}-${PR}.bin
ln -sf SRK_efuses-${PV}-${PR}.bin SRK_efuses.bin
@ -146,10 +175,6 @@ do_deploy:append() {
done
unset i
fi
if [ "${BUILD_UBOOT_SCRIPTS}" = "true" ]; then
build_uboot_scripts
fi
}
BOOT_TOOLS = "imx-boot-tools"