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