1# 2# Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6 7include lib/libfdt/libfdt.mk 8 9# 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 16PLAT_PATH := plat/qemu/ 17PLAT_INCLUDES := -Iinclude/plat/arm/common/ \ 18 -Iinclude/plat/arm/common/aarch64/ \ 19 -Iplat/qemu/include \ 20 -Iinclude/common/tbbr 21 22# 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 27 28PLAT_BL_COMMON_SOURCES := plat/qemu/qemu_common.c \ 29 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 \ 33 lib/xlat_tables/aarch64/xlat_tables.c 34else 35include lib/xlat_tables_v2/xlat_tables.mk 36 37PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} 38endif 39 40ifneq (${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 85BL1_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 \ 95 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 \ 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) 109ifeq (${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 114ifeq (${SPD},opteed) 115BL2_SOURCES += lib/optee/optee_utils.c 116endif 117 118 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 \ 125 plat/common/plat_psci_common.c \ 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 132 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 142# 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)) 156