Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 1 | # |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 2 | # Copyright (c) 2017-2023, ARM Limited and Contributors. All rights reserved. |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 7 | override RESET_TO_BL2 := 1 |
Masahiro Yamada | c9422fb | 2018-01-22 18:35:16 +0900 | [diff] [blame] | 8 | override COLD_BOOT_SINGLE_CPU := 1 |
Masahiro Yamada | c9422fb | 2018-01-22 18:35:16 +0900 | [diff] [blame] | 9 | override PROGRAMMABLE_RESET_ADDRESS := 1 |
| 10 | override USE_COHERENT_MEM := 1 |
Masahiro Yamada | c9422fb | 2018-01-22 18:35:16 +0900 | [diff] [blame] | 11 | override ENABLE_SVE_FOR_NS := 0 |
Masahiro Yamada | 542ed41 | 2020-01-17 13:46:48 +0900 | [diff] [blame] | 12 | |
| 13 | # Disabling ENABLE_PIE saves memory footprint a lot, but you need to adjust |
| 14 | # UNIPHIER_MEM_BASE so that all TF images are loaded at their link addresses. |
Masahiro Yamada | 2943c77 | 2020-01-17 13:45:32 +0900 | [diff] [blame] | 15 | override ENABLE_PIE := 1 |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 16 | |
Masahiro Yamada | 9c3da38 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 17 | ALLOW_RO_XLAT_TABLES := 1 |
| 18 | |
| 19 | ifeq ($(ALLOW_RO_XLAT_TABLES),1) |
Masahiro Yamada | 1adc5f5 | 2020-04-01 14:28:24 +0900 | [diff] [blame] | 20 | BL31_CPPFLAGS += -DPLAT_RO_XLAT_TABLES |
| 21 | BL32_CPPFLAGS += -DPLAT_RO_XLAT_TABLES |
Masahiro Yamada | 9c3da38 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 22 | endif |
| 23 | |
Masahiro Yamada | 5267470 | 2020-04-02 14:03:53 +0900 | [diff] [blame] | 24 | # The dynamic xlat table is only used in BL2 |
| 25 | BL2_CPPFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC |
| 26 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 27 | # Cortex-A53 revision r0p4-51rel0 |
| 28 | # needed for LD20, unneeded for LD11, PXs3 (no ACE) |
| 29 | ERRATA_A53_855873 := 1 |
| 30 | |
| 31 | FIP_ALIGN := 512 |
| 32 | |
| 33 | ifeq ($(NEED_BL32),yes) |
| 34 | $(eval $(call add_define,UNIPHIER_LOAD_BL32)) |
| 35 | endif |
| 36 | |
Douglas Raillard | 7dd775a | 2017-09-25 17:48:20 +0100 | [diff] [blame] | 37 | # Libraries |
| 38 | include lib/xlat_tables_v2/xlat_tables.mk |
| 39 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 40 | PLAT_PATH := plat/socionext/uniphier |
| 41 | PLAT_INCLUDES := -I$(PLAT_PATH)/include |
| 42 | |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 43 | # common sources for BL2, BL31 (and BL32 if SPD=tspd) |
Masahiro Yamada | ca8b80e | 2019-07-02 22:03:16 +0900 | [diff] [blame] | 44 | PLAT_BL_COMMON_SOURCES += plat/common/aarch64/crash_console_helpers.S \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 45 | $(PLAT_PATH)/uniphier_console.S \ |
Masahiro Yamada | ca8b80e | 2019-07-02 22:03:16 +0900 | [diff] [blame] | 46 | $(PLAT_PATH)/uniphier_console_setup.c \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 47 | $(PLAT_PATH)/uniphier_helpers.S \ |
| 48 | $(PLAT_PATH)/uniphier_soc_info.c \ |
Douglas Raillard | 7dd775a | 2017-09-25 17:48:20 +0100 | [diff] [blame] | 49 | $(PLAT_PATH)/uniphier_xlat_setup.c \ |
| 50 | ${XLAT_TABLES_LIB_SRCS} |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 51 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 52 | BL2_SOURCES += common/desc_image_load.c \ |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 53 | drivers/io/io_block.c \ |
| 54 | drivers/io/io_fip.c \ |
| 55 | drivers/io/io_memmap.c \ |
| 56 | drivers/io/io_storage.c \ |
| 57 | lib/cpus/aarch64/cortex_a53.S \ |
| 58 | lib/cpus/aarch64/cortex_a72.S \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 59 | $(PLAT_PATH)/uniphier_bl2_setup.c \ |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 60 | $(PLAT_PATH)/uniphier_boot_device.c \ |
| 61 | $(PLAT_PATH)/uniphier_emmc.c \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 62 | $(PLAT_PATH)/uniphier_image_desc.c \ |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 63 | $(PLAT_PATH)/uniphier_io_storage.c \ |
| 64 | $(PLAT_PATH)/uniphier_nand.c \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 65 | $(PLAT_PATH)/uniphier_scp.c \ |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 66 | $(PLAT_PATH)/uniphier_usb.c |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 67 | |
Alexei Fedorov | 84f1b5d | 2020-03-23 18:45:17 +0000 | [diff] [blame] | 68 | # Include GICv3 driver files |
| 69 | include drivers/arm/gic/v3/gicv3.mk |
| 70 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 71 | BL31_SOURCES += drivers/arm/cci/cci.c \ |
Alexei Fedorov | 84f1b5d | 2020-03-23 18:45:17 +0000 | [diff] [blame] | 72 | ${GICV3_SOURCES} \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 73 | lib/cpus/aarch64/cortex_a53.S \ |
| 74 | lib/cpus/aarch64/cortex_a72.S \ |
| 75 | plat/common/plat_gicv3.c \ |
| 76 | plat/common/plat_psci_common.c \ |
| 77 | $(PLAT_PATH)/uniphier_bl31_setup.c \ |
Masahiro Yamada | f36272d | 2019-07-08 13:46:44 +0900 | [diff] [blame] | 78 | $(PLAT_PATH)/uniphier_boot_device.c \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 79 | $(PLAT_PATH)/uniphier_cci.c \ |
| 80 | $(PLAT_PATH)/uniphier_gicv3.c \ |
| 81 | $(PLAT_PATH)/uniphier_psci.c \ |
| 82 | $(PLAT_PATH)/uniphier_scp.c \ |
| 83 | $(PLAT_PATH)/uniphier_smp.S \ |
| 84 | $(PLAT_PATH)/uniphier_syscnt.c \ |
| 85 | $(PLAT_PATH)/uniphier_topology.c |
| 86 | |
| 87 | ifeq (${TRUSTED_BOARD_BOOT},1) |
| 88 | |
| 89 | include drivers/auth/mbedtls/mbedtls_crypto.mk |
| 90 | include drivers/auth/mbedtls/mbedtls_x509.mk |
| 91 | |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 92 | BL2_SOURCES += drivers/auth/auth_mod.c \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 93 | drivers/auth/crypto_mod.c \ |
| 94 | drivers/auth/img_parser_mod.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 95 | drivers/auth/tbbr/tbbr_cot_common.c \ |
| 96 | drivers/auth/tbbr/tbbr_cot_bl2.c \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 97 | plat/common/tbbr/plat_tbbr.c \ |
Masahiro Yamada | 9679c9c | 2017-06-14 20:38:12 +0900 | [diff] [blame] | 98 | $(PLAT_PATH)/uniphier_rotpk.S \ |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 99 | $(PLAT_PATH)/uniphier_tbbr.c |
| 100 | |
Masahiro Yamada | 9679c9c | 2017-06-14 20:38:12 +0900 | [diff] [blame] | 101 | ROT_KEY = $(BUILD_PLAT)/rot_key.pem |
| 102 | ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin |
| 103 | |
| 104 | $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"')) |
Masahiro Yamada | 9679c9c | 2017-06-14 20:38:12 +0900 | [diff] [blame] | 105 | $(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH) |
| 106 | |
| 107 | certificates: $(ROT_KEY) |
Masahiro Yamada | df8fab9 | 2017-11-04 03:14:03 +0900 | [diff] [blame] | 108 | $(ROT_KEY): | $(BUILD_PLAT) |
Masahiro Yamada | 9679c9c | 2017-06-14 20:38:12 +0900 | [diff] [blame] | 109 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 110 | $(Q)${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null |
Masahiro Yamada | 9679c9c | 2017-06-14 20:38:12 +0900 | [diff] [blame] | 111 | |
| 112 | $(ROTPK_HASH): $(ROT_KEY) |
| 113 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 114 | $(Q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\ |
| 115 | ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null |
Masahiro Yamada | 9679c9c | 2017-06-14 20:38:12 +0900 | [diff] [blame] | 116 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 117 | endif |
| 118 | |
Masahiro Yamada | 4ff71af | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 119 | ifeq (${FIP_GZIP},1) |
| 120 | |
| 121 | include lib/zlib/zlib.mk |
| 122 | |
| 123 | BL2_SOURCES += common/image_decompress.c \ |
| 124 | $(ZLIB_SOURCES) |
| 125 | |
| 126 | $(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP)) |
| 127 | |
| 128 | # compress all images loaded by BL2 |
| 129 | SCP_BL2_PRE_TOOL_FILTER := GZIP |
| 130 | BL31_PRE_TOOL_FILTER := GZIP |
| 131 | BL32_PRE_TOOL_FILTER := GZIP |
| 132 | BL33_PRE_TOOL_FILTER := GZIP |
| 133 | |
| 134 | endif |
| 135 | |
Masahiro Yamada | 75bfecb | 2017-12-19 11:56:05 +0900 | [diff] [blame] | 136 | .PHONY: bl2_gzip |
| 137 | bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz |
| 138 | %.gz: % |
Masahiro Yamada | e56b5cd | 2017-12-20 01:37:15 +0900 | [diff] [blame] | 139 | @echo " GZIP $@" |
Masahiro Yamada | b13af2e | 2018-01-04 12:59:11 +0900 | [diff] [blame] | 140 | $(Q)gzip -n -f -9 $< --stdout > $@ |