blob: ded31ca68e537752cabf7ac728e7c7a765c18318 [file] [log] [blame]
Jacky Bai07ed02c2020-06-03 14:28:45 +08001#
Jacky Bai210ec7d2022-03-28 16:11:23 +08002# Copyright 2019-2022 NXP
Jacky Bai07ed02c2020-06-03 14:28:45 +08003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7PLAT_INCLUDES := -Iplat/imx/common/include \
8 -Iplat/imx/imx8m/include \
Ying-Chun Liu (PaulLiu)a61a5c22021-04-07 06:52:57 +08009 -Iplat/imx/imx8m/imx8mp/include \
10 -Idrivers/imx/usdhc \
11 -Iinclude/common/tbbr
Jacky Bai07ed02c2020-06-03 14:28:45 +080012# 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
Jacky Bai9a6f62f2019-11-25 14:43:26 +080018IMX_DRAM_SOURCES := plat/imx/imx8m/ddr/dram.c \
19 plat/imx/imx8m/ddr/dram_retention.c
20
Jacky Bai07ed02c2020-06-03 14:28:45 +080021IMX_GIC_SOURCES := ${GICV3_SOURCES} \
22 plat/common/plat_gicv3.c \
23 plat/common/plat_psci_common.c \
24 plat/imx/common/plat_imx8_gic.c
25
26BL31_SOURCES += plat/imx/common/imx8_helpers.S \
27 plat/imx/imx8m/gpc_common.c \
28 plat/imx/imx8m/imx_aipstz.c \
29 plat/imx/imx8m/imx_rdc.c \
30 plat/imx/imx8m/imx8m_caam.c \
Jacky Bai3c3c2682020-01-07 14:53:54 +080031 plat/imx/imx8m/imx8m_csu.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080032 plat/imx/imx8m/imx8m_psci_common.c \
33 plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c \
34 plat/imx/imx8m/imx8mp/imx8mp_psci.c \
35 plat/imx/imx8m/imx8mp/gpc.c \
36 plat/imx/common/imx8_topology.c \
37 plat/imx/common/imx_sip_handler.c \
38 plat/imx/common/imx_sip_svc.c \
39 plat/imx/common/imx_uart_console.S \
40 lib/cpus/aarch64/cortex_a53.S \
41 drivers/arm/tzc/tzc380.c \
42 drivers/delay_timer/delay_timer.c \
43 drivers/delay_timer/generic_delay_timer.c \
Jacky Bai9a6f62f2019-11-25 14:43:26 +080044 ${IMX_DRAM_SOURCES} \
Jacky Bai07ed02c2020-06-03 14:28:45 +080045 ${IMX_GIC_SOURCES} \
46 ${XLAT_TABLES_LIB_SRCS}
47
Ying-Chun Liu (PaulLiu)a61a5c22021-04-07 06:52:57 +080048ifeq (${NEED_BL2},yes)
49BL2_SOURCES += common/desc_image_load.c \
50 plat/imx/common/imx8_helpers.S \
51 plat/imx/common/imx_uart_console.S \
52 plat/imx/imx8m/imx8mp/imx8mp_bl2_el3_setup.c \
53 plat/imx/imx8m/imx8mp/gpc.c \
54 plat/imx/imx8m/imx_aipstz.c \
55 plat/imx/imx8m/imx_rdc.c \
56 plat/imx/imx8m/imx8m_caam.c \
57 plat/common/plat_psci_common.c \
58 lib/cpus/aarch64/cortex_a53.S \
59 drivers/arm/tzc/tzc380.c \
60 drivers/delay_timer/delay_timer.c \
61 drivers/delay_timer/generic_delay_timer.c \
62 ${PLAT_GIC_SOURCES} \
63 ${PLAT_DRAM_SOURCES} \
64 ${XLAT_TABLES_LIB_SRCS} \
65 drivers/mmc/mmc.c \
66 drivers/io/io_block.c \
67 drivers/io/io_fip.c \
68 drivers/io/io_memmap.c \
69 drivers/io/io_storage.c \
70 drivers/imx/usdhc/imx_usdhc.c \
71 plat/imx/imx8m/imx8mp/imx8mp_bl2_mem_params_desc.c \
72 plat/imx/common/imx_io_storage.c \
73 plat/imx/imx8m/imx8m_image_load.c \
74 lib/optee/optee_utils.c
75endif
76
77# Add the build options to pack BLx images and kernel device tree
78# in the FIP if the platform requires.
79ifneq ($(BL2),)
80RESET_TO_BL31 := 0
81$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
82endif
83ifneq ($(BL32_EXTRA1),)
84$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
85endif
86ifneq ($(BL32_EXTRA2),)
87$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
88endif
89ifneq ($(HW_CONFIG),)
90$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
91endif
92
93ifeq (${NEED_BL2},yes)
94$(eval $(call add_define,NEED_BL2))
95LOAD_IMAGE_V2 := 1
96# Non-TF Boot ROM
97BL2_AT_EL3 := 1
98endif
99
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800100ifneq (${TRUSTED_BOARD_BOOT},0)
101
102include drivers/auth/mbedtls/mbedtls_crypto.mk
103include drivers/auth/mbedtls/mbedtls_x509.mk
104
105AUTH_SOURCES := drivers/auth/auth_mod.c \
106 drivers/auth/crypto_mod.c \
107 drivers/auth/img_parser_mod.c \
108 drivers/auth/tbbr/tbbr_cot_common.c \
109 drivers/auth/tbbr/tbbr_cot_bl2.c
110
111BL2_SOURCES += ${AUTH_SOURCES} \
112 plat/common/tbbr/plat_tbbr.c \
113 plat/imx/imx8m/imx8mp/imx8mp_trusted_boot.c \
114 plat/imx/imx8m/imx8mp/imx8mp_rotpk.S
115
116ROT_KEY = $(BUILD_PLAT)/rot_key.pem
117ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
118
119$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
120$(eval $(call MAKE_LIB_DIRS))
121
122$(BUILD_PLAT)/bl2/imx8mp_rotpk.o: $(ROTPK_HASH)
123
124certificates: $(ROT_KEY)
125
126$(ROT_KEY): | $(BUILD_PLAT)
127 @echo " OPENSSL $@"
128 @if [ ! -f $(ROT_KEY) ]; then \
129 openssl genrsa 2048 > $@ 2>/dev/null; \
130 fi
131
132$(ROTPK_HASH): $(ROT_KEY)
133 @echo " OPENSSL $@"
134 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
135 openssl dgst -sha256 -binary > $@ 2>/dev/null
136endif
137
Jacky Bai07ed02c2020-06-03 14:28:45 +0800138USE_COHERENT_MEM := 1
139RESET_TO_BL31 := 1
140A53_DISABLE_NON_TEMPORAL_HINT := 0
141
142ERRATA_A53_835769 := 1
143ERRATA_A53_843419 := 1
144ERRATA_A53_855873 := 1
145
146BL32_BASE ?= 0x56000000
147$(eval $(call add_define,BL32_BASE))
148
149BL32_SIZE ?= 0x2000000
150$(eval $(call add_define,BL32_SIZE))
151
152IMX_BOOT_UART_BASE ?= 0x30890000
153$(eval $(call add_define,IMX_BOOT_UART_BASE))
Peng Fan5cbabbc2021-03-25 18:46:58 +0800154
Jacky Bai210ec7d2022-03-28 16:11:23 +0800155EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
156ifeq (${SDEI_SUPPORT}, 1)
157BL31_SOURCES += plat/imx/common/imx_ehf.c \
158 plat/imx/common/imx_sdei.c
159endif
Ji Luoe329b3d2020-02-20 23:47:21 +0800160
161ifeq (${SPD},trusty)
162 BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
163endif