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