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 | |
| 7 | include lib/libfdt/libfdt.mk |
| 8 | |
Fu Wei | c2f7844 | 2017-05-27 21:21:42 +0800 | [diff] [blame] | 9 | # Enable new version of image loading on QEMU platforms |
| 10 | LOAD_IMAGE_V2 := 1 |
| 11 | |
| 12 | ifeq ($(NEED_BL32),yes) |
| 13 | $(eval $(call add_define,QEMU_LOAD_BL32)) |
| 14 | endif |
| 15 | |
Michalis Pappas | 3469cd0 | 2017-10-18 09:43:37 +0800 | [diff] [blame] | 16 | PLAT_PATH := plat/qemu/ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 17 | PLAT_INCLUDES := -Iinclude/plat/arm/common/ \ |
| 18 | -Iinclude/plat/arm/common/aarch64/ \ |
| 19 | -Iplat/qemu/include \ |
| 20 | -Iinclude/common/tbbr |
| 21 | |
Fu Wei | 77ecd46 | 2017-07-31 18:28:32 +0800 | [diff] [blame] | 22 | # Use translation tables library v2 by default |
| 23 | ARM_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 Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 27 | |
| 28 | PLAT_BL_COMMON_SOURCES := plat/qemu/qemu_common.c \ |
Fu Wei | 77ecd46 | 2017-07-31 18:28:32 +0800 | [diff] [blame] | 29 | drivers/arm/pl011/aarch64/pl011_console.S |
| 30 | |
| 31 | ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) |
| 32 | PLAT_BL_COMMON_SOURCES += lib/xlat_tables/xlat_tables_common.c \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 33 | lib/xlat_tables/aarch64/xlat_tables.c |
Fu Wei | 77ecd46 | 2017-07-31 18:28:32 +0800 | [diff] [blame] | 34 | else |
| 35 | include lib/xlat_tables_v2/xlat_tables.mk |
| 36 | |
| 37 | PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} |
| 38 | endif |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 39 | |
Michalis Pappas | 3469cd0 | 2017-10-18 09:43:37 +0800 | [diff] [blame] | 40 | ifneq (${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 |
| 83 | endif |
| 84 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 85 | BL1_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 Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 95 | plat/qemu/aarch64/plat_helpers.S \ |
| 96 | plat/qemu/qemu_bl1_setup.c |
| 97 | |
| 98 | BL2_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 Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 102 | 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 Wei | c2f7844 | 2017-05-27 21:21:42 +0800 | [diff] [blame] | 109 | ifeq (${LOAD_IMAGE_V2},1) |
| 110 | BL2_SOURCES += plat/qemu/qemu_bl2_mem_params_desc.c \ |
| 111 | plat/qemu/qemu_image_load.c \ |
| 112 | common/desc_image_load.c |
| 113 | endif |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 114 | ifeq (${SPD},opteed) |
| 115 | BL2_SOURCES += lib/optee/optee_utils.c |
| 116 | endif |
| 117 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 118 | |
| 119 | BL31_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 Wiklander | 1017a6e | 2017-08-24 13:16:20 +0200 | [diff] [blame] | 125 | plat/common/plat_psci_common.c \ |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 126 | 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 Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 132 | |
| 133 | # Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images |
| 134 | # in the FIP if the platform requires. |
| 135 | ifneq ($(BL32_EXTRA1),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 136 | $(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1)) |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 137 | endif |
| 138 | ifneq ($(BL32_EXTRA2),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 139 | $(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2)) |
Jens Wiklander | 0acbaaa | 2017-08-24 13:16:26 +0200 | [diff] [blame] | 140 | endif |
| 141 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 142 | # Disable the PSCI platform compatibility layer |
| 143 | ENABLE_PLAT_COMPAT := 0 |
| 144 | |
| 145 | BL32_RAM_LOCATION := tdram |
| 146 | ifeq (${BL32_RAM_LOCATION}, tsram) |
| 147 | BL32_RAM_LOCATION_ID = SEC_SRAM_ID |
| 148 | else ifeq (${BL32_RAM_LOCATION}, tdram) |
| 149 | BL32_RAM_LOCATION_ID = SEC_DRAM_ID |
| 150 | else |
| 151 | $(error "Unsupported BL32_RAM_LOCATION value") |
| 152 | endif |
| 153 | |
| 154 | # Process flags |
| 155 | $(eval $(call add_define,BL32_RAM_LOCATION_ID)) |
David Cunado | c5b0c0f | 2017-10-31 23:19:21 +0000 | [diff] [blame] | 156 | |
| 157 | # Do not enable SVE |
| 158 | ENABLE_SVE_FOR_NS := 0 |