platform.mk 3.83 KB
Newer Older
1
#
Masahiro Yamada's avatar
Masahiro Yamada committed
2
# Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
3
4
5
6
#
# SPDX-License-Identifier: BSD-3-Clause
#

7
override BL2_AT_EL3			:= 1
8
9
10
11
override COLD_BOOT_SINGLE_CPU		:= 1
override PROGRAMMABLE_RESET_ADDRESS	:= 1
override USE_COHERENT_MEM		:= 1
override ENABLE_SVE_FOR_NS		:= 0
12
13
14

# Disabling ENABLE_PIE saves memory footprint a lot, but you need to adjust
# UNIPHIER_MEM_BASE so that all TF images are loaded at their link addresses.
Masahiro Yamada's avatar
Masahiro Yamada committed
15
override ENABLE_PIE			:= 1
16

17
18
19
ALLOW_RO_XLAT_TABLES			:= 1

ifeq ($(ALLOW_RO_XLAT_TABLES),1)
20
21
BL31_CPPFLAGS += -DPLAT_RO_XLAT_TABLES
BL32_CPPFLAGS += -DPLAT_RO_XLAT_TABLES
22
23
endif

24
25
26
# The dynamic xlat table is only used in BL2
BL2_CPPFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC

27
28
29
30
31
32
33
34
35
36
# Cortex-A53 revision r0p4-51rel0
# needed for LD20, unneeded for LD11, PXs3 (no ACE)
ERRATA_A53_855873		:= 1

FIP_ALIGN			:= 512

ifeq ($(NEED_BL32),yes)
$(eval $(call add_define,UNIPHIER_LOAD_BL32))
endif

37
38
39
# Libraries
include lib/xlat_tables_v2/xlat_tables.mk

40
41
42
PLAT_PATH		:=	plat/socionext/uniphier
PLAT_INCLUDES		:=	-I$(PLAT_PATH)/include

43
# common sources for BL2, BL31 (and BL32 if SPD=tspd)
44
PLAT_BL_COMMON_SOURCES	+=	plat/common/aarch64/crash_console_helpers.S \
45
				$(PLAT_PATH)/uniphier_console.S		\
46
				$(PLAT_PATH)/uniphier_console_setup.c	\
47
48
				$(PLAT_PATH)/uniphier_helpers.S		\
				$(PLAT_PATH)/uniphier_soc_info.c	\
49
50
				$(PLAT_PATH)/uniphier_xlat_setup.c	\
				${XLAT_TABLES_LIB_SRCS}
51
52

BL2_SOURCES		+=	common/desc_image_load.c		\
53
54
55
56
57
58
				drivers/io/io_block.c			\
				drivers/io/io_fip.c			\
				drivers/io/io_memmap.c			\
				drivers/io/io_storage.c			\
				lib/cpus/aarch64/cortex_a53.S		\
				lib/cpus/aarch64/cortex_a72.S		\
59
				$(PLAT_PATH)/uniphier_bl2_setup.c	\
60
61
				$(PLAT_PATH)/uniphier_boot_device.c	\
				$(PLAT_PATH)/uniphier_emmc.c		\
62
				$(PLAT_PATH)/uniphier_image_desc.c	\
63
64
				$(PLAT_PATH)/uniphier_io_storage.c	\
				$(PLAT_PATH)/uniphier_nand.c		\
65
				$(PLAT_PATH)/uniphier_scp.c		\
66
				$(PLAT_PATH)/uniphier_usb.c
67

68
69
70
# Include GICv3 driver files
include drivers/arm/gic/v3/gicv3.mk

71
BL31_SOURCES		+=	drivers/arm/cci/cci.c			\
72
				${GICV3_SOURCES}			\
73
74
75
76
77
				lib/cpus/aarch64/cortex_a53.S		\
				lib/cpus/aarch64/cortex_a72.S		\
				plat/common/plat_gicv3.c		\
				plat/common/plat_psci_common.c		\
				$(PLAT_PATH)/uniphier_bl31_setup.c	\
78
				$(PLAT_PATH)/uniphier_boot_device.c	\
79
80
81
82
83
84
85
86
87
88
89
90
91
				$(PLAT_PATH)/uniphier_cci.c		\
				$(PLAT_PATH)/uniphier_gicv3.c		\
				$(PLAT_PATH)/uniphier_psci.c		\
				$(PLAT_PATH)/uniphier_scp.c		\
				$(PLAT_PATH)/uniphier_smp.S		\
				$(PLAT_PATH)/uniphier_syscnt.c		\
				$(PLAT_PATH)/uniphier_topology.c

ifeq (${TRUSTED_BOARD_BOOT},1)

include drivers/auth/mbedtls/mbedtls_crypto.mk
include drivers/auth/mbedtls/mbedtls_x509.mk

92
BL2_SOURCES		+=	drivers/auth/auth_mod.c			\
93
94
				drivers/auth/crypto_mod.c		\
				drivers/auth/img_parser_mod.c		\
95
96
				drivers/auth/tbbr/tbbr_cot_common.c	\
				drivers/auth/tbbr/tbbr_cot_bl2.c	\
97
				plat/common/tbbr/plat_tbbr.c		\
98
				$(PLAT_PATH)/uniphier_rotpk.S		\
99
100
				$(PLAT_PATH)/uniphier_tbbr.c

101
102
103
104
105
106
107
ROT_KEY			= $(BUILD_PLAT)/rot_key.pem
ROTPK_HASH		= $(BUILD_PLAT)/rotpk_sha256.bin

$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
$(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH)

certificates: $(ROT_KEY)
108
$(ROT_KEY): | $(BUILD_PLAT)
109
110
111
112
113
114
115
116
	@echo "  OPENSSL $@"
	$(Q)openssl genrsa 2048 > $@ 2>/dev/null

$(ROTPK_HASH): $(ROT_KEY)
	@echo "  OPENSSL $@"
	$(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
	openssl dgst -sha256 -binary > $@ 2>/dev/null

117
118
endif

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
ifeq (${FIP_GZIP},1)

include lib/zlib/zlib.mk

BL2_SOURCES		+=	common/image_decompress.c		\
				$(ZLIB_SOURCES)

$(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP))

# compress all images loaded by BL2
SCP_BL2_PRE_TOOL_FILTER	:= GZIP
BL31_PRE_TOOL_FILTER	:= GZIP
BL32_PRE_TOOL_FILTER	:= GZIP
BL33_PRE_TOOL_FILTER	:= GZIP

endif

136
137
138
.PHONY: bl2_gzip
bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz
%.gz: %
139
	@echo "  GZIP    $@"
140
	$(Q)gzip -n -f -9 $< --stdout > $@