post-image.sh 955 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh -eu
  2. #
  3. # atf_image extracts the ATF binary image from DTB_FILE_NAME that appears in
  4. # BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES in ${BR_CONFIG},
  5. # then prints the corresponding file name for the genimage
  6. # configuration file
  7. #
  8. atf_image()
  9. {
  10. ATF_VARIABLES="$(sed -n 's/^BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="\([^\"]*\)"$/\1/p' ${BR2_CONFIG})"
  11. # make sure DTB_FILE_NAME is set
  12. printf '%s\n' "${ATF_VARIABLES}" | grep -Eq 'DTB_FILE_NAME=[0-9A-Za-z_\-]*'
  13. # extract the value
  14. DTB_FILE_NAME="$(printf '%s\n' "${ATF_VARIABLES}" | sed 's/.*DTB_FILE_NAME=\([a-zA-Z0-9_\-]*\)\.dtb.*/\1/')"
  15. echo "tf-a-${DTB_FILE_NAME}.stm32"
  16. }
  17. main()
  18. {
  19. ATFBIN="$(atf_image)"
  20. GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
  21. sed -e "s/%ATFBIN%/${ATFBIN}/" \
  22. board/stmicroelectronics/common/stm32mp1xx/genimage.cfg.template > ${GENIMAGE_CFG}
  23. support/scripts/genimage.sh -c ${GENIMAGE_CFG}
  24. rm -f ${GENIMAGE_CFG}
  25. exit $?
  26. }
  27. main $@