blob: 1c6c9f806fe5519eca5636ec99dcf5ab64cb213f [file] [log] [blame]
Jacky Baia6177002019-03-06 17:15:06 +08001#
Jacky Bai210ec7d2022-03-28 16:11:23 +08002# Copyright (c) 2019-2022, 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
33BL31_SOURCES += plat/imx/common/imx8_helpers.S \
34 plat/imx/imx8m/gpc_common.c \
Jacky Bai91c6d322019-05-21 20:24:52 +080035 plat/imx/imx8m/imx_aipstz.c \
Jacky Bai64130a32019-07-18 13:43:17 +080036 plat/imx/imx8m/imx_rdc.c \
Jacky Bai3c3c2682020-01-07 14:53:54 +080037 plat/imx/imx8m/imx8m_csu.c \
Jacky Bai3bf04a52019-06-12 17:41:47 +080038 plat/imx/imx8m/imx8m_caam.c \
Jacky Baia6177002019-03-06 17:15:06 +080039 plat/imx/imx8m/imx8m_psci_common.c \
40 plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c \
41 plat/imx/imx8m/imx8mm/imx8mm_psci.c \
42 plat/imx/imx8m/imx8mm/gpc.c \
43 plat/imx/common/imx8_topology.c \
Leonard Crestez402bd522019-05-08 22:29:21 +030044 plat/imx/common/imx_sip_handler.c \
45 plat/imx/common/imx_sip_svc.c \
Jacky Baia6177002019-03-06 17:15:06 +080046 plat/imx/common/imx_uart_console.S \
Jacky Baia6177002019-03-06 17:15:06 +080047 lib/cpus/aarch64/cortex_a53.S \
Jacky Baia6177002019-03-06 17:15:06 +080048 drivers/arm/tzc/tzc380.c \
49 drivers/delay_timer/delay_timer.c \
50 drivers/delay_timer/generic_delay_timer.c \
Ji Luoe329b3d2020-02-20 23:47:21 +080051 ${XLAT_TABLES_LIB_SRCS} \
Jacky Baiec031802019-11-25 14:45:32 +080052 ${IMX_DRAM_SOURCES} \
Jacky Baia6177002019-03-06 17:15:06 +080053 ${IMX_GIC_SOURCES}
54
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080055ifeq (${NEED_BL2},yes)
56BL2_SOURCES += common/desc_image_load.c \
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +080057 common/fdt_wrappers.c \
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080058 plat/imx/common/imx8_helpers.S \
59 plat/imx/common/imx_uart_console.S \
60 plat/imx/imx8m/imx8mm/imx8mm_bl2_el3_setup.c \
61 plat/imx/imx8m/imx8mm/gpc.c \
62 plat/imx/imx8m/imx_aipstz.c \
63 plat/common/plat_psci_common.c \
64 lib/xlat_tables/aarch64/xlat_tables.c \
65 lib/xlat_tables/xlat_tables_common.c \
66 lib/cpus/aarch64/cortex_a53.S \
67 drivers/delay_timer/delay_timer.c \
68 drivers/delay_timer/generic_delay_timer.c \
69 ${PLAT_GIC_SOURCES} \
70 ${PLAT_DRAM_SOURCES} \
71 drivers/mmc/mmc.c \
72 drivers/io/io_block.c \
73 drivers/io/io_fip.c \
74 drivers/io/io_memmap.c \
75 drivers/io/io_storage.c \
76 drivers/imx/usdhc/imx_usdhc.c \
77 plat/imx/imx8m/imx8mm/imx8mm_bl2_mem_params_desc.c \
Ying-Chun Liu (PaulLiu)54cabc42021-04-07 06:10:32 +080078 plat/imx/common/imx_io_storage.c \
Ying-Chun Liu (PaulLiu)e6a7f882021-04-07 06:12:37 +080079 plat/imx/imx8m/imx8m_image_load.c \
Ying-Chun Liu (PaulLiu)234c2712020-12-22 02:56:00 +080080 lib/optee/optee_utils.c
81endif
82
83# Add the build options to pack BLx images and kernel device tree
84# in the FIP if the platform requires.
85ifneq ($(BL2),)
86RESET_TO_BL31 := 0
87$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
88endif
89ifneq ($(BL32_EXTRA1),)
90$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
91endif
92ifneq ($(BL32_EXTRA2),)
93$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
94endif
95ifneq ($(HW_CONFIG),)
96$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
97endif
98
99ifeq (${NEED_BL2},yes)
100$(eval $(call add_define,NEED_BL2))
101LOAD_IMAGE_V2 := 1
102# Non-TF Boot ROM
103BL2_AT_EL3 := 1
104endif
105
106ifneq (${TRUSTED_BOARD_BOOT},0)
107
108include drivers/auth/mbedtls/mbedtls_crypto.mk
109include drivers/auth/mbedtls/mbedtls_x509.mk
110
111AUTH_SOURCES := drivers/auth/auth_mod.c \
112 drivers/auth/crypto_mod.c \
113 drivers/auth/img_parser_mod.c \
114 drivers/auth/tbbr/tbbr_cot_common.c \
115 drivers/auth/tbbr/tbbr_cot_bl2.c
116
117BL2_SOURCES += ${AUTH_SOURCES} \
118 plat/common/tbbr/plat_tbbr.c \
119 plat/imx/imx8m/imx8mm/imx8mm_trusted_boot.c \
120 plat/imx/imx8m/imx8mm/imx8mm_rotpk.S
121
122ROT_KEY = $(BUILD_PLAT)/rot_key.pem
123ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
124
125$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
126$(eval $(call MAKE_LIB_DIRS))
127
128$(BUILD_PLAT)/bl2/imx8mm_rotpk.o: $(ROTPK_HASH)
129
130certificates: $(ROT_KEY)
131
132$(ROT_KEY): | $(BUILD_PLAT)
133 @echo " OPENSSL $@"
134 @if [ ! -f $(ROT_KEY) ]; then \
135 openssl genrsa 2048 > $@ 2>/dev/null; \
136 fi
137
138$(ROTPK_HASH): $(ROT_KEY)
139 @echo " OPENSSL $@"
140 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
141 openssl dgst -sha256 -binary > $@ 2>/dev/null
142endif
143
Jacky Baia6177002019-03-06 17:15:06 +0800144USE_COHERENT_MEM := 1
145RESET_TO_BL31 := 1
146A53_DISABLE_NON_TEMPORAL_HINT := 0
Jacky Baia6177002019-03-06 17:15:06 +0800147
148ERRATA_A53_835769 := 1
149ERRATA_A53_843419 := 1
150ERRATA_A53_855873 := 1
Jacky Bai2a763ba2019-07-18 13:34:09 +0800151
152BL32_BASE ?= 0xbe000000
153$(eval $(call add_define,BL32_BASE))
154
155BL32_SIZE ?= 0x2000000
156$(eval $(call add_define,BL32_SIZE))
Igor Opaniuk9fc5cb62020-03-05 22:10:41 +0200157
158IMX_BOOT_UART_BASE ?= 0x30890000
159$(eval $(call add_define,IMX_BOOT_UART_BASE))
Peng Fan57e982c2020-07-27 21:22:14 +0800160
Jacky Bai210ec7d2022-03-28 16:11:23 +0800161EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
162ifeq (${SDEI_SUPPORT}, 1)
163BL31_SOURCES += plat/imx/common/imx_ehf.c \
164 plat/imx/common/imx_sdei.c
165endif
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800166
167ifeq (${MEASURED_BOOT},1)
168 MEASURED_BOOT_MK := drivers/measured_boot/event_log/event_log.mk
169 $(info Including ${MEASURED_BOOT_MK})
170 include ${MEASURED_BOOT_MK}
171
laurenw-arm307592f2022-06-16 13:40:48 -0500172ifneq (${MBOOT_EL_HASH_ALG}, sha256)
173 $(eval $(call add_define,TF_MBEDTLS_MBOOT_USE_SHA512))
174endif
175
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800176BL2_SOURCES += plat/imx/imx8m/imx8m_measured_boot.c \
177 plat/imx/imx8m/imx8m_dyn_cfg_helpers.c \
178 ${EVENT_LOG_SOURCES}
Ji Luoe329b3d2020-02-20 23:47:21 +0800179endif
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800180
Ji Luoe329b3d2020-02-20 23:47:21 +0800181ifeq (${SPD},trusty)
182 BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
Ying-Chun Liu (PaulLiu)ac6d8622021-10-06 09:27:00 +0800183endif