blob: a014f528fb10adf0755afa27e2ad5bc1b41eae27 [file] [log] [blame]
Masahiro Yamada574388c2016-09-03 11:37:40 +09001#
Masahiro Yamada2943c772020-01-17 13:45:32 +09002# Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
Masahiro Yamada574388c2016-09-03 11:37:40 +09003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Masahiro Yamada75bfecb2017-12-19 11:56:05 +09007override BL2_AT_EL3 := 1
Masahiro Yamadac9422fb2018-01-22 18:35:16 +09008override COLD_BOOT_SINGLE_CPU := 1
Masahiro Yamadac9422fb2018-01-22 18:35:16 +09009override PROGRAMMABLE_RESET_ADDRESS := 1
10override USE_COHERENT_MEM := 1
Masahiro Yamadac9422fb2018-01-22 18:35:16 +090011override ENABLE_SVE_FOR_NS := 0
Masahiro Yamada542ed412020-01-17 13:46:48 +090012
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 Yamada2943c772020-01-17 13:45:32 +090015override ENABLE_PIE := 1
Masahiro Yamada574388c2016-09-03 11:37:40 +090016
17# Cortex-A53 revision r0p4-51rel0
18# needed for LD20, unneeded for LD11, PXs3 (no ACE)
19ERRATA_A53_855873 := 1
20
21FIP_ALIGN := 512
22
23ifeq ($(NEED_BL32),yes)
24$(eval $(call add_define,UNIPHIER_LOAD_BL32))
25endif
26
Douglas Raillard7dd775a2017-09-25 17:48:20 +010027# Libraries
28include lib/xlat_tables_v2/xlat_tables.mk
29
Masahiro Yamada574388c2016-09-03 11:37:40 +090030PLAT_PATH := plat/socionext/uniphier
31PLAT_INCLUDES := -I$(PLAT_PATH)/include
32
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090033# common sources for BL2, BL31 (and BL32 if SPD=tspd)
Masahiro Yamadaca8b80e2019-07-02 22:03:16 +090034PLAT_BL_COMMON_SOURCES += plat/common/aarch64/crash_console_helpers.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090035 $(PLAT_PATH)/uniphier_console.S \
Masahiro Yamadaca8b80e2019-07-02 22:03:16 +090036 $(PLAT_PATH)/uniphier_console_setup.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090037 $(PLAT_PATH)/uniphier_helpers.S \
38 $(PLAT_PATH)/uniphier_soc_info.c \
Douglas Raillard7dd775a2017-09-25 17:48:20 +010039 $(PLAT_PATH)/uniphier_xlat_setup.c \
40 ${XLAT_TABLES_LIB_SRCS}
Masahiro Yamada574388c2016-09-03 11:37:40 +090041
Masahiro Yamada574388c2016-09-03 11:37:40 +090042BL2_SOURCES += common/desc_image_load.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090043 drivers/io/io_block.c \
44 drivers/io/io_fip.c \
45 drivers/io/io_memmap.c \
46 drivers/io/io_storage.c \
47 lib/cpus/aarch64/cortex_a53.S \
48 lib/cpus/aarch64/cortex_a72.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090049 $(PLAT_PATH)/uniphier_bl2_setup.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090050 $(PLAT_PATH)/uniphier_boot_device.c \
51 $(PLAT_PATH)/uniphier_emmc.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090052 $(PLAT_PATH)/uniphier_image_desc.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090053 $(PLAT_PATH)/uniphier_io_storage.c \
54 $(PLAT_PATH)/uniphier_nand.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090055 $(PLAT_PATH)/uniphier_scp.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090056 $(PLAT_PATH)/uniphier_usb.c
Masahiro Yamada574388c2016-09-03 11:37:40 +090057
58BL31_SOURCES += drivers/arm/cci/cci.c \
59 drivers/arm/gic/common/gic_common.c \
60 drivers/arm/gic/v3/gicv3_helpers.c \
Alexei Fedorov2f13d6c2020-02-21 10:17:26 +000061 drivers/arm/gic/v3/gicdv3_helpers.c \
62 drivers/arm/gic/v3/gicrv3_helpers.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090063 drivers/arm/gic/v3/gicv3_main.c \
64 lib/cpus/aarch64/cortex_a53.S \
65 lib/cpus/aarch64/cortex_a72.S \
66 plat/common/plat_gicv3.c \
67 plat/common/plat_psci_common.c \
68 $(PLAT_PATH)/uniphier_bl31_setup.c \
Masahiro Yamadaf36272d2019-07-08 13:46:44 +090069 $(PLAT_PATH)/uniphier_boot_device.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090070 $(PLAT_PATH)/uniphier_cci.c \
71 $(PLAT_PATH)/uniphier_gicv3.c \
72 $(PLAT_PATH)/uniphier_psci.c \
73 $(PLAT_PATH)/uniphier_scp.c \
74 $(PLAT_PATH)/uniphier_smp.S \
75 $(PLAT_PATH)/uniphier_syscnt.c \
76 $(PLAT_PATH)/uniphier_topology.c
77
78ifeq (${TRUSTED_BOARD_BOOT},1)
79
80include drivers/auth/mbedtls/mbedtls_crypto.mk
81include drivers/auth/mbedtls/mbedtls_x509.mk
82
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090083BL2_SOURCES += drivers/auth/auth_mod.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090084 drivers/auth/crypto_mod.c \
85 drivers/auth/img_parser_mod.c \
86 drivers/auth/tbbr/tbbr_cot.c \
87 plat/common/tbbr/plat_tbbr.c \
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090088 $(PLAT_PATH)/uniphier_rotpk.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090089 $(PLAT_PATH)/uniphier_tbbr.c
90
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090091ROT_KEY = $(BUILD_PLAT)/rot_key.pem
92ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
93
94$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090095$(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH)
96
97certificates: $(ROT_KEY)
Masahiro Yamadadf8fab92017-11-04 03:14:03 +090098$(ROT_KEY): | $(BUILD_PLAT)
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090099 @echo " OPENSSL $@"
100 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
101
102$(ROTPK_HASH): $(ROT_KEY)
103 @echo " OPENSSL $@"
104 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
105 openssl dgst -sha256 -binary > $@ 2>/dev/null
106
Masahiro Yamada574388c2016-09-03 11:37:40 +0900107endif
108
Masahiro Yamada4ff71af2018-01-26 11:42:01 +0900109ifeq (${FIP_GZIP},1)
110
111include lib/zlib/zlib.mk
112
113BL2_SOURCES += common/image_decompress.c \
114 $(ZLIB_SOURCES)
115
116$(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP))
117
118# compress all images loaded by BL2
119SCP_BL2_PRE_TOOL_FILTER := GZIP
120BL31_PRE_TOOL_FILTER := GZIP
121BL32_PRE_TOOL_FILTER := GZIP
122BL33_PRE_TOOL_FILTER := GZIP
123
124endif
125
Masahiro Yamada75bfecb2017-12-19 11:56:05 +0900126.PHONY: bl2_gzip
127bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz
128%.gz: %
Masahiro Yamadae56b5cd2017-12-20 01:37:15 +0900129 @echo " GZIP $@"
Masahiro Yamadab13af2e2018-01-04 12:59:11 +0900130 $(Q)gzip -n -f -9 $< --stdout > $@