Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 1 | # |
Masahiro Yamada | 4d15680 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 2 | # Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 5 | # |
| 6 | |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 7 | ifeq (${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. |
| 12 | MARCH32_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. |
| 16 | NEED_BL32 := yes |
| 17 | endif # ARMv7 |
| 18 | |
| 19 | ifeq (${SPD},opteed) |
| 20 | add-lib-optee := yes |
| 21 | endif |
| 22 | ifeq ($(AARCH32_SP),optee) |
| 23 | add-lib-optee := yes |
| 24 | endif |
| 25 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 26 | include lib/libfdt/libfdt.mk |
| 27 | |
Fu Wei | c2f7844 | 2017-05-27 21:21:42 +0800 | [diff] [blame] | 28 | ifeq ($(NEED_BL32),yes) |
| 29 | $(eval $(call add_define,QEMU_LOAD_BL32)) |
| 30 | endif |
| 31 | |
Michalis Pappas | 3469cd0 | 2017-10-18 09:43:37 +0800 | [diff] [blame] | 32 | PLAT_PATH := plat/qemu/ |
Antonio Nino Diaz | 50a4d1a | 2019-02-01 12:22:22 +0000 | [diff] [blame] | 33 | PLAT_INCLUDES := -Iplat/qemu/include |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 34 | |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 35 | ifeq (${ARM_ARCH_MAJOR},8) |
| 36 | PLAT_INCLUDES += -Iinclude/plat/arm/common/${ARCH} |
| 37 | endif |
| 38 | |
Michalis Pappas | cca6cb7 | 2018-03-04 15:43:38 +0800 | [diff] [blame] | 39 | PLAT_BL_COMMON_SOURCES := plat/qemu/qemu_common.c \ |
| 40 | plat/qemu/qemu_console.c \ |
| 41 | drivers/arm/pl011/${ARCH}/pl011_console.S \ |
Fu Wei | 77ecd46 | 2017-07-31 18:28:32 +0800 | [diff] [blame] | 42 | |
Fu Wei | 77ecd46 | 2017-07-31 18:28:32 +0800 | [diff] [blame] | 43 | include lib/xlat_tables_v2/xlat_tables.mk |
Fu Wei | 77ecd46 | 2017-07-31 18:28:32 +0800 | [diff] [blame] | 44 | PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 45 | |
Michalis Pappas | 3469cd0 | 2017-10-18 09:43:37 +0800 | [diff] [blame] | 46 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 47 | |
| 48 | include drivers/auth/mbedtls/mbedtls_crypto.mk |
| 49 | include drivers/auth/mbedtls/mbedtls_x509.mk |
| 50 | |
Michalis Pappas | 3469cd0 | 2017-10-18 09:43:37 +0800 | [diff] [blame] | 51 | AUTH_SOURCES := drivers/auth/auth_mod.c \ |
| 52 | drivers/auth/crypto_mod.c \ |
| 53 | drivers/auth/img_parser_mod.c \ |
| 54 | drivers/auth/tbbr/tbbr_cot.c |
| 55 | |
Michalis Pappas | 3469cd0 | 2017-10-18 09:43:37 +0800 | [diff] [blame] | 56 | BL1_SOURCES += ${AUTH_SOURCES} \ |
| 57 | bl1/tbbr/tbbr_img_desc.c \ |
| 58 | plat/common/tbbr/plat_tbbr.c \ |
| 59 | plat/qemu/qemu_trusted_boot.c \ |
| 60 | $(PLAT_PATH)/qemu_rotpk.S |
| 61 | |
| 62 | BL2_SOURCES += ${AUTH_SOURCES} \ |
| 63 | plat/common/tbbr/plat_tbbr.c \ |
| 64 | plat/qemu/qemu_trusted_boot.c \ |
| 65 | $(PLAT_PATH)/qemu_rotpk.S |
| 66 | |
| 67 | ROT_KEY = $(BUILD_PLAT)/rot_key.pem |
| 68 | ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin |
| 69 | |
| 70 | $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"')) |
| 71 | |
| 72 | $(BUILD_PLAT)/bl1/qemu_rotpk.o: $(ROTPK_HASH) |
| 73 | $(BUILD_PLAT)/bl2/qemu_rotpk.o: $(ROTPK_HASH) |
| 74 | |
| 75 | certificates: $(ROT_KEY) |
| 76 | |
| 77 | $(ROT_KEY): |
| 78 | @echo " OPENSSL $@" |
| 79 | $(Q)openssl genrsa 2048 > $@ 2>/dev/null |
| 80 | |
| 81 | $(ROTPK_HASH): $(ROT_KEY) |
| 82 | @echo " OPENSSL $@" |
| 83 | $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\ |
| 84 | openssl dgst -sha256 -binary > $@ 2>/dev/null |
| 85 | endif |
| 86 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 87 | BL1_SOURCES += drivers/io/io_semihosting.c \ |
| 88 | drivers/io/io_storage.c \ |
| 89 | drivers/io/io_fip.c \ |
| 90 | drivers/io/io_memmap.c \ |
| 91 | lib/semihosting/semihosting.c \ |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 92 | lib/semihosting/${ARCH}/semihosting_call.S \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 93 | plat/qemu/qemu_io_storage.c \ |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 94 | plat/qemu/${ARCH}/plat_helpers.S \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 95 | plat/qemu/qemu_bl1_setup.c |
| 96 | |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 97 | ifeq (${ARM_ARCH_MAJOR},8) |
| 98 | BL1_SOURCES += lib/cpus/aarch64/aem_generic.S \ |
| 99 | lib/cpus/aarch64/cortex_a53.S \ |
| 100 | lib/cpus/aarch64/cortex_a57.S |
| 101 | else |
| 102 | BL1_SOURCES += lib/cpus/${ARCH}/cortex_a15.S |
| 103 | endif |
| 104 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 105 | BL2_SOURCES += drivers/io/io_semihosting.c \ |
| 106 | drivers/io/io_storage.c \ |
| 107 | drivers/io/io_fip.c \ |
| 108 | drivers/io/io_memmap.c \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 109 | lib/semihosting/semihosting.c \ |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 110 | lib/semihosting/${ARCH}/semihosting_call.S\ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 111 | plat/qemu/qemu_io_storage.c \ |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 112 | plat/qemu/${ARCH}/plat_helpers.S \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 113 | plat/qemu/qemu_bl2_setup.c \ |
Jens Wiklander | 6335a97 | 2018-09-04 15:08:48 +0200 | [diff] [blame] | 114 | plat/qemu/dt.c \ |
| 115 | plat/qemu/qemu_bl2_mem_params_desc.c \ |
Fu Wei | c2f7844 | 2017-05-27 21:21:42 +0800 | [diff] [blame] | 116 | plat/qemu/qemu_image_load.c \ |
| 117 | common/desc_image_load.c |
Jens Wiklander | 6335a97 | 2018-09-04 15:08:48 +0200 | [diff] [blame] | 118 | |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 119 | ifeq ($(add-lib-optee),yes) |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 120 | BL2_SOURCES += lib/optee/optee_utils.c |
| 121 | endif |
| 122 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 123 | |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 124 | ifeq (${ARM_ARCH_MAJOR},8) |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 125 | BL31_SOURCES += lib/cpus/aarch64/aem_generic.S \ |
| 126 | lib/cpus/aarch64/cortex_a53.S \ |
| 127 | lib/cpus/aarch64/cortex_a57.S \ |
| 128 | drivers/arm/gic/v2/gicv2_helpers.c \ |
| 129 | drivers/arm/gic/v2/gicv2_main.c \ |
| 130 | drivers/arm/gic/common/gic_common.c \ |
Santeri Salko | 4ed2338 | 2018-02-08 22:01:26 +0200 | [diff] [blame] | 131 | plat/common/plat_gicv2.c \ |
Jens Wiklander | 1017a6e | 2017-08-24 13:16:20 +0200 | [diff] [blame] | 132 | plat/common/plat_psci_common.c \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 133 | plat/qemu/qemu_pm.c \ |
| 134 | plat/qemu/topology.c \ |
| 135 | plat/qemu/aarch64/plat_helpers.S \ |
Santeri Salko | 4ed2338 | 2018-02-08 22:01:26 +0200 | [diff] [blame] | 136 | plat/qemu/qemu_bl31_setup.c |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 137 | endif |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 138 | |
| 139 | # Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images |
| 140 | # in the FIP if the platform requires. |
| 141 | ifneq ($(BL32_EXTRA1),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 142 | $(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1)) |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 143 | endif |
| 144 | ifneq ($(BL32_EXTRA2),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 145 | $(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2)) |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 146 | endif |
| 147 | |
Michalis Pappas | ba86112 | 2018-02-28 14:36:03 +0800 | [diff] [blame] | 148 | SEPARATE_CODE_AND_RODATA := 1 |
Michalis Pappas | e4c00bb | 2018-03-20 14:30:00 +0800 | [diff] [blame] | 149 | ENABLE_STACK_PROTECTOR := 0 |
| 150 | ifneq ($(ENABLE_STACK_PROTECTOR), 0) |
| 151 | PLAT_BL_COMMON_SOURCES += plat/qemu/qemu_stack_protector.c |
| 152 | endif |
Michalis Pappas | a0bb5ac | 2018-03-24 12:38:31 +0800 | [diff] [blame] | 153 | |
| 154 | # Use MULTI_CONSOLE_API by default only on AArch64 |
| 155 | # as it is not yet supported on AArch32 |
| 156 | ifeq ($(ARCH),aarch64) |
| 157 | MULTI_CONSOLE_API := 1 |
| 158 | endif |
Michalis Pappas | ba86112 | 2018-02-28 14:36:03 +0800 | [diff] [blame] | 159 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 160 | BL32_RAM_LOCATION := tdram |
| 161 | ifeq (${BL32_RAM_LOCATION}, tsram) |
| 162 | BL32_RAM_LOCATION_ID = SEC_SRAM_ID |
| 163 | else ifeq (${BL32_RAM_LOCATION}, tdram) |
| 164 | BL32_RAM_LOCATION_ID = SEC_DRAM_ID |
| 165 | else |
| 166 | $(error "Unsupported BL32_RAM_LOCATION value") |
| 167 | endif |
| 168 | |
| 169 | # Process flags |
| 170 | $(eval $(call add_define,BL32_RAM_LOCATION_ID)) |
David Cunado | c5b0c0f | 2017-10-31 23:19:21 +0000 | [diff] [blame] | 171 | |
| 172 | # Do not enable SVE |
| 173 | ENABLE_SVE_FOR_NS := 0 |