blob: e7a1bfe5c936e90d9151fdc1a717fa65c949533e [file] [log] [blame]
Masahiro Yamada574388c2016-09-03 11:37:40 +09001#
Masahiro Yamadac9422fb2018-01-22 18:35:16 +09002# Copyright (c) 2017-2018, 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 Yamada574388c2016-09-03 11:37:40 +090012
13# Cortex-A53 revision r0p4-51rel0
14# needed for LD20, unneeded for LD11, PXs3 (no ACE)
15ERRATA_A53_855873 := 1
16
17FIP_ALIGN := 512
18
19ifeq ($(NEED_BL32),yes)
20$(eval $(call add_define,UNIPHIER_LOAD_BL32))
21endif
22
Douglas Raillard7dd775a2017-09-25 17:48:20 +010023# Libraries
24include lib/xlat_tables_v2/xlat_tables.mk
25
Masahiro Yamada574388c2016-09-03 11:37:40 +090026PLAT_PATH := plat/socionext/uniphier
27PLAT_INCLUDES := -I$(PLAT_PATH)/include
28
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090029# common sources for BL2, BL31 (and BL32 if SPD=tspd)
Masahiro Yamada574388c2016-09-03 11:37:40 +090030PLAT_BL_COMMON_SOURCES += drivers/console/aarch64/console.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090031 $(PLAT_PATH)/uniphier_console.S \
32 $(PLAT_PATH)/uniphier_helpers.S \
33 $(PLAT_PATH)/uniphier_soc_info.c \
Douglas Raillard7dd775a2017-09-25 17:48:20 +010034 $(PLAT_PATH)/uniphier_xlat_setup.c \
35 ${XLAT_TABLES_LIB_SRCS}
Masahiro Yamada574388c2016-09-03 11:37:40 +090036
Masahiro Yamada574388c2016-09-03 11:37:40 +090037BL2_SOURCES += common/desc_image_load.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090038 drivers/io/io_block.c \
39 drivers/io/io_fip.c \
40 drivers/io/io_memmap.c \
41 drivers/io/io_storage.c \
42 lib/cpus/aarch64/cortex_a53.S \
43 lib/cpus/aarch64/cortex_a72.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090044 $(PLAT_PATH)/uniphier_bl2_setup.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090045 $(PLAT_PATH)/uniphier_boot_device.c \
46 $(PLAT_PATH)/uniphier_emmc.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090047 $(PLAT_PATH)/uniphier_image_desc.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090048 $(PLAT_PATH)/uniphier_io_storage.c \
49 $(PLAT_PATH)/uniphier_nand.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090050 $(PLAT_PATH)/uniphier_scp.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090051 $(PLAT_PATH)/uniphier_usb.c
Masahiro Yamada574388c2016-09-03 11:37:40 +090052
53BL31_SOURCES += drivers/arm/cci/cci.c \
54 drivers/arm/gic/common/gic_common.c \
55 drivers/arm/gic/v3/gicv3_helpers.c \
56 drivers/arm/gic/v3/gicv3_main.c \
57 lib/cpus/aarch64/cortex_a53.S \
58 lib/cpus/aarch64/cortex_a72.S \
59 plat/common/plat_gicv3.c \
60 plat/common/plat_psci_common.c \
61 $(PLAT_PATH)/uniphier_bl31_setup.c \
62 $(PLAT_PATH)/uniphier_cci.c \
63 $(PLAT_PATH)/uniphier_gicv3.c \
64 $(PLAT_PATH)/uniphier_psci.c \
65 $(PLAT_PATH)/uniphier_scp.c \
66 $(PLAT_PATH)/uniphier_smp.S \
67 $(PLAT_PATH)/uniphier_syscnt.c \
68 $(PLAT_PATH)/uniphier_topology.c
69
70ifeq (${TRUSTED_BOARD_BOOT},1)
71
72include drivers/auth/mbedtls/mbedtls_crypto.mk
73include drivers/auth/mbedtls/mbedtls_x509.mk
74
75PLAT_INCLUDES += -Iinclude/common/tbbr
76
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090077BL2_SOURCES += drivers/auth/auth_mod.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090078 drivers/auth/crypto_mod.c \
79 drivers/auth/img_parser_mod.c \
80 drivers/auth/tbbr/tbbr_cot.c \
81 plat/common/tbbr/plat_tbbr.c \
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090082 $(PLAT_PATH)/uniphier_rotpk.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090083 $(PLAT_PATH)/uniphier_tbbr.c
84
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090085ROT_KEY = $(BUILD_PLAT)/rot_key.pem
86ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
87
88$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090089$(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH)
90
91certificates: $(ROT_KEY)
Masahiro Yamadadf8fab92017-11-04 03:14:03 +090092$(ROT_KEY): | $(BUILD_PLAT)
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090093 @echo " OPENSSL $@"
94 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
95
96$(ROTPK_HASH): $(ROT_KEY)
97 @echo " OPENSSL $@"
98 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
99 openssl dgst -sha256 -binary > $@ 2>/dev/null
100
Masahiro Yamada574388c2016-09-03 11:37:40 +0900101endif
102
Masahiro Yamada4ff71af2018-01-26 11:42:01 +0900103ifeq (${FIP_GZIP},1)
104
105include lib/zlib/zlib.mk
106
107BL2_SOURCES += common/image_decompress.c \
108 $(ZLIB_SOURCES)
109
110$(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP))
111
112# compress all images loaded by BL2
113SCP_BL2_PRE_TOOL_FILTER := GZIP
114BL31_PRE_TOOL_FILTER := GZIP
115BL32_PRE_TOOL_FILTER := GZIP
116BL33_PRE_TOOL_FILTER := GZIP
117
118endif
119
Masahiro Yamada75bfecb2017-12-19 11:56:05 +0900120.PHONY: bl2_gzip
121bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz
122%.gz: %
Masahiro Yamadae56b5cd2017-12-20 01:37:15 +0900123 @echo " GZIP $@"
Masahiro Yamadab13af2e2018-01-04 12:59:11 +0900124 $(Q)gzip -n -f -9 $< --stdout > $@