blob: 2ecbec7249e160074313e6d3cff8cf473fa05b3f [file] [log] [blame]
Jens Wiklander52c798e2015-12-07 14:37:10 +01001#
Masahiro Yamada4d156802018-01-26 11:42:01 +09002# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
Jens Wiklander52c798e2015-12-07 14:37:10 +01003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Jens Wiklander52c798e2015-12-07 14:37:10 +01005#
6
Etienne Carriere911de8c2018-02-02 13:23:22 +01007ifeq (${ARM_ARCH_MAJOR},7)
8# ARMv7 Qemu support in trusted firmware expects the Cortex-A15 model.
9# Qemu Cortex-A15 model does not implement the virtualization extension.
10# For this reason, we cannot set ARM_CORTEX_A15=yes and must define all
11# the ARMv7 build directives.
12MARCH32_DIRECTIVE := -mcpu=cortex-a15
13$(eval $(call add_define,ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING))
14$(eval $(call add_define,ARMV7_SUPPORTS_GENERIC_TIMER))
15# Qemu expects a BL32 boot stage.
16NEED_BL32 := yes
17endif # ARMv7
18
19ifeq (${SPD},opteed)
20add-lib-optee := yes
21endif
22ifeq ($(AARCH32_SP),optee)
23add-lib-optee := yes
24endif
25
Jens Wiklander52c798e2015-12-07 14:37:10 +010026include lib/libfdt/libfdt.mk
27
Fu Weic2f78442017-05-27 21:21:42 +080028# Enable new version of image loading on QEMU platforms
29LOAD_IMAGE_V2 := 1
Jens Wiklander6335a972018-09-04 15:08:48 +020030ifneq ($(LOAD_IMAGE_V2),1)
31$(error Error: qemu needs LOAD_IMAGE_V2=1)
32endif
Fu Weic2f78442017-05-27 21:21:42 +080033
34ifeq ($(NEED_BL32),yes)
35$(eval $(call add_define,QEMU_LOAD_BL32))
36endif
37
Michalis Pappas3469cd02017-10-18 09:43:37 +080038PLAT_PATH := plat/qemu/
Jens Wiklander52c798e2015-12-07 14:37:10 +010039PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
Jens Wiklander52c798e2015-12-07 14:37:10 +010040 -Iplat/qemu/include \
41 -Iinclude/common/tbbr
42
Etienne Carriere911de8c2018-02-02 13:23:22 +010043ifeq (${ARM_ARCH_MAJOR},8)
44PLAT_INCLUDES += -Iinclude/plat/arm/common/${ARCH}
45endif
46
Fu Wei77ecd462017-07-31 18:28:32 +080047# Use translation tables library v2 by default
48ARM_XLAT_TABLES_LIB_V1 := 0
49$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
50$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
51
Jens Wiklander52c798e2015-12-07 14:37:10 +010052
Michalis Pappascca6cb72018-03-04 15:43:38 +080053PLAT_BL_COMMON_SOURCES := plat/qemu/qemu_common.c \
54 plat/qemu/qemu_console.c \
55 drivers/arm/pl011/${ARCH}/pl011_console.S \
Fu Wei77ecd462017-07-31 18:28:32 +080056
57ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
58PLAT_BL_COMMON_SOURCES += lib/xlat_tables/xlat_tables_common.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +010059 lib/xlat_tables/${ARCH}/xlat_tables.c
Fu Wei77ecd462017-07-31 18:28:32 +080060else
61include lib/xlat_tables_v2/xlat_tables.mk
62
63PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
64endif
Jens Wiklander52c798e2015-12-07 14:37:10 +010065
Michalis Pappas3469cd02017-10-18 09:43:37 +080066ifneq (${TRUSTED_BOARD_BOOT},0)
67
68 include drivers/auth/mbedtls/mbedtls_crypto.mk
69 include drivers/auth/mbedtls/mbedtls_x509.mk
70
71 USE_TBBR_DEFS := 1
72
73 AUTH_SOURCES := drivers/auth/auth_mod.c \
74 drivers/auth/crypto_mod.c \
75 drivers/auth/img_parser_mod.c \
76 drivers/auth/tbbr/tbbr_cot.c
77
78 PLAT_INCLUDES += -Iinclude/bl1/tbbr
79
80 BL1_SOURCES += ${AUTH_SOURCES} \
81 bl1/tbbr/tbbr_img_desc.c \
82 plat/common/tbbr/plat_tbbr.c \
83 plat/qemu/qemu_trusted_boot.c \
84 $(PLAT_PATH)/qemu_rotpk.S
85
86 BL2_SOURCES += ${AUTH_SOURCES} \
87 plat/common/tbbr/plat_tbbr.c \
88 plat/qemu/qemu_trusted_boot.c \
89 $(PLAT_PATH)/qemu_rotpk.S
90
91 ROT_KEY = $(BUILD_PLAT)/rot_key.pem
92 ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
93
94 $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
95
96 $(BUILD_PLAT)/bl1/qemu_rotpk.o: $(ROTPK_HASH)
97 $(BUILD_PLAT)/bl2/qemu_rotpk.o: $(ROTPK_HASH)
98
99 certificates: $(ROT_KEY)
100
101 $(ROT_KEY):
102 @echo " OPENSSL $@"
103 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
104
105 $(ROTPK_HASH): $(ROT_KEY)
106 @echo " OPENSSL $@"
107 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
108 openssl dgst -sha256 -binary > $@ 2>/dev/null
109endif
110
Jens Wiklander52c798e2015-12-07 14:37:10 +0100111BL1_SOURCES += drivers/io/io_semihosting.c \
112 drivers/io/io_storage.c \
113 drivers/io/io_fip.c \
114 drivers/io/io_memmap.c \
115 lib/semihosting/semihosting.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +0100116 lib/semihosting/${ARCH}/semihosting_call.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100117 plat/qemu/qemu_io_storage.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +0100118 plat/qemu/${ARCH}/plat_helpers.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100119 plat/qemu/qemu_bl1_setup.c
120
Etienne Carriere911de8c2018-02-02 13:23:22 +0100121ifeq (${ARM_ARCH_MAJOR},8)
122BL1_SOURCES += lib/cpus/aarch64/aem_generic.S \
123 lib/cpus/aarch64/cortex_a53.S \
124 lib/cpus/aarch64/cortex_a57.S
125else
126BL1_SOURCES += lib/cpus/${ARCH}/cortex_a15.S
127endif
128
Jens Wiklander52c798e2015-12-07 14:37:10 +0100129BL2_SOURCES += drivers/io/io_semihosting.c \
130 drivers/io/io_storage.c \
131 drivers/io/io_fip.c \
132 drivers/io/io_memmap.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100133 lib/semihosting/semihosting.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +0100134 lib/semihosting/${ARCH}/semihosting_call.S\
Jens Wiklander52c798e2015-12-07 14:37:10 +0100135 plat/qemu/qemu_io_storage.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +0100136 plat/qemu/${ARCH}/plat_helpers.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100137 plat/qemu/qemu_bl2_setup.c \
Jens Wiklander6335a972018-09-04 15:08:48 +0200138 plat/qemu/dt.c \
139 plat/qemu/qemu_bl2_mem_params_desc.c \
Fu Weic2f78442017-05-27 21:21:42 +0800140 plat/qemu/qemu_image_load.c \
141 common/desc_image_load.c
Jens Wiklander6335a972018-09-04 15:08:48 +0200142
Etienne Carriere911de8c2018-02-02 13:23:22 +0100143ifeq ($(add-lib-optee),yes)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200144BL2_SOURCES += lib/optee/optee_utils.c
145endif
146
Jens Wiklander52c798e2015-12-07 14:37:10 +0100147
Etienne Carriere911de8c2018-02-02 13:23:22 +0100148ifeq (${ARM_ARCH_MAJOR},8)
Jens Wiklander52c798e2015-12-07 14:37:10 +0100149BL31_SOURCES += lib/cpus/aarch64/aem_generic.S \
150 lib/cpus/aarch64/cortex_a53.S \
151 lib/cpus/aarch64/cortex_a57.S \
152 drivers/arm/gic/v2/gicv2_helpers.c \
153 drivers/arm/gic/v2/gicv2_main.c \
154 drivers/arm/gic/common/gic_common.c \
Santeri Salko4ed23382018-02-08 22:01:26 +0200155 plat/common/plat_gicv2.c \
Jens Wiklander1017a6e2017-08-24 13:16:20 +0200156 plat/common/plat_psci_common.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100157 plat/qemu/qemu_pm.c \
158 plat/qemu/topology.c \
159 plat/qemu/aarch64/plat_helpers.S \
Santeri Salko4ed23382018-02-08 22:01:26 +0200160 plat/qemu/qemu_bl31_setup.c
Etienne Carriere911de8c2018-02-02 13:23:22 +0100161endif
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200162
163# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
164# in the FIP if the platform requires.
165ifneq ($(BL32_EXTRA1),)
Masahiro Yamada9c5ca522018-01-26 11:42:01 +0900166$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200167endif
168ifneq ($(BL32_EXTRA2),)
Masahiro Yamada9c5ca522018-01-26 11:42:01 +0900169$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200170endif
171
Michalis Pappasba861122018-02-28 14:36:03 +0800172SEPARATE_CODE_AND_RODATA := 1
Michalis Pappase4c00bb2018-03-20 14:30:00 +0800173ENABLE_STACK_PROTECTOR := 0
174ifneq ($(ENABLE_STACK_PROTECTOR), 0)
175 PLAT_BL_COMMON_SOURCES += plat/qemu/qemu_stack_protector.c
176endif
Michalis Pappasa0bb5ac2018-03-24 12:38:31 +0800177
178# Use MULTI_CONSOLE_API by default only on AArch64
179# as it is not yet supported on AArch32
180ifeq ($(ARCH),aarch64)
181MULTI_CONSOLE_API := 1
182endif
Michalis Pappasba861122018-02-28 14:36:03 +0800183
Jens Wiklander52c798e2015-12-07 14:37:10 +0100184# Disable the PSCI platform compatibility layer
185ENABLE_PLAT_COMPAT := 0
186
187BL32_RAM_LOCATION := tdram
188ifeq (${BL32_RAM_LOCATION}, tsram)
189 BL32_RAM_LOCATION_ID = SEC_SRAM_ID
190else ifeq (${BL32_RAM_LOCATION}, tdram)
191 BL32_RAM_LOCATION_ID = SEC_DRAM_ID
192else
193 $(error "Unsupported BL32_RAM_LOCATION value")
194endif
195
196# Process flags
197$(eval $(call add_define,BL32_RAM_LOCATION_ID))
David Cunadoc5b0c0f2017-10-31 23:19:21 +0000198
199# Do not enable SVE
200ENABLE_SVE_FOR_NS := 0