Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 1 | # |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 2 | # Copyright (c) 2019-2023, ARM Limited and Contributors. All rights reserved. |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
Ji Luo | e329b3d | 2020-02-20 23:47:21 +0800 | [diff] [blame] | 6 | # |
| 7 | # Translation tables library |
| 8 | include lib/xlat_tables_v2/xlat_tables.mk |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 9 | |
| 10 | PLAT_INCLUDES := -Iplat/imx/common/include \ |
| 11 | -Iplat/imx/imx8m/include \ |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 12 | -Iplat/imx/imx8m/imx8mm/include \ |
| 13 | -Idrivers/imx/usdhc \ |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 14 | -Iinclude/common/tbbr \ |
| 15 | -Iinclude/lib/libfdt |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 16 | |
Alexei Fedorov | 84f1b5d | 2020-03-23 18:45:17 +0000 | [diff] [blame] | 17 | # Include GICv3 driver files |
| 18 | include drivers/arm/gic/v3/gicv3.mk |
| 19 | |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 20 | include lib/libfdt/libfdt.mk |
| 21 | |
Jacky Bai | ec03180 | 2019-11-25 14:45:32 +0800 | [diff] [blame] | 22 | IMX_DRAM_SOURCES := plat/imx/imx8m/ddr/dram.c \ |
Jacky Bai | d746daa | 2019-11-25 13:19:37 +0800 | [diff] [blame] | 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 |
Jacky Bai | ec03180 | 2019-11-25 14:45:32 +0800 | [diff] [blame] | 27 | |
Alexei Fedorov | 84f1b5d | 2020-03-23 18:45:17 +0000 | [diff] [blame] | 28 | IMX_GIC_SOURCES := ${GICV3_SOURCES} \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 29 | plat/common/plat_gicv3.c \ |
| 30 | plat/common/plat_psci_common.c \ |
| 31 | plat/imx/common/plat_imx8_gic.c |
| 32 | |
| 33 | BL31_SOURCES += plat/imx/common/imx8_helpers.S \ |
| 34 | plat/imx/imx8m/gpc_common.c \ |
Andrey Zhizhikin | 10a4d86 | 2022-09-26 22:25:33 +0200 | [diff] [blame] | 35 | plat/imx/imx8m/imx_hab.c \ |
Jacky Bai | 91c6d32 | 2019-05-21 20:24:52 +0800 | [diff] [blame] | 36 | plat/imx/imx8m/imx_aipstz.c \ |
Jacky Bai | 64130a3 | 2019-07-18 13:43:17 +0800 | [diff] [blame] | 37 | plat/imx/imx8m/imx_rdc.c \ |
Jacky Bai | 3c3c268 | 2020-01-07 14:53:54 +0800 | [diff] [blame] | 38 | plat/imx/imx8m/imx8m_csu.c \ |
Jacky Bai | 3bf04a5 | 2019-06-12 17:41:47 +0800 | [diff] [blame] | 39 | plat/imx/imx8m/imx8m_caam.c \ |
Marco Felsch | 7640134 | 2023-07-24 15:05:58 +0200 | [diff] [blame] | 40 | plat/imx/imx8m/imx8m_ccm.c \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 41 | plat/imx/imx8m/imx8m_psci_common.c \ |
Marco Felsch | 2d6c08f | 2023-09-05 17:15:35 +0200 | [diff] [blame] | 42 | plat/imx/imx8m/imx8m_snvs.c \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 43 | plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c \ |
| 44 | plat/imx/imx8m/imx8mm/imx8mm_psci.c \ |
| 45 | plat/imx/imx8m/imx8mm/gpc.c \ |
| 46 | plat/imx/common/imx8_topology.c \ |
Leonard Crestez | 402bd52 | 2019-05-08 22:29:21 +0300 | [diff] [blame] | 47 | plat/imx/common/imx_sip_handler.c \ |
| 48 | plat/imx/common/imx_sip_svc.c \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 49 | plat/imx/common/imx_uart_console.S \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 50 | lib/cpus/aarch64/cortex_a53.S \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 51 | drivers/arm/tzc/tzc380.c \ |
| 52 | drivers/delay_timer/delay_timer.c \ |
| 53 | drivers/delay_timer/generic_delay_timer.c \ |
Ji Luo | e329b3d | 2020-02-20 23:47:21 +0800 | [diff] [blame] | 54 | ${XLAT_TABLES_LIB_SRCS} \ |
Jacky Bai | ec03180 | 2019-11-25 14:45:32 +0800 | [diff] [blame] | 55 | ${IMX_DRAM_SOURCES} \ |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 56 | ${IMX_GIC_SOURCES} |
| 57 | |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 58 | ifeq (${NEED_BL2},yes) |
| 59 | BL2_SOURCES += common/desc_image_load.c \ |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 60 | common/fdt_wrappers.c \ |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 61 | plat/imx/common/imx8_helpers.S \ |
| 62 | plat/imx/common/imx_uart_console.S \ |
| 63 | plat/imx/imx8m/imx8mm/imx8mm_bl2_el3_setup.c \ |
| 64 | plat/imx/imx8m/imx8mm/gpc.c \ |
| 65 | plat/imx/imx8m/imx_aipstz.c \ |
| 66 | plat/common/plat_psci_common.c \ |
| 67 | lib/xlat_tables/aarch64/xlat_tables.c \ |
| 68 | lib/xlat_tables/xlat_tables_common.c \ |
| 69 | lib/cpus/aarch64/cortex_a53.S \ |
| 70 | drivers/delay_timer/delay_timer.c \ |
| 71 | drivers/delay_timer/generic_delay_timer.c \ |
| 72 | ${PLAT_GIC_SOURCES} \ |
| 73 | ${PLAT_DRAM_SOURCES} \ |
| 74 | drivers/mmc/mmc.c \ |
| 75 | drivers/io/io_block.c \ |
| 76 | drivers/io/io_fip.c \ |
| 77 | drivers/io/io_memmap.c \ |
| 78 | drivers/io/io_storage.c \ |
| 79 | drivers/imx/usdhc/imx_usdhc.c \ |
| 80 | plat/imx/imx8m/imx8mm/imx8mm_bl2_mem_params_desc.c \ |
Ying-Chun Liu (PaulLiu) | 54cabc4 | 2021-04-07 06:10:32 +0800 | [diff] [blame] | 81 | plat/imx/common/imx_io_storage.c \ |
Ying-Chun Liu (PaulLiu) | e6a7f88 | 2021-04-07 06:12:37 +0800 | [diff] [blame] | 82 | plat/imx/imx8m/imx8m_image_load.c \ |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 83 | lib/optee/optee_utils.c |
| 84 | endif |
| 85 | |
| 86 | # Add the build options to pack BLx images and kernel device tree |
| 87 | # in the FIP if the platform requires. |
| 88 | ifneq ($(BL2),) |
| 89 | RESET_TO_BL31 := 0 |
| 90 | $(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert)) |
| 91 | endif |
| 92 | ifneq ($(BL32_EXTRA1),) |
| 93 | $(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1)) |
| 94 | endif |
| 95 | ifneq ($(BL32_EXTRA2),) |
| 96 | $(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2)) |
| 97 | endif |
| 98 | ifneq ($(HW_CONFIG),) |
| 99 | $(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config)) |
| 100 | endif |
| 101 | |
| 102 | ifeq (${NEED_BL2},yes) |
| 103 | $(eval $(call add_define,NEED_BL2)) |
| 104 | LOAD_IMAGE_V2 := 1 |
| 105 | # Non-TF Boot ROM |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 106 | RESET_TO_BL2 := 1 |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 107 | endif |
| 108 | |
| 109 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 110 | |
| 111 | include drivers/auth/mbedtls/mbedtls_crypto.mk |
| 112 | include drivers/auth/mbedtls/mbedtls_x509.mk |
| 113 | |
| 114 | AUTH_SOURCES := drivers/auth/auth_mod.c \ |
| 115 | drivers/auth/crypto_mod.c \ |
| 116 | drivers/auth/img_parser_mod.c \ |
| 117 | drivers/auth/tbbr/tbbr_cot_common.c \ |
| 118 | drivers/auth/tbbr/tbbr_cot_bl2.c |
| 119 | |
| 120 | BL2_SOURCES += ${AUTH_SOURCES} \ |
| 121 | plat/common/tbbr/plat_tbbr.c \ |
| 122 | plat/imx/imx8m/imx8mm/imx8mm_trusted_boot.c \ |
| 123 | plat/imx/imx8m/imx8mm/imx8mm_rotpk.S |
| 124 | |
| 125 | ROT_KEY = $(BUILD_PLAT)/rot_key.pem |
| 126 | ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin |
| 127 | |
| 128 | $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"')) |
| 129 | $(eval $(call MAKE_LIB_DIRS)) |
| 130 | |
| 131 | $(BUILD_PLAT)/bl2/imx8mm_rotpk.o: $(ROTPK_HASH) |
| 132 | |
| 133 | certificates: $(ROT_KEY) |
| 134 | |
| 135 | $(ROT_KEY): | $(BUILD_PLAT) |
| 136 | @echo " OPENSSL $@" |
| 137 | @if [ ! -f $(ROT_KEY) ]; then \ |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 138 | ${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null; \ |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 139 | fi |
| 140 | |
| 141 | $(ROTPK_HASH): $(ROT_KEY) |
| 142 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 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 |
Ying-Chun Liu (PaulLiu) | 234c271 | 2020-12-22 02:56:00 +0800 | [diff] [blame] | 145 | endif |
| 146 | |
Marco Felsch | ff2b872 | 2022-08-22 12:39:01 +0200 | [diff] [blame] | 147 | ENABLE_PIE := 1 |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 148 | USE_COHERENT_MEM := 1 |
| 149 | RESET_TO_BL31 := 1 |
| 150 | A53_DISABLE_NON_TEMPORAL_HINT := 0 |
Jacky Bai | a617700 | 2019-03-06 17:15:06 +0800 | [diff] [blame] | 151 | |
| 152 | ERRATA_A53_835769 := 1 |
| 153 | ERRATA_A53_843419 := 1 |
| 154 | ERRATA_A53_855873 := 1 |
Jacky Bai | 2a763ba | 2019-07-18 13:34:09 +0800 | [diff] [blame] | 155 | |
| 156 | BL32_BASE ?= 0xbe000000 |
| 157 | $(eval $(call add_define,BL32_BASE)) |
| 158 | |
| 159 | BL32_SIZE ?= 0x2000000 |
| 160 | $(eval $(call add_define,BL32_SIZE)) |
Igor Opaniuk | 9fc5cb6 | 2020-03-05 22:10:41 +0200 | [diff] [blame] | 161 | |
| 162 | IMX_BOOT_UART_BASE ?= 0x30890000 |
Marco Felsch | 409eb8b | 2023-08-02 08:11:35 +0200 | [diff] [blame] | 163 | ifeq (${IMX_BOOT_UART_BASE},auto) |
| 164 | override IMX_BOOT_UART_BASE := 0 |
| 165 | endif |
Igor Opaniuk | 9fc5cb6 | 2020-03-05 22:10:41 +0200 | [diff] [blame] | 166 | $(eval $(call add_define,IMX_BOOT_UART_BASE)) |
Peng Fan | 57e982c | 2020-07-27 21:22:14 +0800 | [diff] [blame] | 167 | |
Jacky Bai | 210ec7d | 2022-03-28 16:11:23 +0800 | [diff] [blame] | 168 | EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT) |
| 169 | ifeq (${SDEI_SUPPORT}, 1) |
| 170 | BL31_SOURCES += plat/imx/common/imx_ehf.c \ |
| 171 | plat/imx/common/imx_sdei.c |
| 172 | endif |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 173 | |
| 174 | ifeq (${MEASURED_BOOT},1) |
| 175 | MEASURED_BOOT_MK := drivers/measured_boot/event_log/event_log.mk |
| 176 | $(info Including ${MEASURED_BOOT_MK}) |
| 177 | include ${MEASURED_BOOT_MK} |
| 178 | |
laurenw-arm | 307592f | 2022-06-16 13:40:48 -0500 | [diff] [blame] | 179 | ifneq (${MBOOT_EL_HASH_ALG}, sha256) |
| 180 | $(eval $(call add_define,TF_MBEDTLS_MBOOT_USE_SHA512)) |
| 181 | endif |
| 182 | |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 183 | BL2_SOURCES += plat/imx/imx8m/imx8m_measured_boot.c \ |
| 184 | plat/imx/imx8m/imx8m_dyn_cfg_helpers.c \ |
| 185 | ${EVENT_LOG_SOURCES} |
Ji Luo | e329b3d | 2020-02-20 23:47:21 +0800 | [diff] [blame] | 186 | endif |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 187 | |
Ji Luo | e329b3d | 2020-02-20 23:47:21 +0800 | [diff] [blame] | 188 | ifeq (${SPD},trusty) |
| 189 | BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1 |
Ying-Chun Liu (PaulLiu) | ac6d862 | 2021-10-06 09:27:00 +0800 | [diff] [blame] | 190 | endif |