blob: 982886a9330283b04b62aa6682f5040c0f9afbc6 [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 +080028ifeq ($(NEED_BL32),yes)
29$(eval $(call add_define,QEMU_LOAD_BL32))
30endif
31
Michalis Pappas3469cd02017-10-18 09:43:37 +080032PLAT_PATH := plat/qemu/
Jens Wiklander52c798e2015-12-07 14:37:10 +010033PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
Jens Wiklander52c798e2015-12-07 14:37:10 +010034 -Iplat/qemu/include \
35 -Iinclude/common/tbbr
36
Etienne Carriere911de8c2018-02-02 13:23:22 +010037ifeq (${ARM_ARCH_MAJOR},8)
38PLAT_INCLUDES += -Iinclude/plat/arm/common/${ARCH}
39endif
40
Michalis Pappascca6cb72018-03-04 15:43:38 +080041PLAT_BL_COMMON_SOURCES := plat/qemu/qemu_common.c \
42 plat/qemu/qemu_console.c \
43 drivers/arm/pl011/${ARCH}/pl011_console.S \
Fu Wei77ecd462017-07-31 18:28:32 +080044
Fu Wei77ecd462017-07-31 18:28:32 +080045include lib/xlat_tables_v2/xlat_tables.mk
Fu Wei77ecd462017-07-31 18:28:32 +080046PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
Jens Wiklander52c798e2015-12-07 14:37:10 +010047
Michalis Pappas3469cd02017-10-18 09:43:37 +080048ifneq (${TRUSTED_BOARD_BOOT},0)
49
50 include drivers/auth/mbedtls/mbedtls_crypto.mk
51 include drivers/auth/mbedtls/mbedtls_x509.mk
52
Michalis Pappas3469cd02017-10-18 09:43:37 +080053 AUTH_SOURCES := drivers/auth/auth_mod.c \
54 drivers/auth/crypto_mod.c \
55 drivers/auth/img_parser_mod.c \
56 drivers/auth/tbbr/tbbr_cot.c
57
58 PLAT_INCLUDES += -Iinclude/bl1/tbbr
59
60 BL1_SOURCES += ${AUTH_SOURCES} \
61 bl1/tbbr/tbbr_img_desc.c \
62 plat/common/tbbr/plat_tbbr.c \
63 plat/qemu/qemu_trusted_boot.c \
64 $(PLAT_PATH)/qemu_rotpk.S
65
66 BL2_SOURCES += ${AUTH_SOURCES} \
67 plat/common/tbbr/plat_tbbr.c \
68 plat/qemu/qemu_trusted_boot.c \
69 $(PLAT_PATH)/qemu_rotpk.S
70
71 ROT_KEY = $(BUILD_PLAT)/rot_key.pem
72 ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
73
74 $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
75
76 $(BUILD_PLAT)/bl1/qemu_rotpk.o: $(ROTPK_HASH)
77 $(BUILD_PLAT)/bl2/qemu_rotpk.o: $(ROTPK_HASH)
78
79 certificates: $(ROT_KEY)
80
81 $(ROT_KEY):
82 @echo " OPENSSL $@"
83 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
84
85 $(ROTPK_HASH): $(ROT_KEY)
86 @echo " OPENSSL $@"
87 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
88 openssl dgst -sha256 -binary > $@ 2>/dev/null
89endif
90
Jens Wiklander52c798e2015-12-07 14:37:10 +010091BL1_SOURCES += drivers/io/io_semihosting.c \
92 drivers/io/io_storage.c \
93 drivers/io/io_fip.c \
94 drivers/io/io_memmap.c \
95 lib/semihosting/semihosting.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +010096 lib/semihosting/${ARCH}/semihosting_call.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +010097 plat/qemu/qemu_io_storage.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +010098 plat/qemu/${ARCH}/plat_helpers.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +010099 plat/qemu/qemu_bl1_setup.c
100
Etienne Carriere911de8c2018-02-02 13:23:22 +0100101ifeq (${ARM_ARCH_MAJOR},8)
102BL1_SOURCES += lib/cpus/aarch64/aem_generic.S \
103 lib/cpus/aarch64/cortex_a53.S \
104 lib/cpus/aarch64/cortex_a57.S
105else
106BL1_SOURCES += lib/cpus/${ARCH}/cortex_a15.S
107endif
108
Jens Wiklander52c798e2015-12-07 14:37:10 +0100109BL2_SOURCES += drivers/io/io_semihosting.c \
110 drivers/io/io_storage.c \
111 drivers/io/io_fip.c \
112 drivers/io/io_memmap.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100113 lib/semihosting/semihosting.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +0100114 lib/semihosting/${ARCH}/semihosting_call.S\
Jens Wiklander52c798e2015-12-07 14:37:10 +0100115 plat/qemu/qemu_io_storage.c \
Etienne Carriere911de8c2018-02-02 13:23:22 +0100116 plat/qemu/${ARCH}/plat_helpers.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100117 plat/qemu/qemu_bl2_setup.c \
Jens Wiklander6335a972018-09-04 15:08:48 +0200118 plat/qemu/dt.c \
119 plat/qemu/qemu_bl2_mem_params_desc.c \
Fu Weic2f78442017-05-27 21:21:42 +0800120 plat/qemu/qemu_image_load.c \
121 common/desc_image_load.c
Jens Wiklander6335a972018-09-04 15:08:48 +0200122
Etienne Carriere911de8c2018-02-02 13:23:22 +0100123ifeq ($(add-lib-optee),yes)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200124BL2_SOURCES += lib/optee/optee_utils.c
125endif
126
Jens Wiklander52c798e2015-12-07 14:37:10 +0100127
Etienne Carriere911de8c2018-02-02 13:23:22 +0100128ifeq (${ARM_ARCH_MAJOR},8)
Jens Wiklander52c798e2015-12-07 14:37:10 +0100129BL31_SOURCES += lib/cpus/aarch64/aem_generic.S \
130 lib/cpus/aarch64/cortex_a53.S \
131 lib/cpus/aarch64/cortex_a57.S \
132 drivers/arm/gic/v2/gicv2_helpers.c \
133 drivers/arm/gic/v2/gicv2_main.c \
134 drivers/arm/gic/common/gic_common.c \
Santeri Salko4ed23382018-02-08 22:01:26 +0200135 plat/common/plat_gicv2.c \
Jens Wiklander1017a6e2017-08-24 13:16:20 +0200136 plat/common/plat_psci_common.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100137 plat/qemu/qemu_pm.c \
138 plat/qemu/topology.c \
139 plat/qemu/aarch64/plat_helpers.S \
Santeri Salko4ed23382018-02-08 22:01:26 +0200140 plat/qemu/qemu_bl31_setup.c
Etienne Carriere911de8c2018-02-02 13:23:22 +0100141endif
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200142
143# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
144# in the FIP if the platform requires.
145ifneq ($(BL32_EXTRA1),)
Masahiro Yamada9c5ca522018-01-26 11:42:01 +0900146$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200147endif
148ifneq ($(BL32_EXTRA2),)
Masahiro Yamada9c5ca522018-01-26 11:42:01 +0900149$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200150endif
151
Michalis Pappasba861122018-02-28 14:36:03 +0800152SEPARATE_CODE_AND_RODATA := 1
Michalis Pappase4c00bb2018-03-20 14:30:00 +0800153ENABLE_STACK_PROTECTOR := 0
154ifneq ($(ENABLE_STACK_PROTECTOR), 0)
155 PLAT_BL_COMMON_SOURCES += plat/qemu/qemu_stack_protector.c
156endif
Michalis Pappasa0bb5ac2018-03-24 12:38:31 +0800157
158# Use MULTI_CONSOLE_API by default only on AArch64
159# as it is not yet supported on AArch32
160ifeq ($(ARCH),aarch64)
161MULTI_CONSOLE_API := 1
162endif
Michalis Pappasba861122018-02-28 14:36:03 +0800163
Jens Wiklander52c798e2015-12-07 14:37:10 +0100164BL32_RAM_LOCATION := tdram
165ifeq (${BL32_RAM_LOCATION}, tsram)
166 BL32_RAM_LOCATION_ID = SEC_SRAM_ID
167else ifeq (${BL32_RAM_LOCATION}, tdram)
168 BL32_RAM_LOCATION_ID = SEC_DRAM_ID
169else
170 $(error "Unsupported BL32_RAM_LOCATION value")
171endif
172
173# Process flags
174$(eval $(call add_define,BL32_RAM_LOCATION_ID))
David Cunadoc5b0c0f2017-10-31 23:19:21 +0000175
176# Do not enable SVE
177ENABLE_SVE_FOR_NS := 0