blob: 21836d9092de8e49cc31388bf99208a860f60828 [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 \
Jacky Baid746daa2019-11-25 13:19:37 +080019 plat/imx/imx8m/ddr/clock.c \
20 plat/imx/imx8m/ddr/dram_retention.c \
21 plat/imx/imx8m/ddr/ddr4_dvfs.c \
22 plat/imx/imx8m/ddr/lpddr4_dvfs.c
Jacky Bai9a6f62f2019-11-25 14:43:26 +080023
Jacky Bai07ed02c2020-06-03 14:28:45 +080024IMX_GIC_SOURCES := ${GICV3_SOURCES} \
25 plat/common/plat_gicv3.c \
26 plat/common/plat_psci_common.c \
27 plat/imx/common/plat_imx8_gic.c
28
29BL31_SOURCES += plat/imx/common/imx8_helpers.S \
30 plat/imx/imx8m/gpc_common.c \
Andrey Zhizhikin10a4d862022-09-26 22:25:33 +020031 plat/imx/imx8m/imx_hab.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080032 plat/imx/imx8m/imx_aipstz.c \
33 plat/imx/imx8m/imx_rdc.c \
34 plat/imx/imx8m/imx8m_caam.c \
Marco Felsch76401342023-07-24 15:05:58 +020035 plat/imx/imx8m/imx8m_ccm.c \
Jacky Bai3c3c2682020-01-07 14:53:54 +080036 plat/imx/imx8m/imx8m_csu.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080037 plat/imx/imx8m/imx8m_psci_common.c \
38 plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c \
39 plat/imx/imx8m/imx8mp/imx8mp_psci.c \
40 plat/imx/imx8m/imx8mp/gpc.c \
41 plat/imx/common/imx8_topology.c \
42 plat/imx/common/imx_sip_handler.c \
43 plat/imx/common/imx_sip_svc.c \
44 plat/imx/common/imx_uart_console.S \
45 lib/cpus/aarch64/cortex_a53.S \
46 drivers/arm/tzc/tzc380.c \
47 drivers/delay_timer/delay_timer.c \
48 drivers/delay_timer/generic_delay_timer.c \
Jacky Bai9a6f62f2019-11-25 14:43:26 +080049 ${IMX_DRAM_SOURCES} \
Jacky Bai07ed02c2020-06-03 14:28:45 +080050 ${IMX_GIC_SOURCES} \
51 ${XLAT_TABLES_LIB_SRCS}
52
Ying-Chun Liu (PaulLiu)a61a5c22021-04-07 06:52:57 +080053ifeq (${NEED_BL2},yes)
54BL2_SOURCES += common/desc_image_load.c \
55 plat/imx/common/imx8_helpers.S \
56 plat/imx/common/imx_uart_console.S \
57 plat/imx/imx8m/imx8mp/imx8mp_bl2_el3_setup.c \
58 plat/imx/imx8m/imx8mp/gpc.c \
59 plat/imx/imx8m/imx_aipstz.c \
60 plat/imx/imx8m/imx_rdc.c \
61 plat/imx/imx8m/imx8m_caam.c \
62 plat/common/plat_psci_common.c \
63 lib/cpus/aarch64/cortex_a53.S \
64 drivers/arm/tzc/tzc380.c \
65 drivers/delay_timer/delay_timer.c \
66 drivers/delay_timer/generic_delay_timer.c \
67 ${PLAT_GIC_SOURCES} \
68 ${PLAT_DRAM_SOURCES} \
69 ${XLAT_TABLES_LIB_SRCS} \
70 drivers/mmc/mmc.c \
71 drivers/io/io_block.c \
72 drivers/io/io_fip.c \
73 drivers/io/io_memmap.c \
74 drivers/io/io_storage.c \
75 drivers/imx/usdhc/imx_usdhc.c \
76 plat/imx/imx8m/imx8mp/imx8mp_bl2_mem_params_desc.c \
77 plat/imx/common/imx_io_storage.c \
78 plat/imx/imx8m/imx8m_image_load.c \
79 lib/optee/optee_utils.c
80endif
81
82# Add the build options to pack BLx images and kernel device tree
83# in the FIP if the platform requires.
84ifneq ($(BL2),)
85RESET_TO_BL31 := 0
86$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
87endif
88ifneq ($(BL32_EXTRA1),)
89$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
90endif
91ifneq ($(BL32_EXTRA2),)
92$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
93endif
94ifneq ($(HW_CONFIG),)
95$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
96endif
97
98ifeq (${NEED_BL2},yes)
99$(eval $(call add_define,NEED_BL2))
100LOAD_IMAGE_V2 := 1
101# Non-TF Boot ROM
Arvind Ram Prakash11b9b492022-11-22 14:41:00 -0600102RESET_TO_BL2 := 1
Ying-Chun Liu (PaulLiu)a61a5c22021-04-07 06:52:57 +0800103endif
104
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800105ifneq (${TRUSTED_BOARD_BOOT},0)
106
107include drivers/auth/mbedtls/mbedtls_crypto.mk
108include drivers/auth/mbedtls/mbedtls_x509.mk
109
110AUTH_SOURCES := drivers/auth/auth_mod.c \
111 drivers/auth/crypto_mod.c \
112 drivers/auth/img_parser_mod.c \
113 drivers/auth/tbbr/tbbr_cot_common.c \
114 drivers/auth/tbbr/tbbr_cot_bl2.c
115
116BL2_SOURCES += ${AUTH_SOURCES} \
117 plat/common/tbbr/plat_tbbr.c \
118 plat/imx/imx8m/imx8mp/imx8mp_trusted_boot.c \
119 plat/imx/imx8m/imx8mp/imx8mp_rotpk.S
120
121ROT_KEY = $(BUILD_PLAT)/rot_key.pem
122ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
123
124$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
125$(eval $(call MAKE_LIB_DIRS))
126
127$(BUILD_PLAT)/bl2/imx8mp_rotpk.o: $(ROTPK_HASH)
128
129certificates: $(ROT_KEY)
130
131$(ROT_KEY): | $(BUILD_PLAT)
132 @echo " OPENSSL $@"
133 @if [ ! -f $(ROT_KEY) ]; then \
Salome Thirot0b35da32022-07-14 16:14:15 +0100134 ${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null; \
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800135 fi
136
137$(ROTPK_HASH): $(ROT_KEY)
138 @echo " OPENSSL $@"
Salome Thirot0b35da32022-07-14 16:14:15 +0100139 $(Q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
140 ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800141endif
142
Marco Felsch350d6d52022-07-01 15:55:30 +0200143ENABLE_PIE := 1
Jacky Bai07ed02c2020-06-03 14:28:45 +0800144USE_COHERENT_MEM := 1
145RESET_TO_BL31 := 1
146A53_DISABLE_NON_TEMPORAL_HINT := 0
147
148ERRATA_A53_835769 := 1
149ERRATA_A53_843419 := 1
150ERRATA_A53_855873 := 1
151
152BL32_BASE ?= 0x56000000
153$(eval $(call add_define,BL32_BASE))
154
155BL32_SIZE ?= 0x2000000
156$(eval $(call add_define,BL32_SIZE))
157
158IMX_BOOT_UART_BASE ?= 0x30890000
159$(eval $(call add_define,IMX_BOOT_UART_BASE))
Peng Fan5cbabbc2021-03-25 18:46:58 +0800160
Jacky Bai210ec7d2022-03-28 16:11:23 +0800161EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
162ifeq (${SDEI_SUPPORT}, 1)
163BL31_SOURCES += plat/imx/common/imx_ehf.c \
164 plat/imx/common/imx_sdei.c
165endif
Ji Luoe329b3d2020-02-20 23:47:21 +0800166
167ifeq (${SPD},trusty)
168 BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
169endif