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