aboutsummaryrefslogtreecommitdiff
path: root/board/stmicroelectronics/common
diff options
context:
space:
mode:
Diffstat (limited to 'board/stmicroelectronics/common')
-rw-r--r--board/stmicroelectronics/common/stm32mp157/genimage.cfg.template (renamed from board/stmicroelectronics/common/stm32mp157/genimage.cfg)7
-rwxr-xr-xboard/stmicroelectronics/common/stm32mp157/post-image.sh38
2 files changed, 41 insertions, 4 deletions
diff --git a/board/stmicroelectronics/common/stm32mp157/genimage.cfg b/board/stmicroelectronics/common/stm32mp157/genimage.cfg.template
index d1ce530cc5..f341c19f2f 100644
--- a/board/stmicroelectronics/common/stm32mp157/genimage.cfg
+++ b/board/stmicroelectronics/common/stm32mp157/genimage.cfg.template
@@ -4,20 +4,19 @@ image sdcard.img {
}
partition fsbl1 {
- image = "u-boot-spl.stm32"
+ image = "%ATFBIN%"
}
partition fsbl2 {
- image = "u-boot-spl.stm32"
+ image = "%ATFBIN%"
}
partition ssbl {
- image = "u-boot.img"
+ image = "u-boot.stm32"
}
partition rootfs {
image = "rootfs.ext4"
- partition-type = 0x83
bootable = "yes"
}
}
diff --git a/board/stmicroelectronics/common/stm32mp157/post-image.sh b/board/stmicroelectronics/common/stm32mp157/post-image.sh
new file mode 100755
index 0000000000..363c3127cf
--- /dev/null
+++ b/board/stmicroelectronics/common/stm32mp157/post-image.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+#
+# 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()
+{
+ 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"
+ elif grep -Eq "DTB_FILE_NAME=stm32mp157a-avenger96.dtb" <<< ${ATF_VARIABLES}; then
+ echo "tf-a-stm32mp157a-avenger96.stm32"
+ fi
+}
+
+main()
+{
+ 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 $@