blob: 631dd2944838957e035711c02fddbd22bca5bb9c [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 Baid746daa12019-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
Sascha Hauer7a5687c2024-01-18 11:18:42 +010029BL31_SOURCES += common/desc_image_load.c \
30 plat/imx/common/imx8_helpers.S \
Jacky Bai07ed02c2020-06-03 14:28:45 +080031 plat/imx/imx8m/gpc_common.c \
Andrey Zhizhikin10a4d862022-09-26 22:25:33 +020032 plat/imx/imx8m/imx_hab.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080033 plat/imx/imx8m/imx_aipstz.c \
34 plat/imx/imx8m/imx_rdc.c \
35 plat/imx/imx8m/imx8m_caam.c \
Marco Felsch76401342023-07-24 15:05:58 +020036 plat/imx/imx8m/imx8m_ccm.c \
Jacky Bai3c3c2682020-01-07 14:53:54 +080037 plat/imx/imx8m/imx8m_csu.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080038 plat/imx/imx8m/imx8m_psci_common.c \
Marco Felsch2d6c08f2023-09-05 17:15:35 +020039 plat/imx/imx8m/imx8m_snvs.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080040 plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c \
41 plat/imx/imx8m/imx8mp/imx8mp_psci.c \
42 plat/imx/imx8m/imx8mp/gpc.c \
43 plat/imx/common/imx8_topology.c \
44 plat/imx/common/imx_sip_handler.c \
45 plat/imx/common/imx_sip_svc.c \
Sascha Hauereb3d2ee2024-01-18 08:47:06 +010046 plat/imx/common/imx_common.c \
Jacky Bai07ed02c2020-06-03 14:28:45 +080047 plat/imx/common/imx_uart_console.S \
48 lib/cpus/aarch64/cortex_a53.S \
49 drivers/arm/tzc/tzc380.c \
50 drivers/delay_timer/delay_timer.c \
51 drivers/delay_timer/generic_delay_timer.c \
Jacky Bai9a6f62f2019-11-25 14:43:26 +080052 ${IMX_DRAM_SOURCES} \
Jacky Bai07ed02c2020-06-03 14:28:45 +080053 ${IMX_GIC_SOURCES} \
54 ${XLAT_TABLES_LIB_SRCS}
55
Ying-Chun Liu (PaulLiu)a61a5c22021-04-07 06:52:57 +080056ifeq (${NEED_BL2},yes)
57BL2_SOURCES += common/desc_image_load.c \
58 plat/imx/common/imx8_helpers.S \
59 plat/imx/common/imx_uart_console.S \
60 plat/imx/imx8m/imx8mp/imx8mp_bl2_el3_setup.c \
61 plat/imx/imx8m/imx8mp/gpc.c \
62 plat/imx/imx8m/imx_aipstz.c \
63 plat/imx/imx8m/imx_rdc.c \
64 plat/imx/imx8m/imx8m_caam.c \
65 plat/common/plat_psci_common.c \
66 lib/cpus/aarch64/cortex_a53.S \
67 drivers/arm/tzc/tzc380.c \
68 drivers/delay_timer/delay_timer.c \
69 drivers/delay_timer/generic_delay_timer.c \
70 ${PLAT_GIC_SOURCES} \
71 ${PLAT_DRAM_SOURCES} \
72 ${XLAT_TABLES_LIB_SRCS} \
73 drivers/mmc/mmc.c \
74 drivers/io/io_block.c \
75 drivers/io/io_fip.c \
76 drivers/io/io_memmap.c \
77 drivers/io/io_storage.c \
78 drivers/imx/usdhc/imx_usdhc.c \
79 plat/imx/imx8m/imx8mp/imx8mp_bl2_mem_params_desc.c \
80 plat/imx/common/imx_io_storage.c \
81 plat/imx/imx8m/imx8m_image_load.c \
82 lib/optee/optee_utils.c
83endif
84
85# Add the build options to pack BLx images and kernel device tree
86# in the FIP if the platform requires.
87ifneq ($(BL2),)
88RESET_TO_BL31 := 0
89$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
90endif
91ifneq ($(BL32_EXTRA1),)
92$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
93endif
94ifneq ($(BL32_EXTRA2),)
95$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
96endif
97ifneq ($(HW_CONFIG),)
98$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
99endif
100
101ifeq (${NEED_BL2},yes)
102$(eval $(call add_define,NEED_BL2))
103LOAD_IMAGE_V2 := 1
104# Non-TF Boot ROM
Arvind Ram Prakash11b9b492022-11-22 14:41:00 -0600105RESET_TO_BL2 := 1
Ying-Chun Liu (PaulLiu)a61a5c22021-04-07 06:52:57 +0800106endif
107
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800108ifneq (${TRUSTED_BOARD_BOOT},0)
109
110include drivers/auth/mbedtls/mbedtls_crypto.mk
111include drivers/auth/mbedtls/mbedtls_x509.mk
112
113AUTH_SOURCES := drivers/auth/auth_mod.c \
114 drivers/auth/crypto_mod.c \
115 drivers/auth/img_parser_mod.c \
116 drivers/auth/tbbr/tbbr_cot_common.c \
117 drivers/auth/tbbr/tbbr_cot_bl2.c
118
119BL2_SOURCES += ${AUTH_SOURCES} \
120 plat/common/tbbr/plat_tbbr.c \
121 plat/imx/imx8m/imx8mp/imx8mp_trusted_boot.c \
122 plat/imx/imx8m/imx8mp/imx8mp_rotpk.S
123
124ROT_KEY = $(BUILD_PLAT)/rot_key.pem
125ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
126
127$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
128$(eval $(call MAKE_LIB_DIRS))
129
130$(BUILD_PLAT)/bl2/imx8mp_rotpk.o: $(ROTPK_HASH)
131
132certificates: $(ROT_KEY)
133
134$(ROT_KEY): | $(BUILD_PLAT)
135 @echo " OPENSSL $@"
136 @if [ ! -f $(ROT_KEY) ]; then \
Salome Thirot0b35da32022-07-14 16:14:15 +0100137 ${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null; \
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800138 fi
139
140$(ROTPK_HASH): $(ROT_KEY)
141 @echo " OPENSSL $@"
Salome Thirot0b35da32022-07-14 16:14:15 +0100142 $(Q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
143 ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null
Ying-Chun Liu (PaulLiu)f70e2892021-04-07 07:18:52 +0800144endif
145
Marco Felsch350d6d52022-07-01 15:55:30 +0200146ENABLE_PIE := 1
Jacky Bai07ed02c2020-06-03 14:28:45 +0800147USE_COHERENT_MEM := 1
148RESET_TO_BL31 := 1
149A53_DISABLE_NON_TEMPORAL_HINT := 0
150
151ERRATA_A53_835769 := 1
152ERRATA_A53_843419 := 1
153ERRATA_A53_855873 := 1
154
Marco Felsch44853af2024-01-09 14:59:20 +0100155ifneq (${PRELOADED_BL33_BASE},)
156$(eval $(call add_define_val,PLAT_NS_IMAGE_OFFSET,${PRELOADED_BL33_BASE}))
157endif
158
Jacky Bai07ed02c2020-06-03 14:28:45 +0800159BL32_BASE ?= 0x56000000
160$(eval $(call add_define,BL32_BASE))
161
162BL32_SIZE ?= 0x2000000
163$(eval $(call add_define,BL32_SIZE))
164
165IMX_BOOT_UART_BASE ?= 0x30890000
Marco Felsch409eb8b2023-08-02 08:11:35 +0200166ifeq (${IMX_BOOT_UART_BASE},auto)
167 override IMX_BOOT_UART_BASE := 0
168endif
Jacky Bai07ed02c2020-06-03 14:28:45 +0800169$(eval $(call add_define,IMX_BOOT_UART_BASE))
Peng Fan5cbabbc2021-03-25 18:46:58 +0800170
Jacky Bai210ec7d2022-03-28 16:11:23 +0800171EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
172ifeq (${SDEI_SUPPORT}, 1)
173BL31_SOURCES += plat/imx/common/imx_ehf.c \
174 plat/imx/common/imx_sdei.c
175endif
Ji Luoe329b3d2020-02-20 23:47:21 +0800176
177ifeq (${SPD},trusty)
178 BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
179endif