path: root/board/stmicroelectronics/common/stm32mp157/post-image.sh
diff options
authorGravatar Shlomi Vaknin <shlomi.39sd@gmail.com>2020-10-07 17:49:43 +0300
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2020-10-13 23:04:03 +0200
commit4d15114713c9f20a6901ec156c8ae73f0cf3739d (patch)
treebaff8db2566021250512622ce517f38362561aeb /board/stmicroelectronics/common/stm32mp157/post-image.sh
parent5d277d20cc4e98d5571beb1d62e92c8c229a80e7 (diff)
configs/stm32mp157*: switch to use TF-A based configurations
This commit changes the stm32mp1 configurations to use the TF-A -> U-Boot boot flow (called "trusted boot flow" by ST) instead of the U-Boot SPL -> U-Boot boot flow. ST recommands this trusted boot, and it's also the only one that allows to use the STM32 Cube Programmer for reflashing devices. As part of this, the genimage configuration file is now generated, as it contains some file names that depend on the platform. Removing partition-type from genimage.cfg is mandatory, since it would cause a hybrid MBR partition table to be created, which itself would prevent ATF from finding the ssbl parition. Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'board/stmicroelectronics/common/stm32mp157/post-image.sh')
1 files changed, 36 insertions, 0 deletions
diff --git a/board/stmicroelectronics/common/stm32mp157/post-image.sh b/board/stmicroelectronics/common/stm32mp157/post-image.sh
new file mode 100755
index 0000000000..eec3cb739d
--- /dev/null
+++ b/board/stmicroelectronics/common/stm32mp157/post-image.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+# atf_image extracts the ATF binary image from DTB_FILE_NAME that appears in
+# then prints the corresponding file name for the genimage
+# configuration file
+ local ATF_VARIABLES="$(sed -n 's/^BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="\([\/a-zA-Z0-9_=. \-]*\)"$/\1/p' ${BR2_CONFIG})"
+ if grep -Eq "DTB_FILE_NAME=stm32mp157c-dk2.dtb" <<< ${ATF_VARIABLES}; then
+ echo "tf-a-stm32mp157c-dk2.stm32"
+ elif grep -Eq "DTB_FILE_NAME=stm32mp157a-dk1.dtb" <<< ${ATF_VARIABLES}; then
+ echo "tf-a-stm32mp157a-dk1.stm32"
+ fi
+ local ATFBIN="$(atf_image)"
+ local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+ local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+ 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 $@