blob: 43ab846b49170ca18644eec66a023ae7e6310f60 [file] [log] [blame]
Jens Wiklander52c798e2015-12-07 14:37:10 +01001#
dp-arm230011c2017-03-07 11:02:47 +00002# Copyright (c) 2013-2017, 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
7include lib/libfdt/libfdt.mk
8
Fu Weic2f78442017-05-27 21:21:42 +08009# Enable new version of image loading on QEMU platforms
10LOAD_IMAGE_V2 := 1
11
12ifeq ($(NEED_BL32),yes)
13$(eval $(call add_define,QEMU_LOAD_BL32))
14endif
15
Michalis Pappas3469cd02017-10-18 09:43:37 +080016PLAT_PATH := plat/qemu/
Jens Wiklander52c798e2015-12-07 14:37:10 +010017PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
18 -Iinclude/plat/arm/common/aarch64/ \
19 -Iplat/qemu/include \
20 -Iinclude/common/tbbr
21
Fu Wei77ecd462017-07-31 18:28:32 +080022# Use translation tables library v2 by default
23ARM_XLAT_TABLES_LIB_V1 := 0
24$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
25$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
26
Jens Wiklander52c798e2015-12-07 14:37:10 +010027
28PLAT_BL_COMMON_SOURCES := plat/qemu/qemu_common.c \
Fu Wei77ecd462017-07-31 18:28:32 +080029 drivers/arm/pl011/aarch64/pl011_console.S
30
31ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
32PLAT_BL_COMMON_SOURCES += lib/xlat_tables/xlat_tables_common.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +010033 lib/xlat_tables/aarch64/xlat_tables.c
Fu Wei77ecd462017-07-31 18:28:32 +080034else
35include lib/xlat_tables_v2/xlat_tables.mk
36
37PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
38endif
Jens Wiklander52c798e2015-12-07 14:37:10 +010039
Michalis Pappas3469cd02017-10-18 09:43:37 +080040ifneq (${TRUSTED_BOARD_BOOT},0)
41
42 include drivers/auth/mbedtls/mbedtls_crypto.mk
43 include drivers/auth/mbedtls/mbedtls_x509.mk
44
45 USE_TBBR_DEFS := 1
46
47 AUTH_SOURCES := drivers/auth/auth_mod.c \
48 drivers/auth/crypto_mod.c \
49 drivers/auth/img_parser_mod.c \
50 drivers/auth/tbbr/tbbr_cot.c
51
52 PLAT_INCLUDES += -Iinclude/bl1/tbbr
53
54 BL1_SOURCES += ${AUTH_SOURCES} \
55 bl1/tbbr/tbbr_img_desc.c \
56 plat/common/tbbr/plat_tbbr.c \
57 plat/qemu/qemu_trusted_boot.c \
58 $(PLAT_PATH)/qemu_rotpk.S
59
60 BL2_SOURCES += ${AUTH_SOURCES} \
61 plat/common/tbbr/plat_tbbr.c \
62 plat/qemu/qemu_trusted_boot.c \
63 $(PLAT_PATH)/qemu_rotpk.S
64
65 ROT_KEY = $(BUILD_PLAT)/rot_key.pem
66 ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
67
68 $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
69
70 $(BUILD_PLAT)/bl1/qemu_rotpk.o: $(ROTPK_HASH)
71 $(BUILD_PLAT)/bl2/qemu_rotpk.o: $(ROTPK_HASH)
72
73 certificates: $(ROT_KEY)
74
75 $(ROT_KEY):
76 @echo " OPENSSL $@"
77 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
78
79 $(ROTPK_HASH): $(ROT_KEY)
80 @echo " OPENSSL $@"
81 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
82 openssl dgst -sha256 -binary > $@ 2>/dev/null
83endif
84
Jens Wiklander52c798e2015-12-07 14:37:10 +010085BL1_SOURCES += drivers/io/io_semihosting.c \
86 drivers/io/io_storage.c \
87 drivers/io/io_fip.c \
88 drivers/io/io_memmap.c \
89 lib/semihosting/semihosting.c \
90 lib/semihosting/aarch64/semihosting_call.S \
91 plat/qemu/qemu_io_storage.c \
92 lib/cpus/aarch64/aem_generic.S \
93 lib/cpus/aarch64/cortex_a53.S \
94 lib/cpus/aarch64/cortex_a57.S \
Jens Wiklander52c798e2015-12-07 14:37:10 +010095 plat/qemu/aarch64/plat_helpers.S \
96 plat/qemu/qemu_bl1_setup.c
97
98BL2_SOURCES += drivers/io/io_semihosting.c \
99 drivers/io/io_storage.c \
100 drivers/io/io_fip.c \
101 drivers/io/io_memmap.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100102 lib/semihosting/semihosting.c \
103 lib/semihosting/aarch64/semihosting_call.S\
104 plat/qemu/qemu_io_storage.c \
105 plat/qemu/aarch64/plat_helpers.S \
106 plat/qemu/qemu_bl2_setup.c \
107 plat/qemu/dt.c \
108 $(LIBFDT_SRCS)
Fu Weic2f78442017-05-27 21:21:42 +0800109ifeq (${LOAD_IMAGE_V2},1)
110BL2_SOURCES += plat/qemu/qemu_bl2_mem_params_desc.c \
111 plat/qemu/qemu_image_load.c \
112 common/desc_image_load.c
113endif
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200114ifeq (${SPD},opteed)
115BL2_SOURCES += lib/optee/optee_utils.c
116endif
117
Jens Wiklander52c798e2015-12-07 14:37:10 +0100118
119BL31_SOURCES += lib/cpus/aarch64/aem_generic.S \
120 lib/cpus/aarch64/cortex_a53.S \
121 lib/cpus/aarch64/cortex_a57.S \
122 drivers/arm/gic/v2/gicv2_helpers.c \
123 drivers/arm/gic/v2/gicv2_main.c \
124 drivers/arm/gic/common/gic_common.c \
Jens Wiklander1017a6e2017-08-24 13:16:20 +0200125 plat/common/plat_psci_common.c \
Jens Wiklander52c798e2015-12-07 14:37:10 +0100126 plat/qemu/qemu_pm.c \
127 plat/qemu/topology.c \
128 plat/qemu/aarch64/plat_helpers.S \
129 plat/qemu/qemu_bl31_setup.c \
130 plat/qemu/qemu_gic.c
131
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200132
133# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
134# in the FIP if the platform requires.
135ifneq ($(BL32_EXTRA1),)
136$(eval $(call FIP_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
137endif
138ifneq ($(BL32_EXTRA2),)
139$(eval $(call FIP_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
140endif
141
Jens Wiklander52c798e2015-12-07 14:37:10 +0100142# Disable the PSCI platform compatibility layer
143ENABLE_PLAT_COMPAT := 0
144
145BL32_RAM_LOCATION := tdram
146ifeq (${BL32_RAM_LOCATION}, tsram)
147 BL32_RAM_LOCATION_ID = SEC_SRAM_ID
148else ifeq (${BL32_RAM_LOCATION}, tdram)
149 BL32_RAM_LOCATION_ID = SEC_DRAM_ID
150else
151 $(error "Unsupported BL32_RAM_LOCATION value")
152endif
153
154# Process flags
155$(eval $(call add_define,BL32_RAM_LOCATION_ID))
David Cunadoc5b0c0f2017-10-31 23:19:21 +0000156
157# Do not enable SVE
158ENABLE_SVE_FOR_NS := 0