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