platform.mk 5.2 KB

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