blob: d5c553adae046e76ae8007593dbc21c0627709f0 [file] [log] [blame]
Jacky Baia6177002019-03-06 17:15:06 +08001#
Arvind Ram Prakash11b9b492022-11-22 14:41:00 -06002# Copyright (c) 2019-2023, ARM Limited and Contributors. All rights reserved.
Jacky Baia6177002019-03-06 17:15:06 +08003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
Ji Luoe329b3d2020-02-20 23:47:21 +08006#
7# Translation tables library
8include lib/xlat_tables_v2/xlat_tables.mk
Jacky Baia6177002019-03-06 17:15:06 +08009
10PLAT_INCLUDES := -Iplat/imx/common/include \
11 -Iplat/imx/imx8m/include \
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080012 -Iplat/imx/imx8m/imx8mm/include \
13 -Idrivers/imx/usdhc \
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +080014 -Iinclude/common/tbbr \
15 -Iinclude/lib/libfdt
Jacky Baia6177002019-03-06 17:15:06 +080016
Alexei Fedorov84f1b5d2020-03-23 18:45:17 +000017# Include GICv3 driver files
18include drivers/arm/gic/v3/gicv3.mk
19
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +080020include lib/libfdt/libfdt.mk
21
Jacky Baiec031802019-11-25 14:45:32 +080022IMX_DRAM_SOURCES := plat/imx/imx8m/ddr/dram.c \
Jacky Baid746daa12019-11-25 13:19:37 +080023 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
Jacky Baiec031802019-11-25 14:45:32 +080027
Alexei Fedorov84f1b5d2020-03-23 18:45:17 +000028IMX_GIC_SOURCES := ${GICV3_SOURCES} \
Jacky Baia6177002019-03-06 17:15:06 +080029 plat/common/plat_gicv3.c \
30 plat/common/plat_psci_common.c \
31 plat/imx/common/plat_imx8_gic.c
32
Sascha Hauer3a3eb142024-01-18 11:18:04 +010033BL31_SOURCES += common/desc_image_load.c \
34 plat/imx/common/imx8_helpers.S \
Jacky Baia6177002019-03-06 17:15:06 +080035 plat/imx/imx8m/gpc_common.c \
Andrey Zhizhikin10a4d862022-09-26 22:25:33 +020036 plat/imx/imx8m/imx_hab.c \
Jacky Bai91c6d322019-05-21 20:24:52 +080037 plat/imx/imx8m/imx_aipstz.c \
Jacky Bai64130a32019-07-18 13:43:17 +080038 plat/imx/imx8m/imx_rdc.c \
Jacky Bai3c3c2682020-01-07 14:53:54 +080039 plat/imx/imx8m/imx8m_csu.c \
Jacky Bai3bf04a52019-06-12 17:41:47 +080040 plat/imx/imx8m/imx8m_caam.c \
Marco Felsch76401342023-07-24 15:05:58 +020041 plat/imx/imx8m/imx8m_ccm.c \
Jacky Baia6177002019-03-06 17:15:06 +080042 plat/imx/imx8m/imx8m_psci_common.c \
Marco Felsch2d6c08f2023-09-05 17:15:35 +020043 plat/imx/imx8m/imx8m_snvs.c \
Jacky Baia6177002019-03-06 17:15:06 +080044 plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c \
45 plat/imx/imx8m/imx8mm/imx8mm_psci.c \
46 plat/imx/imx8m/imx8mm/gpc.c \
47 plat/imx/common/imx8_topology.c \
Leonard Crestez402bd522019-05-08 22:29:21 +030048 plat/imx/common/imx_sip_handler.c \
49 plat/imx/common/imx_sip_svc.c \
Sascha Hauereb3d2ee2024-01-18 08:47:06 +010050 plat/imx/common/imx_common.c \
Jacky Baia6177002019-03-06 17:15:06 +080051 plat/imx/common/imx_uart_console.S \
Jacky Baia6177002019-03-06 17:15:06 +080052 lib/cpus/aarch64/cortex_a53.S \
Jacky Baia6177002019-03-06 17:15:06 +080053 drivers/arm/tzc/tzc380.c \
54 drivers/delay_timer/delay_timer.c \
55 drivers/delay_timer/generic_delay_timer.c \
Ji Luoe329b3d2020-02-20 23:47:21 +080056 ${XLAT_TABLES_LIB_SRCS} \
Jacky Baiec031802019-11-25 14:45:32 +080057 ${IMX_DRAM_SOURCES} \
Jacky Baia6177002019-03-06 17:15:06 +080058 ${IMX_GIC_SOURCES}
59
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080060ifeq (${NEED_BL2},yes)
61BL2_SOURCES += common/desc_image_load.c \
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +080062 common/fdt_wrappers.c \
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080063 plat/imx/common/imx8_helpers.S \
64 plat/imx/common/imx_uart_console.S \
65 plat/imx/imx8m/imx8mm/imx8mm_bl2_el3_setup.c \
66 plat/imx/imx8m/imx8mm/gpc.c \
67 plat/imx/imx8m/imx_aipstz.c \
68 plat/common/plat_psci_common.c \
69 lib/xlat_tables/aarch64/xlat_tables.c \
70 lib/xlat_tables/xlat_tables_common.c \
71 lib/cpus/aarch64/cortex_a53.S \
72 drivers/delay_timer/delay_timer.c \
73 drivers/delay_timer/generic_delay_timer.c \
74 ${PLAT_GIC_SOURCES} \
75 ${PLAT_DRAM_SOURCES} \
76 drivers/mmc/mmc.c \
77 drivers/io/io_block.c \
78 drivers/io/io_fip.c \
79 drivers/io/io_memmap.c \
80 drivers/io/io_storage.c \
81 drivers/imx/usdhc/imx_usdhc.c \
82 plat/imx/imx8m/imx8mm/imx8mm_bl2_mem_params_desc.c \
Ying-Chun Liu (PaulLiu)54cabc42021-04-07 06:10:32 +080083 plat/imx/common/imx_io_storage.c \
Ying-Chun Liu (PaulLiu)e6a7f882021-04-07 06:12:37 +080084 plat/imx/imx8m/imx8m_image_load.c \
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080085 lib/optee/optee_utils.c
86endif
87
88# Add the build options to pack BLx images and kernel device tree
89# in the FIP if the platform requires.
90ifneq ($(BL2),)
91RESET_TO_BL31 := 0
92$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
93endif
94ifneq ($(BL32_EXTRA1),)
95$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
96endif
97ifneq ($(BL32_EXTRA2),)
98$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
99endif
100ifneq ($(HW_CONFIG),)
101$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
102endif
103
104ifeq (${NEED_BL2},yes)
105$(eval $(call add_define,NEED_BL2))
106LOAD_IMAGE_V2 := 1
107# Non-TF Boot ROM
Arvind Ram Prakash11b9b492022-11-22 14:41:00 -0600108RESET_TO_BL2 := 1
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +0800109endif
110
111ifneq (${TRUSTED_BOARD_BOOT},0)
112
113include drivers/auth/mbedtls/mbedtls_crypto.mk
114include drivers/auth/mbedtls/mbedtls_x509.mk
115
116AUTH_SOURCES := drivers/auth/auth_mod.c \
117 drivers/auth/crypto_mod.c \
118 drivers/auth/img_parser_mod.c \
119 drivers/auth/tbbr/tbbr_cot_common.c \
120 drivers/auth/tbbr/tbbr_cot_bl2.c
121
122BL2_SOURCES += ${AUTH_SOURCES} \
123 plat/common/tbbr/plat_tbbr.c \
124 plat/imx/imx8m/imx8mm/imx8mm_trusted_boot.c \
125 plat/imx/imx8m/imx8mm/imx8mm_rotpk.S
126
127ROT_KEY = $(BUILD_PLAT)/rot_key.pem
128ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
129
130$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
131$(eval $(call MAKE_LIB_DIRS))
132
133$(BUILD_PLAT)/bl2/imx8mm_rotpk.o: $(ROTPK_HASH)
134
135certificates: $(ROT_KEY)
136
137$(ROT_KEY): | $(BUILD_PLAT)
138 @echo " OPENSSL $@"
139 @if [ ! -f $(ROT_KEY) ]; then \
Salome Thirot0b35da32022-07-14 16:14:15 +0100140 ${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null; \
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +0800141 fi
142
143$(ROTPK_HASH): $(ROT_KEY)
144 @echo " OPENSSL $@"
Salome Thirot0b35da32022-07-14 16:14:15 +0100145 $(Q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
146 ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +0800147endif
148
Marco Felschff2b8722022-08-22 12:39:01 +0200149ENABLE_PIE := 1
Jacky Baia6177002019-03-06 17:15:06 +0800150USE_COHERENT_MEM := 1
151RESET_TO_BL31 := 1
152A53_DISABLE_NON_TEMPORAL_HINT := 0
Jacky Baia6177002019-03-06 17:15:06 +0800153
154ERRATA_A53_835769 := 1
155ERRATA_A53_843419 := 1
156ERRATA_A53_855873 := 1
Jacky Bai2a763ba2019-07-18 13:34:09 +0800157
Marco Felsch44853af2024-01-09 14:59:20 +0100158ifneq (${PRELOADED_BL33_BASE},)
159$(eval $(call add_define_val,PLAT_NS_IMAGE_OFFSET,${PRELOADED_BL33_BASE}))
160endif
161
Jacky Bai2a763ba2019-07-18 13:34:09 +0800162BL32_BASE ?= 0xbe000000
163$(eval $(call add_define,BL32_BASE))
164
165BL32_SIZE ?= 0x2000000
166$(eval $(call add_define,BL32_SIZE))
Igor Opaniuk9fc5cb62020-03-05 22:10:41 +0200167
168IMX_BOOT_UART_BASE ?= 0x30890000
Marco Felsch409eb8b2023-08-02 08:11:35 +0200169ifeq (${IMX_BOOT_UART_BASE},auto)
170 override IMX_BOOT_UART_BASE := 0
171endif
Igor Opaniuk9fc5cb62020-03-05 22:10:41 +0200172$(eval $(call add_define,IMX_BOOT_UART_BASE))
Peng Fan57e982c2020-07-27 21:22:14 +0800173
Jacky Bai210ec7d2022-03-28 16:11:23 +0800174EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
175ifeq (${SDEI_SUPPORT}, 1)
176BL31_SOURCES += plat/imx/common/imx_ehf.c \
177 plat/imx/common/imx_sdei.c
178endif
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800179
180ifeq (${MEASURED_BOOT},1)
181 MEASURED_BOOT_MK := drivers/measured_boot/event_log/event_log.mk
182 $(info Including ${MEASURED_BOOT_MK})
183 include ${MEASURED_BOOT_MK}
184
laurenw-arm307592f2022-06-16 13:40:48 -0500185ifneq (${MBOOT_EL_HASH_ALG}, sha256)
186 $(eval $(call add_define,TF_MBEDTLS_MBOOT_USE_SHA512))
187endif
188
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800189BL2_SOURCES += plat/imx/imx8m/imx8m_measured_boot.c \
190 plat/imx/imx8m/imx8m_dyn_cfg_helpers.c \
191 ${EVENT_LOG_SOURCES}
Ji Luoe329b3d2020-02-20 23:47:21 +0800192endif
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800193
Ji Luoe329b3d2020-02-20 23:47:21 +0800194ifeq (${SPD},trusty)
195 BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800196endif