Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 1 | # |
Antonio Nino Diaz | 1f47002 | 2018-03-27 09:39:47 +0100 | [diff] [blame] | 2 | # Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | PLAT_INCLUDES := -Iinclude/common/tbbr \ |
| 8 | -Iinclude/plat/arm/common/ \ |
| 9 | -Iinclude/plat/arm/common/aarch64/ \ |
| 10 | -Iplat/rpi3/include |
| 11 | |
| 12 | PLAT_BL_COMMON_SOURCES := drivers/console/aarch64/console.S \ |
| 13 | drivers/ti/uart/aarch64/16550_console.S \ |
| 14 | plat/rpi3/rpi3_common.c |
| 15 | |
| 16 | BL1_SOURCES += drivers/io/io_fip.c \ |
| 17 | drivers/io/io_memmap.c \ |
| 18 | drivers/io/io_storage.c \ |
| 19 | lib/cpus/aarch64/cortex_a53.S \ |
| 20 | plat/common/aarch64/platform_mp_stack.S \ |
| 21 | plat/rpi3/aarch64/plat_helpers.S \ |
| 22 | plat/rpi3/rpi3_bl1_setup.c \ |
| 23 | plat/rpi3/rpi3_io_storage.c |
| 24 | |
| 25 | BL2_SOURCES += common/desc_image_load.c \ |
| 26 | drivers/io/io_fip.c \ |
| 27 | drivers/io/io_memmap.c \ |
| 28 | drivers/io/io_storage.c \ |
| 29 | plat/common/aarch64/platform_mp_stack.S \ |
| 30 | plat/rpi3/aarch64/plat_helpers.S \ |
| 31 | plat/rpi3/aarch64/rpi3_bl2_mem_params_desc.c \ |
| 32 | plat/rpi3/rpi3_bl2_setup.c \ |
| 33 | plat/rpi3/rpi3_image_load.c \ |
| 34 | plat/rpi3/rpi3_io_storage.c |
| 35 | |
| 36 | BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ |
| 37 | plat/common/aarch64/plat_psci_common.c \ |
| 38 | plat/rpi3/aarch64/plat_helpers.S \ |
| 39 | plat/rpi3/rpi3_bl31_setup.c \ |
| 40 | plat/rpi3/rpi3_pm.c \ |
| 41 | plat/rpi3/rpi3_topology.c |
| 42 | |
| 43 | # Translation tables library |
| 44 | include lib/xlat_tables_v2/xlat_tables.mk |
| 45 | |
| 46 | PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} |
| 47 | |
| 48 | # Tune compiler for Cortex-A53 |
| 49 | ifeq ($(notdir $(CC)),armclang) |
| 50 | TF_CFLAGS_aarch64 += -mcpu=cortex-a53 |
| 51 | else ifneq ($(findstring clang,$(notdir $(CC))),) |
| 52 | TF_CFLAGS_aarch64 += -mcpu=cortex-a53 |
| 53 | else |
| 54 | TF_CFLAGS_aarch64 += -mtune=cortex-a53 |
| 55 | endif |
| 56 | |
| 57 | # Build config flags |
| 58 | # ------------------ |
| 59 | |
| 60 | # Enable all errata workarounds for Cortex-A53 |
| 61 | ERRATA_A53_826319 := 1 |
| 62 | ERRATA_A53_835769 := 1 |
| 63 | ERRATA_A53_836870 := 1 |
| 64 | ERRATA_A53_843419 := 1 |
| 65 | ERRATA_A53_855873 := 1 |
| 66 | |
Dimitris Papastamos | 8e5bd5e | 2018-01-24 16:41:14 +0000 | [diff] [blame] | 67 | WORKAROUND_CVE_2017_5715 := 0 |
| 68 | |
Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 69 | # Disable the PSCI platform compatibility layer by default |
| 70 | ENABLE_PLAT_COMPAT := 0 |
| 71 | |
| 72 | # Enable reset to BL31 by default |
| 73 | RESET_TO_BL31 := 1 |
| 74 | |
| 75 | # Have different sections for code and rodata |
| 76 | SEPARATE_CODE_AND_RODATA := 1 |
| 77 | |
| 78 | # Use Coherent memory |
| 79 | USE_COHERENT_MEM := 1 |
| 80 | |
| 81 | # Enable new version of image loading |
| 82 | LOAD_IMAGE_V2 := 1 |
| 83 | |
Antonio Nino Diaz | 1f47002 | 2018-03-27 09:39:47 +0100 | [diff] [blame] | 84 | # Use multi console API |
| 85 | MULTI_CONSOLE_API := 1 |
| 86 | |
Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 87 | # Platform build flags |
| 88 | # -------------------- |
| 89 | |
| 90 | # BL33 images are in AArch64 by default |
| 91 | RPI3_BL33_IN_AARCH32 := 0 |
| 92 | |
| 93 | # BL32 location |
| 94 | RPI3_BL32_RAM_LOCATION := tdram |
| 95 | ifeq (${RPI3_BL32_RAM_LOCATION}, tsram) |
| 96 | RPI3_BL32_RAM_LOCATION_ID = SEC_SRAM_ID |
| 97 | else ifeq (${RPI3_BL32_RAM_LOCATION}, tdram) |
| 98 | RPI3_BL32_RAM_LOCATION_ID = SEC_DRAM_ID |
| 99 | else |
| 100 | $(error "Unsupported RPI3_BL32_RAM_LOCATION value") |
| 101 | endif |
| 102 | |
| 103 | # Process platform flags |
| 104 | # ---------------------- |
| 105 | |
| 106 | $(eval $(call add_define,RPI3_BL32_RAM_LOCATION_ID)) |
| 107 | $(eval $(call add_define,RPI3_BL33_IN_AARCH32)) |
| 108 | |
| 109 | # Verify build config |
| 110 | # ------------------- |
| 111 | |
| 112 | ifneq (${LOAD_IMAGE_V2}, 1) |
| 113 | $(error Error: rpi3 needs LOAD_IMAGE_V2=1) |
| 114 | endif |
| 115 | |
Antonio Nino Diaz | 1f47002 | 2018-03-27 09:39:47 +0100 | [diff] [blame] | 116 | ifneq (${MULTI_CONSOLE_API}, 1) |
| 117 | $(error Error: rpi3 needs MULTI_CONSOLE_API=1) |
| 118 | endif |
| 119 | |
Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 120 | ifeq (${ARCH},aarch32) |
| 121 | $(error Error: AArch32 not supported on rpi3) |
| 122 | endif |
Ying-Chun Liu (PaulLiu) | d9f76e6 | 2018-06-10 02:00:27 +0800 | [diff] [blame] | 123 | |
| 124 | ifeq (${SPD},opteed) |
| 125 | BL2_SOURCES += \ |
| 126 | lib/optee/optee_utils.c |
| 127 | endif |
| 128 | |
| 129 | # Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images |
| 130 | # in the FIP if the platform requires. |
| 131 | ifneq ($(BL32_EXTRA1),) |
| 132 | $(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1)) |
| 133 | endif |
| 134 | ifneq ($(BL32_EXTRA2),) |
| 135 | $(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2)) |
| 136 | endif |
Ying-Chun Liu (PaulLiu) | 9128df6 | 2018-07-04 02:26:48 +0800 | [diff] [blame] | 137 | |
| 138 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 139 | |
| 140 | include drivers/auth/mbedtls/mbedtls_crypto.mk |
| 141 | include drivers/auth/mbedtls/mbedtls_x509.mk |
| 142 | |
| 143 | USE_TBBR_DEFS := 1 |
| 144 | |
| 145 | AUTH_SOURCES := drivers/auth/auth_mod.c \ |
| 146 | drivers/auth/crypto_mod.c \ |
| 147 | drivers/auth/img_parser_mod.c \ |
| 148 | drivers/auth/tbbr/tbbr_cot.c |
| 149 | |
| 150 | PLAT_INCLUDES += -Iinclude/bl1/tbbr |
| 151 | |
| 152 | BL1_SOURCES += ${AUTH_SOURCES} \ |
| 153 | bl1/tbbr/tbbr_img_desc.c \ |
| 154 | plat/common/tbbr/plat_tbbr.c \ |
| 155 | plat/rpi3/rpi3_trusted_boot.c \ |
| 156 | plat/rpi3/rpi3_rotpk.S |
| 157 | |
| 158 | BL2_SOURCES += ${AUTH_SOURCES} \ |
| 159 | plat/common/tbbr/plat_tbbr.c \ |
| 160 | plat/rpi3/rpi3_trusted_boot.c \ |
| 161 | plat/rpi3/rpi3_rotpk.S |
| 162 | |
| 163 | ROT_KEY = $(BUILD_PLAT)/rot_key.pem |
| 164 | ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin |
| 165 | |
| 166 | $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"')) |
| 167 | |
| 168 | $(BUILD_PLAT)/bl1/rpi3_rotpk.o: $(ROTPK_HASH) |
| 169 | $(BUILD_PLAT)/bl2/rpi3_rotpk.o: $(ROTPK_HASH) |
| 170 | |
| 171 | certificates: $(ROT_KEY) |
| 172 | |
| 173 | $(ROT_KEY): |
| 174 | @echo " OPENSSL $@" |
| 175 | $(Q)openssl genrsa 2048 > $@ 2>/dev/null |
| 176 | |
| 177 | $(ROTPK_HASH): $(ROT_KEY) |
| 178 | @echo " OPENSSL $@" |
| 179 | $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\ |
| 180 | openssl dgst -sha256 -binary > $@ 2>/dev/null |
| 181 | endif |