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