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