platform.mk 4.89 KB
Newer Older
1
#
2
# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
3
#
dp-arm's avatar
dp-arm committed
4
# SPDX-License-Identifier: BSD-3-Clause
5
6
#

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ifeq (${ARM_ARCH_MAJOR},7)
# ARMv7 Qemu support in trusted firmware expects the Cortex-A15 model.
# Qemu Cortex-A15 model does not implement the virtualization extension.
# For this reason, we cannot set ARM_CORTEX_A15=yes and must define all
# the ARMv7 build directives.
MARCH32_DIRECTIVE 	:= 	-mcpu=cortex-a15
$(eval $(call add_define,ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING))
$(eval $(call add_define,ARMV7_SUPPORTS_GENERIC_TIMER))
# Qemu expects a BL32 boot stage.
NEED_BL32		:=	yes
endif # ARMv7

ifeq (${SPD},opteed)
add-lib-optee 		:= 	yes
endif
ifeq ($(AARCH32_SP),optee)
add-lib-optee 		:= 	yes
endif

26
27
include lib/libfdt/libfdt.mk

Fu Wei's avatar
Fu Wei committed
28
29
30
31
ifeq ($(NEED_BL32),yes)
$(eval $(call add_define,QEMU_LOAD_BL32))
endif

32
PLAT_PATH               :=      plat/qemu/
33
34
35
36
PLAT_INCLUDES		:=	-Iinclude/plat/arm/common/		\
				-Iplat/qemu/include			\
				-Iinclude/common/tbbr

37
38
39
40
ifeq (${ARM_ARCH_MAJOR},8)
PLAT_INCLUDES		+=	-Iinclude/plat/arm/common/${ARCH}
endif

41
42
43
PLAT_BL_COMMON_SOURCES	:=	plat/qemu/qemu_common.c			  \
				plat/qemu/qemu_console.c		  \
				drivers/arm/pl011/${ARCH}/pl011_console.S \
44
45
46

include lib/xlat_tables_v2/xlat_tables.mk
PLAT_BL_COMMON_SOURCES	+=	${XLAT_TABLES_LIB_SRCS}
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
ifneq (${TRUSTED_BOARD_BOOT},0)

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

    AUTH_SOURCES	:=	drivers/auth/auth_mod.c			\
				drivers/auth/crypto_mod.c		\
				drivers/auth/img_parser_mod.c		\
				drivers/auth/tbbr/tbbr_cot.c

    PLAT_INCLUDES	+=	-Iinclude/bl1/tbbr

    BL1_SOURCES		+=	${AUTH_SOURCES}				\
				bl1/tbbr/tbbr_img_desc.c		\
				plat/common/tbbr/plat_tbbr.c		\
				plat/qemu/qemu_trusted_boot.c	     	\
				$(PLAT_PATH)/qemu_rotpk.S

    BL2_SOURCES		+=	${AUTH_SOURCES}				\
				plat/common/tbbr/plat_tbbr.c		\
				plat/qemu/qemu_trusted_boot.c	     	\
				$(PLAT_PATH)/qemu_rotpk.S

    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)/bl1/qemu_rotpk.o: $(ROTPK_HASH)
    $(BUILD_PLAT)/bl2/qemu_rotpk.o: $(ROTPK_HASH)

    certificates: $(ROT_KEY)

    $(ROT_KEY):
	@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
endif

91
92
93
94
95
BL1_SOURCES		+=	drivers/io/io_semihosting.c		\
				drivers/io/io_storage.c			\
				drivers/io/io_fip.c			\
				drivers/io/io_memmap.c			\
				lib/semihosting/semihosting.c		\
96
				lib/semihosting/${ARCH}/semihosting_call.S \
97
				plat/qemu/qemu_io_storage.c		\
98
				plat/qemu/${ARCH}/plat_helpers.S	\
99
100
				plat/qemu/qemu_bl1_setup.c

101
102
103
104
105
106
107
108
ifeq (${ARM_ARCH_MAJOR},8)
BL1_SOURCES		+=	lib/cpus/aarch64/aem_generic.S		\
				lib/cpus/aarch64/cortex_a53.S		\
				lib/cpus/aarch64/cortex_a57.S
else
BL1_SOURCES		+=	lib/cpus/${ARCH}/cortex_a15.S
endif

109
110
111
112
113
BL2_SOURCES		+=	drivers/io/io_semihosting.c		\
				drivers/io/io_storage.c			\
				drivers/io/io_fip.c			\
				drivers/io/io_memmap.c			\
				lib/semihosting/semihosting.c		\
114
				lib/semihosting/${ARCH}/semihosting_call.S\
115
				plat/qemu/qemu_io_storage.c		\
116
				plat/qemu/${ARCH}/plat_helpers.S	\
117
				plat/qemu/qemu_bl2_setup.c		\
118
119
				plat/qemu/dt.c				\
				plat/qemu/qemu_bl2_mem_params_desc.c	\
Fu Wei's avatar
Fu Wei committed
120
121
				plat/qemu/qemu_image_load.c		\
				common/desc_image_load.c
122

123
ifeq ($(add-lib-optee),yes)
124
125
126
BL2_SOURCES		+=	lib/optee/optee_utils.c
endif

127

128
ifeq (${ARM_ARCH_MAJOR},8)
129
130
131
132
133
134
BL31_SOURCES		+=	lib/cpus/aarch64/aem_generic.S		\
				lib/cpus/aarch64/cortex_a53.S		\
				lib/cpus/aarch64/cortex_a57.S		\
				drivers/arm/gic/v2/gicv2_helpers.c	\
				drivers/arm/gic/v2/gicv2_main.c		\
				drivers/arm/gic/common/gic_common.c	\
Santeri Salko's avatar
Santeri Salko committed
135
				plat/common/plat_gicv2.c		\
136
				plat/common/plat_psci_common.c		\
137
138
139
				plat/qemu/qemu_pm.c			\
				plat/qemu/topology.c			\
				plat/qemu/aarch64/plat_helpers.S	\
Santeri Salko's avatar
Santeri Salko committed
140
				plat/qemu/qemu_bl31_setup.c
141
endif
142
143
144
145

# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
# in the FIP if the platform requires.
ifneq ($(BL32_EXTRA1),)
146
$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
147
148
endif
ifneq ($(BL32_EXTRA2),)
149
$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
150
151
endif

152
SEPARATE_CODE_AND_RODATA := 1
153
154
155
156
ENABLE_STACK_PROTECTOR	 := 0
ifneq ($(ENABLE_STACK_PROTECTOR), 0)
	PLAT_BL_COMMON_SOURCES += plat/qemu/qemu_stack_protector.c
endif
157
158
159
160
161
162

# Use MULTI_CONSOLE_API by default only on AArch64
# as it is not yet supported on AArch32
ifeq ($(ARCH),aarch64)
MULTI_CONSOLE_API	:= 1
endif
163

164
165
166
167
168
169
170
171
172
173
174
BL32_RAM_LOCATION	:=	tdram
ifeq (${BL32_RAM_LOCATION}, tsram)
  BL32_RAM_LOCATION_ID = SEC_SRAM_ID
else ifeq (${BL32_RAM_LOCATION}, tdram)
  BL32_RAM_LOCATION_ID = SEC_DRAM_ID
else
  $(error "Unsupported BL32_RAM_LOCATION value")
endif

# Process flags
$(eval $(call add_define,BL32_RAM_LOCATION_ID))
175
176
177

# Do not enable SVE
ENABLE_SVE_FOR_NS	:=	0