platform.mk 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #
  2. # Copyright (c) 2019-2024, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. #
  7. # Translation tables library
  8. include lib/xlat_tables_v2/xlat_tables.mk
  9. PLAT_INCLUDES := -Iplat/imx/common/include \
  10. -Iplat/imx/imx8m/include \
  11. -Iplat/imx/imx8m/imx8mm/include \
  12. -Idrivers/imx/usdhc \
  13. -Iinclude/common/tbbr \
  14. -Iinclude/lib/libfdt
  15. # Include GICv3 driver files
  16. include drivers/arm/gic/v3/gicv3.mk
  17. include lib/libfdt/libfdt.mk
  18. IMX_DRAM_SOURCES := plat/imx/imx8m/ddr/dram.c \
  19. plat/imx/imx8m/ddr/clock.c \
  20. plat/imx/imx8m/ddr/dram_retention.c \
  21. plat/imx/imx8m/ddr/ddr4_dvfs.c \
  22. plat/imx/imx8m/ddr/lpddr4_dvfs.c
  23. IMX_GIC_SOURCES := ${GICV3_SOURCES} \
  24. plat/common/plat_gicv3.c \
  25. plat/common/plat_psci_common.c \
  26. plat/imx/common/plat_imx8_gic.c
  27. BL31_SOURCES += common/desc_image_load.c \
  28. plat/imx/common/imx8_helpers.S \
  29. plat/imx/imx8m/gpc_common.c \
  30. plat/imx/imx8m/imx_hab.c \
  31. plat/imx/imx8m/imx_aipstz.c \
  32. plat/imx/imx8m/imx_rdc.c \
  33. plat/imx/imx8m/imx8m_csu.c \
  34. plat/imx/imx8m/imx8m_caam.c \
  35. plat/imx/imx8m/imx8m_ccm.c \
  36. plat/imx/imx8m/imx8m_psci_common.c \
  37. plat/imx/imx8m/imx8m_snvs.c \
  38. plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c \
  39. plat/imx/imx8m/imx8mm/imx8mm_psci.c \
  40. plat/imx/imx8m/imx8mm/gpc.c \
  41. plat/imx/common/imx8_topology.c \
  42. plat/imx/common/imx_sip_handler.c \
  43. plat/imx/common/imx_sip_svc.c \
  44. plat/imx/common/imx_common.c \
  45. plat/imx/common/imx_uart_console.S \
  46. lib/cpus/aarch64/cortex_a53.S \
  47. drivers/arm/tzc/tzc380.c \
  48. drivers/delay_timer/delay_timer.c \
  49. drivers/delay_timer/generic_delay_timer.c \
  50. ${XLAT_TABLES_LIB_SRCS} \
  51. ${IMX_GIC_SOURCES}
  52. ifeq (${NEED_BL2},yes)
  53. BL2_SOURCES += common/desc_image_load.c \
  54. common/fdt_wrappers.c \
  55. plat/imx/common/imx8_helpers.S \
  56. plat/imx/common/imx_uart_console.S \
  57. plat/imx/imx8m/imx8mm/imx8mm_bl2_el3_setup.c \
  58. plat/imx/imx8m/imx8mm/gpc.c \
  59. plat/imx/imx8m/imx_aipstz.c \
  60. plat/common/plat_psci_common.c \
  61. lib/xlat_tables/aarch64/xlat_tables.c \
  62. lib/xlat_tables/xlat_tables_common.c \
  63. lib/cpus/aarch64/cortex_a53.S \
  64. drivers/delay_timer/delay_timer.c \
  65. drivers/delay_timer/generic_delay_timer.c \
  66. ${PLAT_GIC_SOURCES} \
  67. ${PLAT_DRAM_SOURCES} \
  68. drivers/mmc/mmc.c \
  69. drivers/io/io_block.c \
  70. drivers/io/io_fip.c \
  71. drivers/io/io_memmap.c \
  72. drivers/io/io_storage.c \
  73. drivers/imx/usdhc/imx_usdhc.c \
  74. plat/imx/imx8m/imx8mm/imx8mm_bl2_mem_params_desc.c \
  75. plat/imx/common/imx_io_storage.c \
  76. plat/imx/imx8m/imx8m_image_load.c \
  77. lib/optee/optee_utils.c
  78. endif
  79. # Add the build options to pack BLx images and kernel device tree
  80. # in the FIP if the platform requires.
  81. ifneq ($(BL2),)
  82. RESET_TO_BL31 := 0
  83. $(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
  84. endif
  85. ifneq ($(BL32_EXTRA1),)
  86. $(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
  87. endif
  88. ifneq ($(BL32_EXTRA2),)
  89. $(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
  90. endif
  91. ifneq ($(HW_CONFIG),)
  92. $(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
  93. endif
  94. ifeq (${NEED_BL2},yes)
  95. $(eval $(call add_define,NEED_BL2))
  96. LOAD_IMAGE_V2 := 1
  97. # Non-TF Boot ROM
  98. RESET_TO_BL2 := 1
  99. endif
  100. ifneq (${TRUSTED_BOARD_BOOT},0)
  101. include drivers/auth/mbedtls/mbedtls_crypto.mk
  102. include drivers/auth/mbedtls/mbedtls_x509.mk
  103. AUTH_SOURCES := drivers/auth/auth_mod.c \
  104. drivers/auth/crypto_mod.c \
  105. drivers/auth/img_parser_mod.c \
  106. drivers/auth/tbbr/tbbr_cot_common.c \
  107. drivers/auth/tbbr/tbbr_cot_bl2.c
  108. BL2_SOURCES += ${AUTH_SOURCES} \
  109. plat/common/tbbr/plat_tbbr.c \
  110. plat/imx/imx8m/imx8mm/imx8mm_trusted_boot.c \
  111. plat/imx/imx8m/imx8mm/imx8mm_rotpk.S
  112. ROT_KEY = $(BUILD_PLAT)/rot_key.pem
  113. ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
  114. $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
  115. $(BUILD_PLAT)/bl2/imx8mm_rotpk.o: $(ROTPK_HASH)
  116. certificates: $(ROT_KEY)
  117. $(ROT_KEY): | $$(@D)/
  118. $(s)echo " OPENSSL $@"
  119. $(q)if [ ! -f $(ROT_KEY) ]; then \
  120. ${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null; \
  121. fi
  122. $(ROTPK_HASH): $(ROT_KEY) | $$(@D)/
  123. $(s)echo " OPENSSL $@"
  124. $(q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
  125. ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null
  126. endif
  127. ENABLE_PIE := 1
  128. USE_COHERENT_MEM := 1
  129. RESET_TO_BL31 := 1
  130. A53_DISABLE_NON_TEMPORAL_HINT := 0
  131. ERRATA_A53_835769 := 1
  132. ERRATA_A53_843419 := 1
  133. ERRATA_A53_855873 := 1
  134. IMX_DRAM_RETENTION ?= 1
  135. $(eval $(call assert_boolean,IMX_DRAM_RETENTION))
  136. $(eval $(call add_define,IMX_DRAM_RETENTION))
  137. ifeq (${IMX_DRAM_RETENTION},1)
  138. BL31_SOURCES += ${IMX_DRAM_SOURCES}
  139. endif
  140. ifneq (${PRELOADED_BL33_BASE},)
  141. $(eval $(call add_define_val,PLAT_NS_IMAGE_OFFSET,${PRELOADED_BL33_BASE}))
  142. endif
  143. BL32_BASE ?= 0xbe000000
  144. $(eval $(call add_define,BL32_BASE))
  145. BL32_SIZE ?= 0x2000000
  146. $(eval $(call add_define,BL32_SIZE))
  147. IMX_BOOT_UART_BASE ?= 0x30890000
  148. ifeq (${IMX_BOOT_UART_BASE},auto)
  149. override IMX_BOOT_UART_BASE := 0
  150. endif
  151. $(eval $(call add_define,IMX_BOOT_UART_BASE))
  152. EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
  153. ifeq (${SDEI_SUPPORT}, 1)
  154. BL31_SOURCES += plat/imx/common/imx_ehf.c \
  155. plat/imx/common/imx_sdei.c
  156. endif
  157. ifeq (${MEASURED_BOOT},1)
  158. MEASURED_BOOT_MK := drivers/measured_boot/event_log/event_log.mk
  159. $(info Including ${MEASURED_BOOT_MK})
  160. include ${MEASURED_BOOT_MK}
  161. BL2_SOURCES += plat/imx/imx8m/imx8m_measured_boot.c \
  162. plat/imx/imx8m/imx8m_dyn_cfg_helpers.c \
  163. ${EVENT_LOG_SOURCES}
  164. endif
  165. ifeq (${SPD},trusty)
  166. BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
  167. endif