The regex was a bit too strict in which characters it allowed. Thus, if e.g. a file name appears in the BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES string, it no longer matches, and we end up with an empty ATF_VARIABLES. This makes the subsequent grep fail, and the post-image.sh script fails without any error message (thanks to the -e option). Simplify the regex to match everything except the closing quotation mark. Note that Kconfig doesn't allow quotation marks at all inside a string (even escaped ones), so this regular expression is always OK. Signed-off-by: Marleen Vos <marleen.vos@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
35 lines
955 B
Bash
Executable File
35 lines
955 B
Bash
Executable File
#!/bin/sh -eu
|
|
|
|
#
|
|
# atf_image extracts the ATF binary image from DTB_FILE_NAME that appears in
|
|
# BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES in ${BR_CONFIG},
|
|
# then prints the corresponding file name for the genimage
|
|
# configuration file
|
|
#
|
|
atf_image()
|
|
{
|
|
ATF_VARIABLES="$(sed -n 's/^BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="\([^\"]*\)"$/\1/p' ${BR2_CONFIG})"
|
|
# make sure DTB_FILE_NAME is set
|
|
printf '%s\n' "${ATF_VARIABLES}" | grep -Eq 'DTB_FILE_NAME=[0-9A-Za-z_\-]*'
|
|
# extract the value
|
|
DTB_FILE_NAME="$(printf '%s\n' "${ATF_VARIABLES}" | sed 's/.*DTB_FILE_NAME=\([a-zA-Z0-9_\-]*\)\.dtb.*/\1/')"
|
|
echo "tf-a-${DTB_FILE_NAME}.stm32"
|
|
}
|
|
|
|
main()
|
|
{
|
|
ATFBIN="$(atf_image)"
|
|
GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
|
|
|
|
sed -e "s/%ATFBIN%/${ATFBIN}/" \
|
|
board/stmicroelectronics/common/stm32mp157/genimage.cfg.template > ${GENIMAGE_CFG}
|
|
|
|
support/scripts/genimage.sh -c ${GENIMAGE_CFG}
|
|
|
|
rm -f ${GENIMAGE_CFG}
|
|
|
|
exit $?
|
|
}
|
|
|
|
main $@
|