fuse.mk 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #
  2. # Copyright 2018-2020 NXP
  3. # Copyright (c) 2023-2024, Arm Limited. All rights reserved.
  4. #
  5. # SPDX-License-Identifier: BSD-3-Clause
  6. #
  7. #
  8. NEED_FUSE := yes
  9. $(eval $(call add_define, PLAT_DEF_FIP_UUID))
  10. $(eval $(call add_define, POLICY_FUSE_PROVISION))
  11. $(eval $(call add_define, PLAT_TBBR_IMG_DEF))
  12. $(eval $(call SET_NXP_MAKE_FLAG,IMG_LOADR_NEEDED,BL2))
  13. $(eval $(call SET_NXP_MAKE_FLAG,SFP_NEEDED,BL2))
  14. $(eval $(call SET_NXP_MAKE_FLAG,GPIO_NEEDED,BL2))
  15. FIP_HANDLER_PATH := ${PLAT_COMMON_PATH}/fip_handler
  16. FIP_HANDLER_COMMON_PATH := ${FIP_HANDLER_PATH}/common
  17. FUSE_SOURCES := ${FIP_HANDLER_PATH}/fuse_fip/fuse_io_storage.c
  18. PLAT_INCLUDES += -I${FIP_HANDLER_COMMON_PATH}\
  19. -I${FIP_HANDLER_PATH}/fuse_fip
  20. FUSE_FIP_NAME := fuse_fip.bin
  21. fip_fuse: ${BUILD_PLAT}/${FUSE_FIP_NAME}
  22. ifeq (${FUSE_PROV_FILE},)
  23. else
  24. ifeq (${TRUSTED_BOARD_BOOT},1)
  25. FUSE_PROV_FILE_SB = $(notdir ${FUSE_PROV_FILE})_prov.sb
  26. FUSE_FIP_ARGS += --fuse-prov ${BUILD_PLAT}/${FUSE_PROV_FILE_SB}
  27. FUSE_FIP_DEPS += ${BUILD_PLAT}/${FUSE_PROV_FILE_SB}
  28. else
  29. FUSE_FIP_ARGS += --fuse-prov ${FUSE_PROV_FILE}
  30. FUSE_FIP_DEPS += ${FUSE_PROV_FILE}
  31. endif
  32. endif
  33. ifeq (${FUSE_UP_FILE},)
  34. else
  35. ifeq (${TRUSTED_BOARD_BOOT},1)
  36. FUSE_UP_FILE_SB = $(notdir ${FUSE_UP_FILE})_up.sb
  37. FUSE_FIP_ARGS += --fuse-up ${BUILD_PLAT}/${FUSE_UP_FILE_SB}
  38. FUSE_FIP_DEPS += ${BUILD_PLAT}/${FUSE_UP_FILE_SB}
  39. else
  40. FUSE_FIP_ARGS += --fuse-up ${FUSE_UP_FILE}
  41. FUSE_FIP_DEPS += ${FUSE_UP_FILE}
  42. endif
  43. endif
  44. ifeq (${TRUSTED_BOARD_BOOT},1)
  45. ifeq (${MBEDTLS_DIR},)
  46. else
  47. $(error Error: Trusted Board Boot with X509 certificates not supported with FUSE_PROG build option)
  48. endif
  49. # Path to CST directory is required to generate the CSF header
  50. # and prepend it to image before fip image gets generated
  51. ifeq (${CST_DIR},)
  52. $(error Error: CST_DIR not set)
  53. endif
  54. ifeq (${FUSE_INPUT_FILE},)
  55. FUSE_INPUT_FILE := $(PLAT_DRIVERS_PATH)/auth/csf_hdr_parser/${CSF_FILE}
  56. endif
  57. ifeq (${FUSE_PROV_FILE},)
  58. else
  59. ${BUILD_PLAT}/${FUSE_PROV_FILE_SB}: ${FUSE_PROV_FILE}
  60. $(s)echo " Generating CSF Header for $@ $<"
  61. $(CST_DIR)/create_hdr_esbc --in $< --out $@ --app_off ${CSF_HDR_SZ} \
  62. --app $< ${FUSE_INPUT_FILE}
  63. endif
  64. ifeq (${FUSE_UP_FILE},)
  65. else
  66. ${BUILD_PLAT}/${FUSE_UP_FILE_SB}: ${FUSE_UP_FILE}
  67. $(s)echo " Generating CSF Header for $@ $<"
  68. $(CST_DIR)/create_hdr_esbc --in $< --out $@ --app_off ${CSF_HDR_SZ} \
  69. --app $< ${FUSE_INPUT_FILE}
  70. endif
  71. endif
  72. ${BUILD_PLAT}/${FUSE_FIP_NAME}: fiptool ${FUSE_FIP_DEPS}
  73. ifeq (${FUSE_FIP_DEPS},)
  74. $(error "Error: FUSE_PROV_FILE or/and FUSE_UP_FILE needs to point to the right file")
  75. endif
  76. ${FIPTOOL} create ${FUSE_FIP_ARGS} $@
  77. ${FIPTOOL} info $@
  78. $(s)echo
  79. $(s)echo "Built $@ successfully"
  80. $(s)echo