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