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