blob: 6de5164673e4a0254982e6e33d70e1f58b86f572 [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
9override ENABLE_PLAT_COMPAT := 0
10override LOAD_IMAGE_V2 := 1
11override PROGRAMMABLE_RESET_ADDRESS := 1
12override USE_COHERENT_MEM := 1
13override USE_TBBR_DEFS := 1
14override ENABLE_SVE_FOR_NS := 0
Masahiro Yamada574388c2016-09-03 11:37:40 +090015
16# Cortex-A53 revision r0p4-51rel0
17# needed for LD20, unneeded for LD11, PXs3 (no ACE)
18ERRATA_A53_855873 := 1
19
20FIP_ALIGN := 512
21
22ifeq ($(NEED_BL32),yes)
23$(eval $(call add_define,UNIPHIER_LOAD_BL32))
24endif
25
Douglas Raillard7dd775a2017-09-25 17:48:20 +010026# Libraries
27include lib/xlat_tables_v2/xlat_tables.mk
28
Masahiro Yamada574388c2016-09-03 11:37:40 +090029PLAT_PATH := plat/socionext/uniphier
30PLAT_INCLUDES := -I$(PLAT_PATH)/include
31
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090032# common sources for BL2, BL31 (and BL32 if SPD=tspd)
Masahiro Yamada574388c2016-09-03 11:37:40 +090033PLAT_BL_COMMON_SOURCES += drivers/console/aarch64/console.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090034 $(PLAT_PATH)/uniphier_console.S \
35 $(PLAT_PATH)/uniphier_helpers.S \
36 $(PLAT_PATH)/uniphier_soc_info.c \
Douglas Raillard7dd775a2017-09-25 17:48:20 +010037 $(PLAT_PATH)/uniphier_xlat_setup.c \
38 ${XLAT_TABLES_LIB_SRCS}
Masahiro Yamada574388c2016-09-03 11:37:40 +090039
Masahiro Yamada574388c2016-09-03 11:37:40 +090040BL2_SOURCES += common/desc_image_load.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090041 drivers/io/io_block.c \
42 drivers/io/io_fip.c \
43 drivers/io/io_memmap.c \
44 drivers/io/io_storage.c \
45 lib/cpus/aarch64/cortex_a53.S \
46 lib/cpus/aarch64/cortex_a72.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090047 $(PLAT_PATH)/uniphier_bl2_setup.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090048 $(PLAT_PATH)/uniphier_boot_device.c \
49 $(PLAT_PATH)/uniphier_emmc.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090050 $(PLAT_PATH)/uniphier_image_desc.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090051 $(PLAT_PATH)/uniphier_io_storage.c \
52 $(PLAT_PATH)/uniphier_nand.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090053 $(PLAT_PATH)/uniphier_scp.c \
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090054 $(PLAT_PATH)/uniphier_usb.c
Masahiro Yamada574388c2016-09-03 11:37:40 +090055
56BL31_SOURCES += drivers/arm/cci/cci.c \
57 drivers/arm/gic/common/gic_common.c \
58 drivers/arm/gic/v3/gicv3_helpers.c \
59 drivers/arm/gic/v3/gicv3_main.c \
60 lib/cpus/aarch64/cortex_a53.S \
61 lib/cpus/aarch64/cortex_a72.S \
62 plat/common/plat_gicv3.c \
63 plat/common/plat_psci_common.c \
64 $(PLAT_PATH)/uniphier_bl31_setup.c \
65 $(PLAT_PATH)/uniphier_cci.c \
66 $(PLAT_PATH)/uniphier_gicv3.c \
67 $(PLAT_PATH)/uniphier_psci.c \
68 $(PLAT_PATH)/uniphier_scp.c \
69 $(PLAT_PATH)/uniphier_smp.S \
70 $(PLAT_PATH)/uniphier_syscnt.c \
71 $(PLAT_PATH)/uniphier_topology.c
72
73ifeq (${TRUSTED_BOARD_BOOT},1)
74
75include drivers/auth/mbedtls/mbedtls_crypto.mk
76include drivers/auth/mbedtls/mbedtls_x509.mk
77
78PLAT_INCLUDES += -Iinclude/common/tbbr
79
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090080BL2_SOURCES += drivers/auth/auth_mod.c \
Masahiro Yamada574388c2016-09-03 11:37:40 +090081 drivers/auth/crypto_mod.c \
82 drivers/auth/img_parser_mod.c \
83 drivers/auth/tbbr/tbbr_cot.c \
84 plat/common/tbbr/plat_tbbr.c \
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090085 $(PLAT_PATH)/uniphier_rotpk.S \
Masahiro Yamada574388c2016-09-03 11:37:40 +090086 $(PLAT_PATH)/uniphier_tbbr.c
87
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090088ROT_KEY = $(BUILD_PLAT)/rot_key.pem
89ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
90
91$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090092$(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH)
93
94certificates: $(ROT_KEY)
Masahiro Yamadadf8fab92017-11-04 03:14:03 +090095$(ROT_KEY): | $(BUILD_PLAT)
Masahiro Yamada9679c9c2017-06-14 20:38:12 +090096 @echo " OPENSSL $@"
97 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
98
99$(ROTPK_HASH): $(ROT_KEY)
100 @echo " OPENSSL $@"
101 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
102 openssl dgst -sha256 -binary > $@ 2>/dev/null
103
Masahiro Yamada574388c2016-09-03 11:37:40 +0900104endif
105
Masahiro Yamada4ff71af2018-01-26 11:42:01 +0900106ifeq (${FIP_GZIP},1)
107
108include lib/zlib/zlib.mk
109
110BL2_SOURCES += common/image_decompress.c \
111 $(ZLIB_SOURCES)
112
113$(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP))
114
115# compress all images loaded by BL2
116SCP_BL2_PRE_TOOL_FILTER := GZIP
117BL31_PRE_TOOL_FILTER := GZIP
118BL32_PRE_TOOL_FILTER := GZIP
119BL33_PRE_TOOL_FILTER := GZIP
120
121endif
122
Masahiro Yamada75bfecb2017-12-19 11:56:05 +0900123.PHONY: bl2_gzip
124bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz
125%.gz: %
Masahiro Yamadae56b5cd2017-12-20 01:37:15 +0900126 @echo " GZIP $@"
Masahiro Yamadab13af2e2018-01-04 12:59:11 +0900127 $(Q)gzip -n -f -9 $< --stdout > $@