Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | # |
Chris Kay | c327370 | 2025-01-13 15:57:32 +0000 | [diff] [blame] | 2 | # Copyright (c) 2013-2025, Arm Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | # |
dp-arm | 82cb2c1 | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | # |
| 6 | |
Jeenu Viswambharan | e35c404 | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 7 | # |
Juan Castillo | aaa3e72 | 2014-06-30 11:41:46 +0100 | [diff] [blame] | 8 | # Trusted Firmware Version |
| 9 | # |
Soby Mathew | 1a0f112 | 2018-10-01 16:16:34 +0100 | [diff] [blame] | 10 | VERSION_MAJOR := 2 |
Govindraj Raja | 97a6de9 | 2025-05-07 13:51:45 -0500 | [diff] [blame] | 11 | VERSION_MINOR := 13 |
Yann Gautier | c25d1cc | 2024-02-08 18:40:27 +0100 | [diff] [blame] | 12 | # VERSION_PATCH is only used for LTS releases |
| 13 | VERSION_PATCH := 0 |
Yann Gautier | 055ebec | 2023-10-03 11:09:07 +0200 | [diff] [blame] | 14 | VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} |
Juan Castillo | aaa3e72 | 2014-06-30 11:41:46 +0100 | [diff] [blame] | 15 | |
Juan Castillo | 8815467 | 2015-10-22 11:34:44 +0100 | [diff] [blame] | 16 | # Default goal is build all images |
| 17 | .DEFAULT_GOAL := all |
| 18 | |
Douglas Raillard | 72fc70e | 2016-12-28 14:47:50 +0000 | [diff] [blame] | 19 | # Avoid any implicit propagation of command line variable definitions to |
| 20 | # sub-Makefiles, like CFLAGS that we reserved for the firmware images' |
| 21 | # usage. Other command line options like "-s" are still propagated as usual. |
| 22 | MAKEOVERRIDES = |
| 23 | |
Evan Lloyd | 231c147 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 24 | MAKE_HELPERS_DIRECTORY := make_helpers/ |
| 25 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Chris Kay | f4dd18c | 2024-06-04 00:04:48 +0000 | [diff] [blame] | 26 | include ${MAKE_HELPERS_DIRECTORY}build-rules.mk |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 27 | include ${MAKE_HELPERS_DIRECTORY}common.mk |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 28 | |
| 29 | ################################################################################ |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 30 | # Default values for build configurations, and their dependencies |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 31 | ################################################################################ |
Jeenu Viswambharan | e35c404 | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 32 | |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 33 | include ${MAKE_HELPERS_DIRECTORY}defaults.mk |
Yann Gautier | 422b181 | 2025-01-17 11:02:50 +0100 | [diff] [blame] | 34 | PLAT := ${DEFAULT_PLAT} |
Andrey Skvortsov | 1b2fb6a | 2024-02-18 11:43:12 +0300 | [diff] [blame] | 35 | include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk |
| 36 | |
| 37 | # To be able to set platform specific defaults |
| 38 | ifneq ($(PLAT_DEFAULTS_MAKEFILE_FULL),) |
| 39 | include ${PLAT_DEFAULTS_MAKEFILE_FULL} |
| 40 | endif |
dp-arm | 872be88 | 2016-09-19 11:18:44 +0100 | [diff] [blame] | 41 | |
Chris Kay | cc277de | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 42 | ################################################################################ |
| 43 | # Configure the toolchains used to build TF-A and its tools |
| 44 | ################################################################################ |
| 45 | |
| 46 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
| 47 | |
Antonio Nino Diaz | cc8b563 | 2017-04-18 15:16:05 +0100 | [diff] [blame] | 48 | # Assertions enabled for DEBUG builds by default |
Antonio Nino Diaz | cc8b563 | 2017-04-18 15:16:05 +0100 | [diff] [blame] | 49 | ENABLE_ASSERTIONS := ${DEBUG} |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 50 | ENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 51 | |
| 52 | ################################################################################ |
| 53 | # Checkpatch script options |
| 54 | ################################################################################ |
| 55 | |
Sandrine Bailleux | f607739 | 2016-06-02 11:19:59 +0100 | [diff] [blame] | 56 | CHECKCODE_ARGS := --no-patch |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 57 | # Do not check the coding style on imported library files or documentation files |
Gilad Ben-Yossef | 4501843 | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 58 | INC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 59 | include/drivers/arm, \ |
| 60 | $(wildcard include/drivers/*))) |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 61 | INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 62 | include/lib/libfdt \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 63 | include/lib/libc, \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 64 | $(wildcard include/lib/*))) |
| 65 | INC_DIRS_TO_CHECK := $(sort $(filter-out \ |
Gilad Ben-Yossef | 4501843 | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 66 | include/lib \ |
| 67 | include/drivers, \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 68 | $(wildcard include/*))) |
| 69 | LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
dp-arm | d801fbb | 2017-05-04 12:15:35 +0100 | [diff] [blame] | 70 | lib/compiler-rt \ |
Antonio Nino Diaz | 55cdcf7 | 2017-01-16 17:20:45 +0000 | [diff] [blame] | 71 | lib/libfdt% \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 72 | lib/libc, \ |
Daniel Boulby | a194255 | 2022-10-05 11:05:22 +0100 | [diff] [blame] | 73 | lib/zlib \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 74 | $(wildcard lib/*))) |
| 75 | ROOT_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 76 | lib \ |
| 77 | include \ |
| 78 | docs \ |
Paul Beesley | 1ef3551 | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 79 | %.rst, \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 80 | $(wildcard *))) |
| 81 | CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ |
| 82 | ${INC_DIRS_TO_CHECK} \ |
| 83 | ${INC_LIB_DIRS_TO_CHECK} \ |
Gilad Ben-Yossef | 4501843 | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 84 | ${LIB_DIRS_TO_CHECK} \ |
| 85 | ${INC_DRV_DIRS_TO_CHECK} \ |
| 86 | ${INC_ARM_DIRS_TO_CHECK} |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 87 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 88 | ################################################################################ |
| 89 | # Process build options |
| 90 | ################################################################################ |
| 91 | |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 92 | ifeq ($(verbose),) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 93 | CHECKCODE_ARGS += --no-summary --terse |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 94 | endif |
Andre Przywara | ee1ba6d | 2018-09-27 10:56:05 +0100 | [diff] [blame] | 95 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 96 | ################################################################################ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 97 | # Auxiliary tools (fiptool, cert_create, etc) |
| 98 | ################################################################################ |
| 99 | |
| 100 | # Variables for use with Certificate Generation Tool |
| 101 | CRTTOOLPATH ?= tools/cert_create |
Chris Kay | c327370 | 2025-01-13 15:57:32 +0000 | [diff] [blame] | 102 | CRTTOOL ?= ${CRTTOOLPATH}/cert_create$(.exe) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 103 | |
| 104 | # Variables for use with Firmware Encryption Tool |
| 105 | ENCTOOLPATH ?= tools/encrypt_fw |
Chris Kay | c327370 | 2025-01-13 15:57:32 +0000 | [diff] [blame] | 106 | ENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw$(.exe) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 107 | |
| 108 | # Variables for use with Firmware Image Package |
| 109 | FIPTOOLPATH ?= tools/fiptool |
Chris Kay | c327370 | 2025-01-13 15:57:32 +0000 | [diff] [blame] | 110 | FIPTOOL ?= ${FIPTOOLPATH}/fiptool$(.exe) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 111 | |
| 112 | # Variables for use with sptool |
| 113 | SPTOOLPATH ?= tools/sptool |
| 114 | SPTOOL ?= ${SPTOOLPATH}/sptool.py |
| 115 | SP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py |
Karl Meakin | 20629b3 | 2023-02-14 11:56:02 +0000 | [diff] [blame] | 116 | SP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 117 | |
J-Alves | 0fe374e | 2024-11-18 17:49:53 +0000 | [diff] [blame] | 118 | # Variables for use with sptool |
| 119 | TLCTOOL ?= poetry run tlc |
| 120 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 121 | # Variables for use with ROMLIB |
| 122 | ROMLIBPATH ?= lib/romlib |
| 123 | |
| 124 | # Variable for use with Python |
| 125 | PYTHON ?= python3 |
| 126 | |
| 127 | # Variables for use with documentation build using Sphinx tool |
| 128 | DOCS_PATH ?= docs |
| 129 | |
| 130 | ################################################################################ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 131 | # Compiler Configuration based on ARCH_MAJOR and ARCH_MINOR flags |
| 132 | ################################################################################ |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 133 | ifeq (${ARM_ARCH_MAJOR},7) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 134 | target32-directive = -target arm-none-eabi |
Govindraj Raja | d4089fb | 2023-05-30 16:52:15 -0500 | [diff] [blame] | 135 | # Will set march-directive from platform configuration |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 136 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 137 | target32-directive = -target armv8a-none-eabi |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 138 | endif #(ARM_ARCH_MAJOR) |
| 139 | |
| 140 | ################################################################################ |
| 141 | # Get Architecture Feature Modifiers |
| 142 | ################################################################################ |
| 143 | arch-features = ${ARM_ARCH_FEATURE} |
| 144 | |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 145 | ifneq ($(filter %-clang,$($(ARCH)-cc-id)),) |
| 146 | ifeq ($($(ARCH)-cc-id),arm-clang) |
Govindraj Raja | 7794d6c | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 147 | TF_CFLAGS_aarch32 := -target arm-arm-none-eabi |
| 148 | TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi |
origin | c8a992f | 2022-01-19 16:30:14 +0000 | [diff] [blame] | 149 | else |
Govindraj Raja | 7794d6c | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 150 | TF_CFLAGS_aarch32 = $(target32-directive) |
Yann Gautier | af8947f | 2025-01-22 09:43:47 +0100 | [diff] [blame] | 151 | TF_CFLAGS_aarch64 := -target aarch64-unknown-none-elf |
origin | c8a992f | 2022-01-19 16:30:14 +0000 | [diff] [blame] | 152 | endif |
| 153 | |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 154 | else ifeq ($($(ARCH)-cc-id),gnu-gcc) |
Chris Kay | fa402f3 | 2024-02-20 16:19:54 +0000 | [diff] [blame] | 155 | # Enable LTO only for aarch64 |
| 156 | ifeq (${ARCH},aarch64) |
| 157 | LTO_CFLAGS = $(if $(filter-out 0,$(ENABLE_LTO)),-flto) |
zelalem-aweke | edbce9a | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 158 | endif |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 159 | endif #(clang) |
dp-arm | d546185 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 160 | |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 161 | # Process Debug flag |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 162 | ifneq (${DEBUG}, 0) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 163 | BUILD_TYPE := debug |
| 164 | TF_CFLAGS += -g -gdwarf-4 |
| 165 | ASFLAGS += -g -Wa,-gdwarf-4 |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 166 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 167 | # Use LOG_LEVEL_INFO by default for debug builds |
| 168 | LOG_LEVEL := 40 |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 169 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 170 | BUILD_TYPE := release |
| 171 | # Use LOG_LEVEL_NOTICE by default for release builds |
| 172 | LOG_LEVEL := 20 |
| 173 | endif #(Debug) |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 174 | |
Peiyuan Song | f1de4c8 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 175 | # Default build string (git branch and commit) |
| 176 | ifeq (${BUILD_STRING},) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 177 | BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) |
Peiyuan Song | f1de4c8 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 178 | endif |
laurenw-arm | dddf428 | 2022-07-12 10:12:05 -0500 | [diff] [blame] | 179 | VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} |
Peiyuan Song | f1de4c8 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 180 | |
Antonio Nino Diaz | 8fd9d4d | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 181 | ifeq (${AARCH32_INSTRUCTION_SET},A32) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 182 | TF_CFLAGS_aarch32 += -marm |
Antonio Nino Diaz | 8fd9d4d | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 183 | else ifeq (${AARCH32_INSTRUCTION_SET},T32) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 184 | TF_CFLAGS_aarch32 += -mthumb |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 185 | endif #(AARCH32_INSTRUCTION_SET) |
Antonio Nino Diaz | 8fd9d4d | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 186 | |
Sandrine Bailleux | a9c4dde | 2018-07-03 09:14:45 +0200 | [diff] [blame] | 187 | TF_CFLAGS_aarch32 += -mno-unaligned-access |
dp-arm | d546185 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 188 | TF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 189 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 190 | ############################################################################## |
| 191 | # WARNINGS Configuration |
| 192 | ############################################################################### |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 193 | # General warnings |
| 194 | WARNINGS := -Wall -Wmissing-include-dirs -Wunused \ |
Yann Gautier | 34b508b | 2021-05-20 13:18:14 +0200 | [diff] [blame] | 195 | -Wdisabled-optimization -Wvla -Wshadow \ |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 196 | -Wredundant-decls |
| 197 | # stricter warnings |
| 198 | WARNINGS += -Wextra -Wno-trigraphs |
| 199 | # too verbose for generic build |
| 200 | WARNINGS += -Wno-missing-field-initializers \ |
| 201 | -Wno-type-limits -Wno-sign-compare \ |
| 202 | # on clang this flag gets reset if -Wextra is set after it. No difference on gcc |
| 203 | WARNINGS += -Wno-unused-parameter |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 204 | |
| 205 | # Additional warnings |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 206 | # Level 1 - infrequent warnings we should have none of |
| 207 | # full -Wextra |
| 208 | WARNING1 += -Wsign-compare |
| 209 | WARNING1 += -Wtype-limits |
| 210 | WARNING1 += -Wmissing-field-initializers |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 211 | |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 212 | # Level 2 - problematic warnings that we want |
| 213 | # zlib, compiler-rt, coreboot, and mbdedtls blow up with these |
| 214 | # TODO: disable just for them and move into default build |
| 215 | WARNING2 += -Wold-style-definition |
| 216 | WARNING2 += -Wmissing-prototypes |
| 217 | WARNING2 += -Wmissing-format-attribute |
| 218 | # TF-A aims to comply with this eventually. Effort too large at present |
| 219 | WARNING2 += -Wundef |
Boyan Karatotev | d141e63 | 2022-11-21 14:49:05 +0000 | [diff] [blame] | 220 | # currently very involved and many platforms set this off |
| 221 | WARNING2 += -Wunused-const-variable=2 |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 222 | |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 223 | # Level 3 - very pedantic, frequently ignored |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 224 | WARNING3 := -Wbad-function-cast |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 225 | WARNING3 += -Waggregate-return |
| 226 | WARNING3 += -Wnested-externs |
| 227 | WARNING3 += -Wcast-align |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 228 | WARNING3 += -Wcast-qual |
| 229 | WARNING3 += -Wconversion |
| 230 | WARNING3 += -Wpacked |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 231 | WARNING3 += -Wpointer-arith |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 232 | WARNING3 += -Wswitch-default |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 233 | |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 234 | # Setting W is quite verbose and most warnings will be pre-existing issues |
| 235 | # outside of the contributor's control. Don't fail the build on them so warnings |
| 236 | # can be seen and hopefully addressed |
| 237 | ifdef W |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 238 | ifneq (${W},0) |
| 239 | E ?= 0 |
| 240 | endif |
Boyan Karatotev | d75a9ec | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 241 | endif |
| 242 | |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 243 | ifeq (${W},1) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 244 | WARNINGS += $(WARNING1) |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 245 | else ifeq (${W},2) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 246 | WARNINGS += $(WARNING1) $(WARNING2) |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 247 | else ifeq (${W},3) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 248 | WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) |
| 249 | endif #(W) |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 250 | |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 251 | # Compiler specific warnings |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 252 | ifeq ($(filter %-clang,$($(ARCH)-cc-id)),) |
Justin Chadwell | 93c690e | 2019-07-03 14:15:56 +0100 | [diff] [blame] | 253 | # not using clang |
Justin Chadwell | d7b4cd4 | 2019-09-18 14:13:42 +0100 | [diff] [blame] | 254 | WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ |
| 255 | -Wpacked-bitfield-compat -Wshift-overflow=2 \ |
| 256 | -Wlogical-op |
Govindraj Raja | dea23e2 | 2023-05-05 09:09:36 -0500 | [diff] [blame] | 257 | |
| 258 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 |
Boyan Karatotev | 316f5c9 | 2024-10-10 13:54:37 +0100 | [diff] [blame] | 259 | TF_CFLAGS_MIN_PAGE_SIZE := $(call cc_option, --param=min-pagesize=0) |
| 260 | TF_CFLAGS += $(TF_CFLAGS_MIN_PAGE_SIZE) |
Govindraj Raja | dea23e2 | 2023-05-05 09:09:36 -0500 | [diff] [blame] | 261 | |
Bipin Ravi | 538516f | 2023-09-28 13:17:24 -0500 | [diff] [blame] | 262 | ifeq ($(HARDEN_SLS), 1) |
Boyan Karatotev | 316f5c9 | 2024-10-10 13:54:37 +0100 | [diff] [blame] | 263 | TF_CFLAGS_MHARDEN_SLS := $(call cc_option, -mharden-sls=all) |
| 264 | TF_CFLAGS_aarch64 += $(TF_CFLAGS_MHARDEN_SLS) |
Bipin Ravi | 538516f | 2023-09-28 13:17:24 -0500 | [diff] [blame] | 265 | endif |
| 266 | |
Justin Chadwell | 93c690e | 2019-07-03 14:15:56 +0100 | [diff] [blame] | 267 | else |
| 268 | # using clang |
Justin Chadwell | d7b4cd4 | 2019-09-18 14:13:42 +0100 | [diff] [blame] | 269 | WARNINGS += -Wshift-overflow -Wshift-sign-overflow \ |
| 270 | -Wlogical-op-parentheses |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 271 | endif #(Clang Warning) |
Ambroise Vincent | 0029657 | 2019-05-24 12:47:43 +0100 | [diff] [blame] | 272 | |
Yann Gautier | 6336b07 | 2018-12-10 18:08:53 +0100 | [diff] [blame] | 273 | ifneq (${E},0) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 274 | ERRORS := -Werror |
| 275 | endif #(E) |
Yann Gautier | 6336b07 | 2018-12-10 18:08:53 +0100 | [diff] [blame] | 276 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 277 | ################################################################################ |
| 278 | # Compiler and Linker Directives |
| 279 | ################################################################################ |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 280 | CPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ |
| 281 | $(ERRORS) $(WARNINGS) |
Govindraj Raja | d4089fb | 2023-05-30 16:52:15 -0500 | [diff] [blame] | 282 | ASFLAGS += $(CPPFLAGS) \ |
Julius Werner | d5dfdeb | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 283 | -ffreestanding -Wa,--fatal-warnings |
Masahiro Yamada | 59de509 | 2016-12-22 12:51:53 +0900 | [diff] [blame] | 284 | TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ |
Samuel Holland | ebd6efa | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 285 | -ffunction-sections -fdata-sections \ |
Boyan Karatotev | ee0c5b8 | 2024-12-09 08:24:12 +0000 | [diff] [blame] | 286 | -ffreestanding -fno-common \ |
Samuel Holland | ebd6efa | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 287 | -Os -std=gnu99 |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 288 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 289 | ifeq (${SANITIZE_UB},on) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 290 | TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover |
| 291 | endif #(${SANITIZE_UB},on) |
| 292 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 293 | ifeq (${SANITIZE_UB},trap) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 294 | TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 295 | -fsanitize-undefined-trap-on-error |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 296 | endif #(${SANITIZE_UB},trap) |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 297 | |
Chris Kay | 291e718 | 2024-05-14 13:08:31 +0000 | [diff] [blame] | 298 | GCC_V_OUTPUT := $(if $($(ARCH)-cc),$(shell $($(ARCH)-cc) -v 2>&1)) |
david cunado | f7ec31d | 2017-11-30 21:58:01 +0000 | [diff] [blame] | 299 | |
Marco Felsch | 1f49db5 | 2022-11-09 12:59:09 +0100 | [diff] [blame] | 300 | TF_LDFLAGS += -z noexecstack |
| 301 | |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 302 | # LD = armlink |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 303 | ifeq ($($(ARCH)-ld-id),arm-link) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 304 | TF_LDFLAGS += --diag_error=warning --lto_level=O1 |
| 305 | TF_LDFLAGS += --remove --info=unused,unusedsymbols |
| 306 | TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 307 | |
| 308 | # LD = gcc (used when GCC LTO is enabled) |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 309 | else ifeq ($($(ARCH)-ld-id),gnu-gcc) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 310 | # Pass ld options with Wl or Xlinker switches |
Chris Kay | 86e489c | 2024-01-16 11:53:35 +0000 | [diff] [blame] | 311 | TF_LDFLAGS += $(call ld_option,-Xlinker --no-warn-rwx-segments) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 312 | TF_LDFLAGS += -Wl,--fatal-warnings -O1 |
| 313 | TF_LDFLAGS += -Wl,--gc-sections |
Chris Kay | ac98b82 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 314 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 315 | TF_LDFLAGS += -Wl,-z,common-page-size=4096 #Configure page size constants |
| 316 | TF_LDFLAGS += -Wl,-z,max-page-size=4096 |
Andrey Skvortsov | 304ad94 | 2023-09-05 23:06:29 +0300 | [diff] [blame] | 317 | TF_LDFLAGS += -Wl,--build-id=none |
Chris Kay | ac98b82 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 318 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 319 | ifeq ($(ENABLE_LTO),1) |
| 320 | ifeq (${ARCH},aarch64) |
| 321 | TF_LDFLAGS += -flto -fuse-linker-plugin |
Andrey Skvortsov | 31f80ef | 2023-12-08 18:04:51 +0300 | [diff] [blame] | 322 | TF_LDFLAGS += -flto-partition=one |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 323 | endif |
| 324 | endif #(ENABLE_LTO) |
| 325 | |
zelalem-aweke | edbce9a | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 326 | # GCC automatically adds fix-cortex-a53-843419 flag when used to link |
| 327 | # which breaks some builds, so disable if errata fix is not explicitly enabled |
Yann Gautier | cfe6767 | 2023-03-15 16:18:16 +0100 | [diff] [blame] | 328 | ifeq (${ARCH},aarch64) |
| 329 | ifneq (${ERRATA_A53_843419},1) |
| 330 | TF_LDFLAGS += -mno-fix-cortex-a53-843419 |
| 331 | endif |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 332 | endif |
| 333 | TF_LDFLAGS += -nostdlib |
| 334 | TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 335 | |
| 336 | # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 337 | else |
Marco Felsch | 1f49db5 | 2022-11-09 12:59:09 +0100 | [diff] [blame] | 338 | # With ld.bfd version 2.39 and newer new warnings are added. Skip those since we |
| 339 | # are not loaded by a elf loader. |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 340 | TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) |
| 341 | TF_LDFLAGS += -O1 |
| 342 | TF_LDFLAGS += --gc-sections |
Chris Kay | ac98b82 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 343 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 344 | TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants |
| 345 | TF_LDFLAGS += -z max-page-size=4096 |
Andrey Skvortsov | 304ad94 | 2023-09-05 23:06:29 +0300 | [diff] [blame] | 346 | TF_LDFLAGS += --build-id=none |
Chris Kay | ac98b82 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 347 | |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 348 | # ld.lld doesn't recognize the errata flags, |
Yabin Cui | ebac692 | 2023-01-19 20:06:04 +0000 | [diff] [blame] | 349 | # therefore don't add those in that case. |
| 350 | # ld.lld reports section type mismatch warnings, |
| 351 | # therefore don't add --fatal-warnings to it. |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 352 | ifneq ($($(ARCH)-ld-id),llvm-lld) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 353 | TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings |
| 354 | endif |
| 355 | |
| 356 | endif #(LD = armlink) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 357 | |
| 358 | ################################################################################ |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 359 | # Setup ARCH_MAJOR/MINOR before parsing arch_features. |
| 360 | ################################################################################ |
| 361 | ifeq (${ENABLE_RME},1) |
AlexeiFedorov | 7d5fc98 | 2024-03-13 11:53:44 +0000 | [diff] [blame] | 362 | ARM_ARCH_MAJOR := 9 |
| 363 | ARM_ARCH_MINOR := 2 |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 364 | endif |
| 365 | |
| 366 | ################################################################################ |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 367 | # Common sources and include directories |
| 368 | ################################################################################ |
dp-arm | d801fbb | 2017-05-04 12:15:35 +0100 | [diff] [blame] | 369 | include lib/compiler-rt/compiler-rt.mk |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 370 | |
Chris Kay | 758ccb8 | 2024-03-08 16:08:31 +0000 | [diff] [blame] | 371 | # Allow overriding the timestamp, for example for reproducible builds, or to |
| 372 | # synchronize timestamps across multiple projects. |
| 373 | # This must be set to a C string (including quotes where applicable). |
| 374 | BUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__ |
| 375 | |
| 376 | DEFINES += -DBUILD_MESSAGE_TIMESTAMP='$(BUILD_MESSAGE_TIMESTAMP)' |
| 377 | DEFINES += -DBUILD_MESSAGE_VERSION_STRING='"$(VERSION_STRING)"' |
| 378 | DEFINES += -DBUILD_MESSAGE_VERSION='"$(VERSION)"' |
| 379 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 380 | BL_COMMON_SOURCES += common/bl_common.c \ |
Soby Mathew | 7f56e9a | 2017-09-04 11:49:29 +0100 | [diff] [blame] | 381 | common/tf_log.c \ |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 382 | common/${ARCH}/debug.S \ |
Julius Werner | 91b48c9 | 2018-11-27 22:10:56 -0800 | [diff] [blame] | 383 | drivers/console/multi_console.c \ |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 384 | lib/${ARCH}/cache_helpers.S \ |
| 385 | lib/${ARCH}/misc_helpers.S \ |
Boyan Karatotev | c73686a | 2023-02-15 13:21:50 +0000 | [diff] [blame] | 386 | lib/extensions/pmuv3/${ARCH}/pmuv3.c \ |
Soby Mathew | 566034f | 2018-02-08 17:45:12 +0000 | [diff] [blame] | 387 | plat/common/plat_bl_common.c \ |
Soby Mathew | 7f56e9a | 2017-09-04 11:49:29 +0100 | [diff] [blame] | 388 | plat/common/plat_log_common.c \ |
dp-arm | 7531120 | 2017-03-07 11:02:47 +0000 | [diff] [blame] | 389 | plat/common/${ARCH}/plat_common.c \ |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 390 | plat/common/${ARCH}/platform_helpers.S \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 391 | ${COMPILER_RT_SRCS} |
Ryan Harkin | d7a6b0f | 2014-01-13 14:40:13 +0000 | [diff] [blame] | 392 | |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 393 | ifeq ($($(ARCH)-cc-id),arm-clang) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 394 | BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S |
Antonio Nino Diaz | 8422a84 | 2018-08-16 15:42:44 +0100 | [diff] [blame] | 395 | endif |
| 396 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 397 | ifeq (${SANITIZE_UB},on) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 398 | BL_COMMON_SOURCES += plat/common/ubsan.c |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 399 | endif |
| 400 | |
Yann Gautier | 01d237c | 2018-06-18 16:00:23 +0200 | [diff] [blame] | 401 | INCLUDES += -Iinclude \ |
Antonio Nino Diaz | f5478de | 2018-12-17 17:20:57 +0000 | [diff] [blame] | 402 | -Iinclude/arch/${ARCH} \ |
Antonio Nino Diaz | 09d40e0 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 403 | -Iinclude/lib/cpus/${ARCH} \ |
| 404 | -Iinclude/lib/el3_runtime/${ARCH} \ |
| 405 | ${PLAT_INCLUDES} \ |
| 406 | ${SPD_INCLUDES} |
| 407 | |
Nishant Sharma | e03dcc8 | 2022-08-15 16:37:07 +0100 | [diff] [blame] | 408 | DTC_FLAGS += -I dts -O dtb |
| 409 | DTC_CPPFLAGS += -P -nostdinc $(INCLUDES) -Ifdts -undef \ |
| 410 | -x assembler-with-cpp $(DEFINES) |
| 411 | |
Antonio Nino Diaz | 9c6d1c5 | 2018-11-19 11:48:30 +0000 | [diff] [blame] | 412 | include common/backtrace/backtrace.mk |
| 413 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 414 | ################################################################################ |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 415 | # Generic definitions |
| 416 | ################################################################################ |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 417 | |
| 418 | ifeq (${BUILD_BASE},) |
| 419 | BUILD_BASE := ./build |
| 420 | endif |
| 421 | BUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} |
| 422 | |
| 423 | SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) |
| 424 | |
| 425 | # Platforms providing their own TBB makefile may override this value |
| 426 | INCLUDE_TBBR_MK := 1 |
| 427 | |
| 428 | ################################################################################ |
| 429 | # Include SPD Makefile if one has been specified |
| 430 | ################################################################################ |
| 431 | |
| 432 | ifneq (${SPD},none) |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 433 | ifeq (${SPD},spmd) |
| 434 | # SPMD is located in std_svc directory |
| 435 | SPD_DIR := std_svc |
| 436 | |
| 437 | ifeq ($(SPMD_SPM_AT_SEL2),1) |
| 438 | CTX_INCLUDE_EL2_REGS := 1 |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 439 | endif |
| 440 | |
| 441 | ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) |
| 442 | DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG |
| 443 | endif |
| 444 | |
Arunachalam Ganapathy | 0686a01 | 2022-04-11 14:36:54 +0100 | [diff] [blame] | 445 | ifeq ($(findstring trusty_sp,$(ARM_SPMC_MANIFEST_DTS)),trusty_sp) |
| 446 | DTC_CPPFLAGS += -DTRUSTY_SP_FW_CONFIG |
| 447 | endif |
| 448 | |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 449 | ifeq ($(TS_SP_FW_CONFIG),1) |
Arunachalam Ganapathy | 0686a01 | 2022-04-11 14:36:54 +0100 | [diff] [blame] | 450 | DTC_CPPFLAGS += -DTS_SP_FW_CONFIG |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 451 | endif |
| 452 | |
| 453 | ifneq ($(ARM_BL2_SP_LIST_DTS),) |
| 454 | DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) |
| 455 | endif |
| 456 | |
| 457 | ifneq ($(SP_LAYOUT_FILE),) |
| 458 | BL2_ENABLE_SP_LOAD := 1 |
| 459 | endif |
| 460 | else |
| 461 | # All other SPDs in spd directory |
| 462 | SPD_DIR := spd |
| 463 | endif #(SPD) |
| 464 | |
| 465 | # We expect to locate an spd.mk under the specified SPD directory |
| 466 | SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) |
| 467 | |
| 468 | ifeq (${SPD_MAKE},) |
| 469 | $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) |
| 470 | endif |
| 471 | $(info Including ${SPD_MAKE}) |
| 472 | include ${SPD_MAKE} |
| 473 | |
| 474 | # If there's BL32 companion for the chosen SPD, we expect that the SPD's |
| 475 | # Makefile would set NEED_BL32 to "yes". In this case, the build system |
| 476 | # supports two mutually exclusive options: |
| 477 | # * BL32 is built from source: then BL32_SOURCES must contain the list |
| 478 | # of source files to build BL32 |
| 479 | # * BL32 is a prebuilt binary: then BL32 must point to the image file |
| 480 | # that will be included in the FIP |
| 481 | # If both BL32_SOURCES and BL32 are defined, the binary takes precedence |
| 482 | # over the sources. |
| 483 | endif #(SPD=none) |
| 484 | |
Govindraj Raja | 3547270 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 485 | ################################################################################ |
Olivier Deprez | 696ed16 | 2025-01-03 13:38:50 +0100 | [diff] [blame] | 486 | # Include the platform specific Makefile after the SPD Makefile (the platform |
| 487 | # makefile may use all previous definitions in this file) |
| 488 | ################################################################################ |
| 489 | include ${PLAT_MAKEFILE_FULL} |
| 490 | |
| 491 | ################################################################################ |
Boyan Karatotev | 8d9f5f2 | 2025-04-02 11:16:18 +0100 | [diff] [blame] | 492 | # Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from |
| 493 | # platform. |
| 494 | ################################################################################ |
| 495 | |
| 496 | include ${MAKE_HELPERS_DIRECTORY}arch_features.mk |
| 497 | ################################################################################ |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 498 | # Process BRANCH_PROTECTION value and set |
| 499 | # Pointer Authentication and Branch Target Identification flags |
| 500 | ################################################################################ |
| 501 | ifeq (${BRANCH_PROTECTION},0) |
| 502 | # Default value turns off all types of branch protection |
| 503 | BP_OPTION := none |
| 504 | else ifneq (${ARCH},aarch64) |
| 505 | $(error BRANCH_PROTECTION requires AArch64) |
| 506 | else ifeq (${BRANCH_PROTECTION},1) |
| 507 | # Enables all types of branch protection features |
| 508 | BP_OPTION := standard |
| 509 | ENABLE_BTI := 1 |
| 510 | ENABLE_PAUTH := 1 |
| 511 | else ifeq (${BRANCH_PROTECTION},2) |
| 512 | # Return address signing to its standard level |
| 513 | BP_OPTION := pac-ret |
| 514 | ENABLE_PAUTH := 1 |
| 515 | else ifeq (${BRANCH_PROTECTION},3) |
| 516 | # Extend the signing to include leaf functions |
| 517 | BP_OPTION := pac-ret+leaf |
| 518 | ENABLE_PAUTH := 1 |
| 519 | else ifeq (${BRANCH_PROTECTION},4) |
| 520 | # Turn on branch target identification mechanism |
| 521 | BP_OPTION := bti |
| 522 | ENABLE_BTI := 1 |
Boyan Karatotev | 8d9f5f2 | 2025-04-02 11:16:18 +0100 | [diff] [blame] | 523 | else ifeq (${BRANCH_PROTECTION},5) |
| 524 | # Turn on branch target identification mechanism |
| 525 | BP_OPTION := standard |
| 526 | ENABLE_BTI := 2 |
| 527 | ENABLE_PAUTH := 2 |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 528 | else |
| 529 | $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) |
| 530 | endif #(BRANCH_PROTECTION) |
| 531 | |
Boyan Karatotev | 8d9f5f2 | 2025-04-02 11:16:18 +0100 | [diff] [blame] | 532 | ifneq ($(ENABLE_PAUTH),0) |
| 533 | CTX_INCLUDE_PAUTH_REGS := ${ENABLE_PAUTH} |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 534 | endif |
| 535 | ifneq (${BP_OPTION},none) |
| 536 | TF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} |
| 537 | endif #(BP_OPTION) |
| 538 | |
| 539 | # Pointer Authentication sources |
Boyan Karatotev | 8d9f5f2 | 2025-04-02 11:16:18 +0100 | [diff] [blame] | 540 | ifneq (${ENABLE_PAUTH},0) |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 541 | # arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the |
| 542 | # Pauth support. As it's not secure, it must be reimplemented for real platforms |
Boyan Karatotev | 8d9f5f2 | 2025-04-02 11:16:18 +0100 | [diff] [blame] | 543 | BL_COMMON_SOURCES += lib/extensions/pauth/pauth.c |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 544 | endif |
Boyan Karatotev | b14987c | 2025-04-09 14:41:58 +0100 | [diff] [blame] | 545 | # |
| 546 | ifneq (${ENABLE_FEAT_PAUTH_LR},0) |
| 547 | # Currently, FEAT_PAUTH_LR is only supported by arm/clang compilers |
| 548 | # TODO implement for GCC when support is added |
| 549 | ifeq ($($(ARCH)-cc-id),arm-clang) |
| 550 | arch-features := $(arch-features)+pauth-lr |
| 551 | else |
| 552 | $(error Error: ENABLE_FEAT_PAUTH_LR not supported for GCC compiler) |
| 553 | endif |
| 554 | endif |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 555 | |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 556 | ################################################################################ |
| 557 | # RME dependent flags configuration, Enable optional features for RME. |
| 558 | ################################################################################ |
| 559 | # FEAT_RME |
| 560 | ifeq (${ENABLE_RME},1) |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 561 | # RME requires el2 context to be saved for now. |
| 562 | CTX_INCLUDE_EL2_REGS := 1 |
| 563 | CTX_INCLUDE_AARCH32_REGS := 0 |
| 564 | CTX_INCLUDE_PAUTH_REGS := 1 |
| 565 | |
Javier Almansa Sobrino | d048af0 | 2025-03-21 18:32:10 +0000 | [diff] [blame] | 566 | ifneq ($(ENABLE_FEAT_MPAM), 0) |
| 567 | CTX_INCLUDE_MPAM_REGS := 1 |
| 568 | endif |
| 569 | |
Govindraj Raja | f521142 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 570 | # RME enables CSV2_2 extension by default. |
| 571 | ENABLE_FEAT_CSV2_2 = 1 |
| 572 | endif #(FEAT_RME) |
| 573 | |
| 574 | ################################################################################ |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 575 | # Include rmmd Makefile if RME is enabled |
| 576 | ################################################################################ |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 577 | ifneq (${ENABLE_RME},0) |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 578 | include services/std_svc/rmmd/rmmd.mk |
| 579 | $(warning "RME is an experimental feature") |
| 580 | endif |
| 581 | |
Tushar Khandelwal | 7e84f3c | 2024-03-15 15:00:29 +0000 | [diff] [blame] | 582 | ################################################################################ |
Govindraj Raja | 3065513 | 2024-09-06 15:43:43 +0100 | [diff] [blame] | 583 | # Make 128-Bit sysreg read/writes availabe when FEAT_D128 is enabled. |
| 584 | ################################################################################ |
| 585 | ifneq (${ENABLE_FEAT_D128}, 0) |
| 586 | BL_COMMON_SOURCES += lib/extensions/sysreg128/sysreg128.S |
| 587 | endif |
| 588 | |
| 589 | ################################################################################ |
Govindraj Raja | 7794d6c | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 590 | # Platform specific Makefile might provide us ARCH_MAJOR/MINOR use that to come |
| 591 | # up with appropriate march values for compiler. |
| 592 | ################################################################################ |
| 593 | include ${MAKE_HELPERS_DIRECTORY}march.mk |
| 594 | |
John Powell | 025b1b8 | 2025-03-10 20:09:03 -0500 | [diff] [blame] | 595 | TF_CFLAGS += $(march-directive) |
Govindraj Raja | 7275ac2 | 2024-01-23 16:00:19 -0600 | [diff] [blame] | 596 | ASFLAGS += $(march-directive) |
Govindraj Raja | 7794d6c | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 597 | |
Arvind Ram Prakash | 42d4d3b | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 598 | # This internal flag is common option which is set to 1 for scenarios |
| 599 | # when the BL2 is running in EL3 level. This occurs in two scenarios - |
| 600 | # 4 world system running BL2 at EL3 and two world system without BL1 running |
| 601 | # BL2 in EL3 |
| 602 | |
| 603 | ifeq (${RESET_TO_BL2},1) |
| 604 | BL2_RUNS_AT_EL3 := 1 |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 605 | ifeq (${ENABLE_RME},1) |
| 606 | $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not \ |
| 607 | supported at the moment.) |
| 608 | endif |
Arvind Ram Prakash | 42d4d3b | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 609 | else ifeq (${ENABLE_RME},1) |
| 610 | BL2_RUNS_AT_EL3 := 1 |
| 611 | else |
| 612 | BL2_RUNS_AT_EL3 := 0 |
| 613 | endif |
| 614 | |
Manish Pandey | f87e54f | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 615 | # This internal flag is set to 1 when Firmware First handling of External aborts |
| 616 | # is required by lowe ELs. Currently only NS requires this support. |
| 617 | ifeq ($(HANDLE_EA_EL3_FIRST_NS),1) |
| 618 | FFH_SUPPORT := 1 |
| 619 | else |
| 620 | FFH_SUPPORT := 0 |
| 621 | endif |
| 622 | |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 623 | ifeq (${ARM_ARCH_MAJOR},7) |
| 624 | include make_helpers/armv7-a-cpus.mk |
| 625 | endif |
| 626 | |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 627 | PIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) |
| 628 | ifneq ($(PIE_FOUND),) |
| 629 | TF_CFLAGS += -fno-PIE |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 630 | ifeq ($($(ARCH)-ld-id),gnu-gcc) |
Samuel Holland | 7b59241 | 2022-04-08 21:56:02 -0500 | [diff] [blame] | 631 | TF_LDFLAGS += -no-pie |
| 632 | endif |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 633 | endif #(PIE_FOUND) |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 634 | |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 635 | ifeq ($($(ARCH)-ld-id),gnu-gcc) |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 636 | PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker |
Soby Mathew | 3bd17c0 | 2018-08-28 11:13:55 +0100 | [diff] [blame] | 637 | else |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 638 | PIE_LDFLAGS += -pie --no-dynamic-linker |
| 639 | endif |
| 640 | |
| 641 | ifeq ($(ENABLE_PIE),1) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 642 | ifeq ($(RESET_TO_BL2),1) |
| 643 | ifneq ($(BL2_IN_XIP_MEM),1) |
| 644 | BL2_CPPFLAGS += -fpie |
| 645 | BL2_CFLAGS += -fpie |
| 646 | BL2_LDFLAGS += $(PIE_LDFLAGS) |
| 647 | endif #(BL2_IN_XIP_MEM) |
| 648 | endif #(RESET_TO_BL2) |
Chris Kay | 966660e | 2023-02-02 14:39:03 +0000 | [diff] [blame] | 649 | BL31_CPPFLAGS += -fpie |
| 650 | BL31_CFLAGS += -fpie |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 651 | BL31_LDFLAGS += $(PIE_LDFLAGS) |
Chris Kay | 966660e | 2023-02-02 14:39:03 +0000 | [diff] [blame] | 652 | |
| 653 | BL32_CPPFLAGS += -fpie |
Masahiro Yamada | d974301 | 2020-01-17 13:45:14 +0900 | [diff] [blame] | 654 | BL32_CFLAGS += -fpie |
| 655 | BL32_LDFLAGS += $(PIE_LDFLAGS) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 656 | endif #(ENABLE_PIE) |
Soby Mathew | 3bd17c0 | 2018-08-28 11:13:55 +0100 | [diff] [blame] | 657 | |
Boyan Karatotev | 007433d | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 658 | BL1_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 659 | BL31_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 660 | BL32_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 661 | |
Masahiro Yamada | 9cefb4b | 2020-04-01 14:20:58 +0900 | [diff] [blame] | 662 | BL1_CPPFLAGS += -DIMAGE_AT_EL3 |
Arvind Ram Prakash | 42d4d3b | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 663 | ifeq ($(RESET_TO_BL2),1) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 664 | BL2_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | d5e97a1 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 665 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 666 | BL2_CPPFLAGS += -DIMAGE_AT_EL1 |
| 667 | endif #(RESET_TO_BL2) |
Boyan Karatotev | 007433d | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 668 | |
| 669 | ifeq (${ARCH},aarch64) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 670 | BL2U_CPPFLAGS += -DIMAGE_AT_EL1 |
| 671 | BL31_CPPFLAGS += -DIMAGE_AT_EL3 |
| 672 | BL32_CPPFLAGS += -DIMAGE_AT_EL1 |
Boyan Karatotev | 007433d | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 673 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 674 | BL32_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | d5e97a1 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 675 | endif |
| 676 | |
Sandrine Bailleux | 54035fc | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 677 | # Include the CPU specific operations makefile, which provides default |
| 678 | # values for all CPU errata workarounds and CPU specific optimisations. |
| 679 | # This can be overridden by the platform. |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 680 | include lib/cpus/cpu-ops.mk |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 681 | |
dp-arm | a440900 | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 682 | ################################################################################ |
| 683 | # Build `AARCH32_SP` as BL32 image for AArch32 |
| 684 | ################################################################################ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 685 | ifeq (${ARCH},aarch32) |
| 686 | NEED_BL32 := yes |
dp-arm | a440900 | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 687 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 688 | ifneq (${AARCH32_SP},none) |
| 689 | # We expect to locate an sp.mk under the specified AARCH32_SP directory |
| 690 | AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) |
dp-arm | a440900 | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 691 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 692 | ifeq (${AARCH32_SP_MAKE},) |
| 693 | $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) |
| 694 | endif |
Juan Pablo Conde | 043f38f | 2023-08-09 13:19:21 -0500 | [diff] [blame] | 695 | $(info Including ${AARCH32_SP_MAKE}) |
| 696 | include ${AARCH32_SP_MAKE} |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 697 | endif |
| 698 | endif #(ARCH=aarch32) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 699 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 700 | ################################################################################ |
Varun Wadekar | 77f1f7a | 2019-01-31 09:22:30 -0800 | [diff] [blame] | 701 | # Include libc if not overridden |
| 702 | ################################################################################ |
| 703 | ifeq (${OVERRIDE_LIBC},0) |
| 704 | include lib/libc/libc.mk |
| 705 | endif |
| 706 | |
Boyan Karatotev | 5d89341 | 2025-01-07 11:00:03 +0000 | [diff] [blame] | 707 | ifneq (${USE_GIC_DRIVER},0) |
| 708 | include drivers/arm/gic/gic.mk |
| 709 | endif |
| 710 | |
Varun Wadekar | 77f1f7a | 2019-01-31 09:22:30 -0800 | [diff] [blame] | 711 | ################################################################################ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 712 | # Check incompatible options and dependencies |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 713 | ################################################################################ |
Boyan Karatotev | b14987c | 2025-04-09 14:41:58 +0100 | [diff] [blame] | 714 | include ${MAKE_HELPERS_DIRECTORY}constraints.mk |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 715 | |
| 716 | # The cert_create tool cannot generate certificates individually, so we use the |
| 717 | # target 'certificates' to create them all |
| 718 | ifneq (${GENERATE_COT},0) |
| 719 | FIP_DEPS += certificates |
| 720 | FWU_FIP_DEPS += fwu_certificates |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 721 | endif |
| 722 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 723 | ifneq (${DECRYPTION_SUPPORT},none) |
| 724 | ENC_ARGS += -f ${FW_ENC_STATUS} |
| 725 | ENC_ARGS += -k ${ENC_KEY} |
| 726 | ENC_ARGS += -n ${ENC_NONCE} |
| 727 | FIP_DEPS += enctool |
| 728 | FWU_FIP_DEPS += enctool |
| 729 | endif #(DECRYPTION_SUPPORT) |
| 730 | |
Manish V Badarkhe | 2bf4f27 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 731 | ifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) |
| 732 | # Support authentication verification and hash calculation |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 733 | CRYPTO_SUPPORT := 3 |
Manish V Badarkhe | 2bf4f27 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 734 | else ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) |
| 735 | # Support authentication verification and hash calculation |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 736 | CRYPTO_SUPPORT := 3 |
Manish V Badarkhe | 2bf4f27 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 737 | else ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) |
| 738 | # Support hash calculation only |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 739 | CRYPTO_SUPPORT := 2 |
Manish V Badarkhe | 2bf4f27 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 740 | else ifeq (${TRUSTED_BOARD_BOOT},1) |
| 741 | # Support authentication verification only |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 742 | CRYPTO_SUPPORT := 1 |
Manish V Badarkhe | c9c56f6 | 2022-01-08 22:56:06 +0000 | [diff] [blame] | 743 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 744 | CRYPTO_SUPPORT := 0 |
| 745 | endif #($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT)) |
Manish V Badarkhe | c9c56f6 | 2022-01-08 22:56:06 +0000 | [diff] [blame] | 746 | |
Manish V Badarkhe | e4a070e | 2024-12-03 21:46:51 +0000 | [diff] [blame] | 747 | ifneq ($(filter 1 2 3,$(CRYPTO_SUPPORT)),) |
| 748 | CRYPTO_LIB := $(BUILD_PLAT)/lib/libmbedtls.a |
| 749 | endif |
| 750 | |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 751 | ################################################################################ |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 752 | # Process platform overrideable behaviour |
| 753 | ################################################################################ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 754 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 755 | ifdef BL1_SOURCES |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 756 | NEED_BL1 := yes |
| 757 | endif #(BL1_SOURCES) |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 758 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 759 | ifdef BL2_SOURCES |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 760 | NEED_BL2 := yes |
| 761 | |
| 762 | # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and |
| 763 | # Certificate generation tools. This flag can be overridden by the platform. |
| 764 | ifdef EL3_PAYLOAD_BASE |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 765 | # If booting an EL3 payload there is no need for a BL33 image |
| 766 | # in the FIP file. |
| 767 | NEED_BL33 := no |
| 768 | else |
| 769 | ifdef PRELOADED_BL33_BASE |
| 770 | # If booting a BL33 preloaded image there is no need of |
| 771 | # another one in the FIP file. |
| 772 | NEED_BL33 := no |
| 773 | else |
| 774 | NEED_BL33 ?= yes |
| 775 | endif |
| 776 | endif |
| 777 | endif #(BL2_SOURCES) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 778 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 779 | ifdef BL2U_SOURCES |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 780 | NEED_BL2U := yes |
| 781 | endif #(BL2U_SOURCES) |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 782 | |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 783 | # If SCP_BL2 is given, we always want FIP to include it. |
| 784 | ifdef SCP_BL2 |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 785 | NEED_SCP_BL2 := yes |
| 786 | endif #(SCP_BL2) |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 787 | |
Soby Mathew | 5744e87 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 788 | # For AArch32, BL31 is not currently supported. |
| 789 | ifneq (${ARCH},aarch32) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 790 | ifdef BL31_SOURCES |
| 791 | # When booting an EL3 payload, there is no need to compile the BL31 |
| 792 | # image nor put it in the FIP. |
| 793 | ifndef EL3_PAYLOAD_BASE |
| 794 | NEED_BL31 := yes |
| 795 | endif |
| 796 | endif |
| 797 | endif #(ARCH=aarch64) |
Soby Mathew | 5744e87 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 798 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 799 | # Process TBB related flags |
| 800 | ifneq (${GENERATE_COT},0) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 801 | # Common cert_create options |
| 802 | ifneq (${CREATE_KEYS},0) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 803 | $(eval CRT_ARGS += -n) |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 804 | $(eval FWU_CRT_ARGS += -n) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 805 | ifneq (${SAVE_KEYS},0) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 806 | $(eval CRT_ARGS += -k) |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 807 | $(eval FWU_CRT_ARGS += -k) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 808 | endif |
| 809 | endif |
| 810 | # Include TBBR makefile (unless the platform indicates otherwise) |
| 811 | ifeq (${INCLUDE_TBBR_MK},1) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 812 | include make_helpers/tbbr/tbbr_tools.mk |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 813 | endif |
| 814 | endif #(GENERATE_COT) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 815 | |
Masahiro Yamada | 1c75d5d | 2016-12-25 13:52:22 +0900 | [diff] [blame] | 816 | ifneq (${FIP_ALIGN},0) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 817 | FIP_ARGS += --align ${FIP_ALIGN} |
| 818 | endif #(FIP_ALIGN) |
Masahiro Yamada | 1c75d5d | 2016-12-25 13:52:22 +0900 | [diff] [blame] | 819 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 820 | ifdef FDT_SOURCES |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 821 | NEED_FDT := yes |
| 822 | endif #(FDT_SOURCES) |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 823 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 824 | ################################################################################ |
Michalis Pappas | 46e5e03 | 2018-03-20 13:01:27 +0800 | [diff] [blame] | 825 | # Include libraries' Makefile that are used in all BL |
| 826 | ################################################################################ |
| 827 | |
| 828 | include lib/stack_protector/stack_protector.mk |
| 829 | |
| 830 | ################################################################################ |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 831 | # Include BL specific makefiles |
| 832 | ################################################################################ |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 833 | |
| 834 | ifeq (${NEED_BL1},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 835 | include bl1/bl1.mk |
| 836 | endif |
| 837 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 838 | ifeq (${NEED_BL2},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 839 | include bl2/bl2.mk |
| 840 | endif |
| 841 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 842 | ifeq (${NEED_BL2U},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 843 | include bl2u/bl2u.mk |
| 844 | endif |
| 845 | |
Soby Mathew | 5744e87 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 846 | ifeq (${NEED_BL31},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 847 | include bl31/bl31.mk |
| 848 | endif |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 849 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 850 | ################################################################################ |
| 851 | # Build options checks |
| 852 | ################################################################################ |
Juan Castillo | b7124ea | 2014-11-04 17:36:40 +0000 | [diff] [blame] | 853 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 854 | # Boolean_Flags |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 855 | $(eval $(call assert_booleans,\ |
| 856 | $(sort \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 857 | ALLOW_RO_XLAT_TABLES \ |
| 858 | BL2_ENABLE_SP_LOAD \ |
| 859 | COLD_BOOT_SINGLE_CPU \ |
| 860 | CREATE_KEYS \ |
| 861 | CTX_INCLUDE_AARCH32_REGS \ |
| 862 | CTX_INCLUDE_FPREGS \ |
Madhukar Pappireddy | 4242262 | 2024-06-17 15:17:03 -0500 | [diff] [blame] | 863 | CTX_INCLUDE_SVE_REGS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 864 | CTX_INCLUDE_EL2_REGS \ |
Arvind Ram Prakash | 9acff28 | 2023-10-06 14:35:21 -0500 | [diff] [blame] | 865 | CTX_INCLUDE_MPAM_REGS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 866 | DEBUG \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 867 | DYN_DISABLE_AUTH \ |
| 868 | EL3_EXCEPTION_HANDLING \ |
| 869 | ENABLE_AMU_AUXILIARY_COUNTERS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 870 | AMU_RESTRICT_COUNTERS \ |
| 871 | ENABLE_ASSERTIONS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 872 | ENABLE_PIE \ |
| 873 | ENABLE_PMF \ |
| 874 | ENABLE_PSCI_STAT \ |
| 875 | ENABLE_RUNTIME_INSTRUMENTATION \ |
| 876 | ENABLE_SME_FOR_SWD \ |
| 877 | ENABLE_SVE_FOR_SWD \ |
Boyan Karatotev | 8cef63d | 2025-01-07 11:26:56 +0000 | [diff] [blame] | 878 | ENABLE_FEAT_GCIE \ |
Manish Pandey | 970a4a8 | 2023-10-10 13:53:25 +0100 | [diff] [blame] | 879 | ENABLE_FEAT_RAS \ |
Manish Pandey | f87e54f | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 880 | FFH_SUPPORT \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 881 | ERROR_DEPRECATED \ |
| 882 | FAULT_INJECTION_SUPPORT \ |
| 883 | GENERATE_COT \ |
| 884 | GICV2_G0_FOR_EL3 \ |
| 885 | HANDLE_EA_EL3_FIRST_NS \ |
Bipin Ravi | 538516f | 2023-09-28 13:17:24 -0500 | [diff] [blame] | 886 | HARDEN_SLS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 887 | HW_ASSISTED_COHERENCY \ |
| 888 | MEASURED_BOOT \ |
Abhi.Singh | 36e3d87 | 2024-08-28 14:17:52 -0500 | [diff] [blame] | 889 | DISCRETE_TPM \ |
Tamas Ban | e7f1181 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 890 | DICE_PROTECTION_ENVIRONMENT \ |
Raghu Krishnamurthy | 6a88ec8 | 2024-06-03 19:02:29 -0700 | [diff] [blame] | 891 | RMMD_ENABLE_EL3_TOKEN_SIGN \ |
Sona Mathew | 2132c70 | 2025-03-14 01:27:11 -0500 | [diff] [blame] | 892 | RMMD_ENABLE_IDE_KEY_PROG \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 893 | DRTM_SUPPORT \ |
| 894 | NS_TIMER_SWITCH \ |
| 895 | OVERRIDE_LIBC \ |
| 896 | PL011_GENERIC_UART \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 897 | PROGRAMMABLE_RESET_ADDRESS \ |
| 898 | PSCI_EXTENDED_STATE_ID \ |
| 899 | PSCI_OS_INIT_MODE \ |
Boyan Karatotev | 8db1705 | 2024-10-25 11:38:41 +0100 | [diff] [blame] | 900 | ARCH_FEATURE_AVAILABILITY \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 901 | RESET_TO_BL31 \ |
| 902 | SAVE_KEYS \ |
| 903 | SEPARATE_CODE_AND_RODATA \ |
| 904 | SEPARATE_BL2_NOLOAD_REGION \ |
| 905 | SEPARATE_NOBITS_REGION \ |
Ye Li | 86acbbe | 2022-08-26 13:48:31 +0800 | [diff] [blame] | 906 | SEPARATE_RWDATA_REGION \ |
Madhukar Pappireddy | 308ebfa | 2024-06-17 15:26:00 -0500 | [diff] [blame] | 907 | SEPARATE_SIMD_SECTION \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 908 | SPIN_ON_BL1_EXIT \ |
| 909 | SPM_MM \ |
| 910 | SPMC_AT_EL3 \ |
Nishant Sharma | 801cd3c | 2023-06-27 00:36:01 +0100 | [diff] [blame] | 911 | SPMC_AT_EL3_SEL0_SP \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 912 | SPMD_SPM_AT_SEL2 \ |
Raghu Krishnamurthy | 890b508 | 2023-02-25 13:26:10 -0800 | [diff] [blame] | 913 | ENABLE_SPMD_LP \ |
Raymond Mao | 3ba2c15 | 2023-07-25 07:53:35 -0700 | [diff] [blame] | 914 | TRANSFER_LIST \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 915 | TRUSTED_BOARD_BOOT \ |
| 916 | USE_COHERENT_MEM \ |
| 917 | USE_DEBUGFS \ |
| 918 | ARM_IO_IN_DTB \ |
| 919 | SDEI_IN_FCONF \ |
| 920 | SEC_INT_DESC_IN_FCONF \ |
| 921 | USE_ROMLIB \ |
| 922 | USE_TBBR_DEFS \ |
| 923 | WARMBOOT_ENABLE_DCACHE_EARLY \ |
| 924 | RESET_TO_BL2 \ |
| 925 | BL2_IN_XIP_MEM \ |
| 926 | BL2_INV_DCACHE \ |
| 927 | USE_SPINLOCK_CAS \ |
| 928 | ENCRYPT_BL31 \ |
| 929 | ENCRYPT_BL32 \ |
| 930 | ERRATA_SPECULATIVE_AT \ |
Boyan Karatotev | 45c7328 | 2024-09-20 13:37:51 +0100 | [diff] [blame] | 931 | ERRATA_SME_POWER_DOWN \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 932 | RAS_TRAP_NS_ERR_REC_ACCESS \ |
| 933 | COT_DESC_IN_DTB \ |
| 934 | USE_SP804_TIMER \ |
| 935 | PSA_FWU_SUPPORT \ |
Sughosh Ganu | 11d05a7 | 2024-02-01 12:51:20 +0530 | [diff] [blame] | 936 | PSA_FWU_METADATA_FW_STORE_DESC \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 937 | ENABLE_MPMM \ |
Boyan Karatotev | 2b5e00d | 2024-12-19 16:07:29 +0000 | [diff] [blame] | 938 | FEAT_PABANDON \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 939 | FEATURE_DETECTION \ |
Jayanth Dodderi Chidanand | 0b22e59 | 2022-10-11 17:16:07 +0100 | [diff] [blame] | 940 | TRNG_SUPPORT \ |
Boyan Karatotev | 593ae35 | 2023-03-22 15:55:36 +0000 | [diff] [blame] | 941 | ENABLE_ERRATA_ALL \ |
Sona Mathew | ffea384 | 2022-11-18 18:05:38 -0600 | [diff] [blame] | 942 | ERRATA_ABI_SUPPORT \ |
Sona Mathew | ef63f5b | 2023-03-14 14:02:03 -0500 | [diff] [blame] | 943 | ERRATA_NON_ARM_INTERCONNECT \ |
Okash Khawaja | 04c7303 | 2022-11-04 12:38:01 +0000 | [diff] [blame] | 944 | CONDITIONAL_CMO \ |
Manish V Badarkhe | 5782b89 | 2023-09-06 09:08:28 +0100 | [diff] [blame] | 945 | PSA_CRYPTO \ |
Sandrine Bailleux | 85bebe1 | 2023-10-11 08:38:00 +0200 | [diff] [blame] | 946 | ENABLE_CONSOLE_GETC \ |
Arvind Ram Prakash | 183329a | 2023-08-15 16:28:06 -0500 | [diff] [blame] | 947 | INIT_UNUSED_NS_EL2 \ |
Juan Pablo Conde | bfef8b9 | 2023-11-08 16:14:28 -0600 | [diff] [blame] | 948 | PLATFORM_REPORT_CTX_MEM_USE \ |
Yann Gautier | ae770fe | 2024-01-16 19:39:31 +0100 | [diff] [blame] | 949 | EARLY_CONSOLE \ |
Arvind Ram Prakash | f99a69c | 2023-12-21 00:25:52 -0600 | [diff] [blame] | 950 | PRESERVE_DSU_PMU_REGS \ |
Levi Yun | 8953568 | 2024-05-13 10:24:31 +0100 | [diff] [blame] | 951 | HOB_LIST \ |
Manish V Badarkhe | cf48f49 | 2025-04-15 20:16:32 +0100 | [diff] [blame] | 952 | LFA_SUPPORT \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 953 | ))) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 954 | |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 955 | # Numeric_Flags |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 956 | $(eval $(call assert_numerics,\ |
| 957 | $(sort \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 958 | ARM_ARCH_MAJOR \ |
| 959 | ARM_ARCH_MINOR \ |
| 960 | BRANCH_PROTECTION \ |
| 961 | CTX_INCLUDE_PAUTH_REGS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 962 | CTX_INCLUDE_NEVE_REGS \ |
| 963 | CRYPTO_SUPPORT \ |
Boyan Karatotev | 83a4dae | 2023-02-16 09:45:29 +0000 | [diff] [blame] | 964 | DISABLE_MTPMU \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 965 | ENABLE_BRBE_FOR_NS \ |
| 966 | ENABLE_TRBE_FOR_NS \ |
| 967 | ENABLE_BTI \ |
| 968 | ENABLE_PAUTH \ |
John Powell | 025b1b8 | 2025-03-10 20:09:03 -0500 | [diff] [blame] | 969 | ENABLE_FEAT_PAUTH_LR \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 970 | ENABLE_FEAT_AMU \ |
| 971 | ENABLE_FEAT_AMUv1p1 \ |
| 972 | ENABLE_FEAT_CSV2_2 \ |
Sona Mathew | 30019d8 | 2023-10-25 16:48:19 -0500 | [diff] [blame] | 973 | ENABLE_FEAT_CSV2_3 \ |
Arvind Ram Prakash | 83271d5 | 2024-05-22 15:24:00 -0500 | [diff] [blame] | 974 | ENABLE_FEAT_DEBUGV8P9 \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 975 | ENABLE_FEAT_DIT \ |
| 976 | ENABLE_FEAT_ECV \ |
| 977 | ENABLE_FEAT_FGT \ |
Arvind Ram Prakash | 33e6aaa | 2024-06-06 11:33:37 -0500 | [diff] [blame] | 978 | ENABLE_FEAT_FGT2 \ |
Arvind Ram Prakash | a57e18e | 2024-11-11 14:32:37 -0600 | [diff] [blame] | 979 | ENABLE_FEAT_FPMR \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 980 | ENABLE_FEAT_HCX \ |
Andre Przywara | 19d52a8 | 2024-08-09 17:04:22 +0100 | [diff] [blame] | 981 | ENABLE_FEAT_LS64_ACCDATA \ |
Tushar Khandelwal | 7e84f3c | 2024-03-15 15:00:29 +0000 | [diff] [blame] | 982 | ENABLE_FEAT_MEC \ |
Arvind Ram Prakash | 6b8df7b | 2025-01-09 17:18:30 -0600 | [diff] [blame] | 983 | ENABLE_FEAT_MOPS \ |
Govindraj Raja | 8e39788 | 2024-01-26 10:08:37 -0600 | [diff] [blame] | 984 | ENABLE_FEAT_MTE2 \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 985 | ENABLE_FEAT_PAN \ |
| 986 | ENABLE_FEAT_RNG \ |
| 987 | ENABLE_FEAT_RNG_TRAP \ |
| 988 | ENABLE_FEAT_SEL2 \ |
| 989 | ENABLE_FEAT_TCR2 \ |
Jayanth Dodderi Chidanand | 6d0433f | 2024-09-05 22:24:04 +0100 | [diff] [blame] | 990 | ENABLE_FEAT_THE \ |
Govindraj Raja | 0e4daed | 2024-01-23 16:03:53 -0600 | [diff] [blame] | 991 | ENABLE_FEAT_SB \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 992 | ENABLE_FEAT_S2PIE \ |
| 993 | ENABLE_FEAT_S1PIE \ |
| 994 | ENABLE_FEAT_S2POE \ |
| 995 | ENABLE_FEAT_S1POE \ |
Jayanth Dodderi Chidanand | 4ec4e54 | 2024-09-06 13:49:31 +0100 | [diff] [blame] | 996 | ENABLE_FEAT_SCTLR2 \ |
Govindraj Raja | 3065513 | 2024-09-06 15:43:43 +0100 | [diff] [blame] | 997 | ENABLE_FEAT_D128 \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 998 | ENABLE_FEAT_GCS \ |
| 999 | ENABLE_FEAT_VHE \ |
Arvind Ram Prakash | edebefb | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 1000 | ENABLE_FEAT_MPAM \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1001 | ENABLE_RME \ |
| 1002 | ENABLE_SPE_FOR_NS \ |
| 1003 | ENABLE_SYS_REG_TRACE_FOR_NS \ |
| 1004 | ENABLE_SME_FOR_NS \ |
| 1005 | ENABLE_SME2_FOR_NS \ |
| 1006 | ENABLE_SVE_FOR_NS \ |
| 1007 | ENABLE_TRF_FOR_NS \ |
| 1008 | FW_ENC_STATUS \ |
| 1009 | NR_OF_FW_BANKS \ |
| 1010 | NR_OF_IMAGES_IN_FW_BANK \ |
| 1011 | TWED_DELAY \ |
| 1012 | ENABLE_FEAT_TWED \ |
| 1013 | SVE_VECTOR_LEN \ |
Varun Wadekar | 0ed3be6 | 2023-04-13 21:06:18 +0100 | [diff] [blame] | 1014 | IMPDEF_SYSREG_TRAP \ |
Boyan Karatotev | ee580c2 | 2025-04-11 14:27:55 +0100 | [diff] [blame^] | 1015 | W \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1016 | ))) |
Jeenu Viswambharan | c877b41 | 2017-01-16 16:52:35 +0000 | [diff] [blame] | 1017 | |
Justin Chadwell | aacff74 | 2019-07-29 17:13:10 +0100 | [diff] [blame] | 1018 | ifdef KEY_SIZE |
| 1019 | $(eval $(call assert_numeric,KEY_SIZE)) |
| 1020 | endif |
| 1021 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1022 | ifeq ($(filter $(SANITIZE_UB), on off trap),) |
| 1023 | $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") |
| 1024 | endif |
| 1025 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1026 | ################################################################################ |
| 1027 | # Add definitions to the cpp preprocessor based on the current build options. |
| 1028 | # This is done after including the platform specific makefile to allow the |
| 1029 | # platform to overwrite the default options |
| 1030 | ################################################################################ |
| 1031 | |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1032 | $(eval $(call add_defines,\ |
| 1033 | $(sort \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1034 | ALLOW_RO_XLAT_TABLES \ |
| 1035 | ARM_ARCH_MAJOR \ |
| 1036 | ARM_ARCH_MINOR \ |
| 1037 | BL2_ENABLE_SP_LOAD \ |
| 1038 | COLD_BOOT_SINGLE_CPU \ |
| 1039 | CTX_INCLUDE_AARCH32_REGS \ |
| 1040 | CTX_INCLUDE_FPREGS \ |
Madhukar Pappireddy | 4242262 | 2024-06-17 15:17:03 -0500 | [diff] [blame] | 1041 | CTX_INCLUDE_SVE_REGS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1042 | CTX_INCLUDE_PAUTH_REGS \ |
Arvind Ram Prakash | 9acff28 | 2023-10-06 14:35:21 -0500 | [diff] [blame] | 1043 | CTX_INCLUDE_MPAM_REGS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1044 | EL3_EXCEPTION_HANDLING \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1045 | CTX_INCLUDE_EL2_REGS \ |
| 1046 | CTX_INCLUDE_NEVE_REGS \ |
Boyan Karatotev | ee580c2 | 2025-04-11 14:27:55 +0100 | [diff] [blame^] | 1047 | DEBUG \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1048 | DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ |
| 1049 | DISABLE_MTPMU \ |
| 1050 | ENABLE_FEAT_AMU \ |
| 1051 | ENABLE_AMU_AUXILIARY_COUNTERS \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1052 | AMU_RESTRICT_COUNTERS \ |
| 1053 | ENABLE_ASSERTIONS \ |
| 1054 | ENABLE_BTI \ |
Arvind Ram Prakash | 83271d5 | 2024-05-22 15:24:00 -0500 | [diff] [blame] | 1055 | ENABLE_FEAT_DEBUGV8P9 \ |
Arvind Ram Prakash | edebefb | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 1056 | ENABLE_FEAT_MPAM \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1057 | ENABLE_PAUTH \ |
John Powell | 025b1b8 | 2025-03-10 20:09:03 -0500 | [diff] [blame] | 1058 | ENABLE_FEAT_PAUTH_LR \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1059 | ENABLE_PIE \ |
| 1060 | ENABLE_PMF \ |
| 1061 | ENABLE_PSCI_STAT \ |
| 1062 | ENABLE_RME \ |
Raghu Krishnamurthy | 6a88ec8 | 2024-06-03 19:02:29 -0700 | [diff] [blame] | 1063 | RMMD_ENABLE_EL3_TOKEN_SIGN \ |
Sona Mathew | 2132c70 | 2025-03-14 01:27:11 -0500 | [diff] [blame] | 1064 | RMMD_ENABLE_IDE_KEY_PROG \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1065 | ENABLE_RUNTIME_INSTRUMENTATION \ |
| 1066 | ENABLE_SME_FOR_NS \ |
| 1067 | ENABLE_SME2_FOR_NS \ |
| 1068 | ENABLE_SME_FOR_SWD \ |
| 1069 | ENABLE_SPE_FOR_NS \ |
| 1070 | ENABLE_SVE_FOR_NS \ |
| 1071 | ENABLE_SVE_FOR_SWD \ |
Manish Pandey | 970a4a8 | 2023-10-10 13:53:25 +0100 | [diff] [blame] | 1072 | ENABLE_FEAT_RAS \ |
Manish Pandey | f87e54f | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 1073 | FFH_SUPPORT \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1074 | ENCRYPT_BL31 \ |
| 1075 | ENCRYPT_BL32 \ |
| 1076 | ERROR_DEPRECATED \ |
| 1077 | FAULT_INJECTION_SUPPORT \ |
| 1078 | GICV2_G0_FOR_EL3 \ |
| 1079 | HANDLE_EA_EL3_FIRST_NS \ |
| 1080 | HW_ASSISTED_COHERENCY \ |
| 1081 | LOG_LEVEL \ |
| 1082 | MEASURED_BOOT \ |
Abhi.Singh | 36e3d87 | 2024-08-28 14:17:52 -0500 | [diff] [blame] | 1083 | DISCRETE_TPM \ |
Tamas Ban | e7f1181 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 1084 | DICE_PROTECTION_ENVIRONMENT \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1085 | DRTM_SUPPORT \ |
| 1086 | NS_TIMER_SWITCH \ |
| 1087 | PL011_GENERIC_UART \ |
| 1088 | PLAT_${PLAT} \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1089 | PROGRAMMABLE_RESET_ADDRESS \ |
| 1090 | PSCI_EXTENDED_STATE_ID \ |
| 1091 | PSCI_OS_INIT_MODE \ |
Boyan Karatotev | 8db1705 | 2024-10-25 11:38:41 +0100 | [diff] [blame] | 1092 | ARCH_FEATURE_AVAILABILITY \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1093 | RESET_TO_BL31 \ |
AlexeiFedorov | d766084 | 2024-05-13 15:35:54 +0100 | [diff] [blame] | 1094 | RME_GPT_BITLOCK_BLOCK \ |
AlexeiFedorov | ec0088b | 2024-03-13 17:07:03 +0000 | [diff] [blame] | 1095 | RME_GPT_MAX_BLOCK \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1096 | SEPARATE_CODE_AND_RODATA \ |
| 1097 | SEPARATE_BL2_NOLOAD_REGION \ |
| 1098 | SEPARATE_NOBITS_REGION \ |
Ye Li | 86acbbe | 2022-08-26 13:48:31 +0800 | [diff] [blame] | 1099 | SEPARATE_RWDATA_REGION \ |
Madhukar Pappireddy | 308ebfa | 2024-06-17 15:26:00 -0500 | [diff] [blame] | 1100 | SEPARATE_SIMD_SECTION \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1101 | RECLAIM_INIT_CODE \ |
| 1102 | SPD_${SPD} \ |
| 1103 | SPIN_ON_BL1_EXIT \ |
| 1104 | SPM_MM \ |
| 1105 | SPMC_AT_EL3 \ |
Nishant Sharma | 801cd3c | 2023-06-27 00:36:01 +0100 | [diff] [blame] | 1106 | SPMC_AT_EL3_SEL0_SP \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1107 | SPMD_SPM_AT_SEL2 \ |
Raymond Mao | 3ba2c15 | 2023-07-25 07:53:35 -0700 | [diff] [blame] | 1108 | TRANSFER_LIST \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1109 | TRUSTED_BOARD_BOOT \ |
| 1110 | CRYPTO_SUPPORT \ |
| 1111 | TRNG_SUPPORT \ |
| 1112 | ERRATA_ABI_SUPPORT \ |
Sona Mathew | ef63f5b | 2023-03-14 14:02:03 -0500 | [diff] [blame] | 1113 | ERRATA_NON_ARM_INTERCONNECT \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1114 | USE_COHERENT_MEM \ |
| 1115 | USE_DEBUGFS \ |
| 1116 | ARM_IO_IN_DTB \ |
| 1117 | SDEI_IN_FCONF \ |
| 1118 | SEC_INT_DESC_IN_FCONF \ |
| 1119 | USE_ROMLIB \ |
| 1120 | USE_TBBR_DEFS \ |
| 1121 | WARMBOOT_ENABLE_DCACHE_EARLY \ |
| 1122 | RESET_TO_BL2 \ |
| 1123 | BL2_RUNS_AT_EL3 \ |
| 1124 | BL2_IN_XIP_MEM \ |
| 1125 | BL2_INV_DCACHE \ |
| 1126 | USE_SPINLOCK_CAS \ |
| 1127 | ERRATA_SPECULATIVE_AT \ |
Boyan Karatotev | 45c7328 | 2024-09-20 13:37:51 +0100 | [diff] [blame] | 1128 | ERRATA_SME_POWER_DOWN \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1129 | RAS_TRAP_NS_ERR_REC_ACCESS \ |
| 1130 | COT_DESC_IN_DTB \ |
| 1131 | USE_SP804_TIMER \ |
| 1132 | ENABLE_FEAT_RNG \ |
| 1133 | ENABLE_FEAT_RNG_TRAP \ |
| 1134 | ENABLE_FEAT_SB \ |
| 1135 | ENABLE_FEAT_DIT \ |
| 1136 | NR_OF_FW_BANKS \ |
| 1137 | NR_OF_IMAGES_IN_FW_BANK \ |
| 1138 | PSA_FWU_SUPPORT \ |
Sughosh Ganu | 11d05a7 | 2024-02-01 12:51:20 +0530 | [diff] [blame] | 1139 | PSA_FWU_METADATA_FW_STORE_DESC \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1140 | ENABLE_BRBE_FOR_NS \ |
| 1141 | ENABLE_TRBE_FOR_NS \ |
| 1142 | ENABLE_SYS_REG_TRACE_FOR_NS \ |
| 1143 | ENABLE_TRF_FOR_NS \ |
| 1144 | ENABLE_FEAT_HCX \ |
| 1145 | ENABLE_MPMM \ |
Boyan Karatotev | 2b5e00d | 2024-12-19 16:07:29 +0000 | [diff] [blame] | 1146 | FEAT_PABANDON \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1147 | ENABLE_FEAT_FGT \ |
Arvind Ram Prakash | 33e6aaa | 2024-06-06 11:33:37 -0500 | [diff] [blame] | 1148 | ENABLE_FEAT_FGT2 \ |
Arvind Ram Prakash | a57e18e | 2024-11-11 14:32:37 -0600 | [diff] [blame] | 1149 | ENABLE_FEAT_FPMR \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1150 | ENABLE_FEAT_ECV \ |
| 1151 | ENABLE_FEAT_AMUv1p1 \ |
| 1152 | ENABLE_FEAT_SEL2 \ |
| 1153 | ENABLE_FEAT_VHE \ |
| 1154 | ENABLE_FEAT_CSV2_2 \ |
Sona Mathew | 30019d8 | 2023-10-25 16:48:19 -0500 | [diff] [blame] | 1155 | ENABLE_FEAT_CSV2_3 \ |
Andre Przywara | 19d52a8 | 2024-08-09 17:04:22 +0100 | [diff] [blame] | 1156 | ENABLE_FEAT_LS64_ACCDATA \ |
Tushar Khandelwal | 7e84f3c | 2024-03-15 15:00:29 +0000 | [diff] [blame] | 1157 | ENABLE_FEAT_MEC \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1158 | ENABLE_FEAT_PAN \ |
| 1159 | ENABLE_FEAT_TCR2 \ |
Jayanth Dodderi Chidanand | 6d0433f | 2024-09-05 22:24:04 +0100 | [diff] [blame] | 1160 | ENABLE_FEAT_THE \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1161 | ENABLE_FEAT_S2PIE \ |
| 1162 | ENABLE_FEAT_S1PIE \ |
| 1163 | ENABLE_FEAT_S2POE \ |
| 1164 | ENABLE_FEAT_S1POE \ |
Jayanth Dodderi Chidanand | 4ec4e54 | 2024-09-06 13:49:31 +0100 | [diff] [blame] | 1165 | ENABLE_FEAT_SCTLR2 \ |
Govindraj Raja | 3065513 | 2024-09-06 15:43:43 +0100 | [diff] [blame] | 1166 | ENABLE_FEAT_D128 \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1167 | ENABLE_FEAT_GCS \ |
Arvind Ram Prakash | 6b8df7b | 2025-01-09 17:18:30 -0600 | [diff] [blame] | 1168 | ENABLE_FEAT_MOPS \ |
Boyan Karatotev | 8cef63d | 2025-01-07 11:26:56 +0000 | [diff] [blame] | 1169 | ENABLE_FEAT_GCIE \ |
Govindraj Raja | 8e39788 | 2024-01-26 10:08:37 -0600 | [diff] [blame] | 1170 | ENABLE_FEAT_MTE2 \ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1171 | FEATURE_DETECTION \ |
| 1172 | TWED_DELAY \ |
| 1173 | ENABLE_FEAT_TWED \ |
Okash Khawaja | 04c7303 | 2022-11-04 12:38:01 +0000 | [diff] [blame] | 1174 | CONDITIONAL_CMO \ |
Varun Wadekar | 0ed3be6 | 2023-04-13 21:06:18 +0100 | [diff] [blame] | 1175 | IMPDEF_SYSREG_TRAP \ |
Jayanth Dodderi Chidanand | a8cf6fa | 2023-04-26 15:57:30 +0100 | [diff] [blame] | 1176 | SVE_VECTOR_LEN \ |
Raghu Krishnamurthy | 890b508 | 2023-02-25 13:26:10 -0800 | [diff] [blame] | 1177 | ENABLE_SPMD_LP \ |
Manish V Badarkhe | 5782b89 | 2023-09-06 09:08:28 +0100 | [diff] [blame] | 1178 | PSA_CRYPTO \ |
Sandrine Bailleux | 85bebe1 | 2023-10-11 08:38:00 +0200 | [diff] [blame] | 1179 | ENABLE_CONSOLE_GETC \ |
Arvind Ram Prakash | 183329a | 2023-08-15 16:28:06 -0500 | [diff] [blame] | 1180 | INIT_UNUSED_NS_EL2 \ |
Juan Pablo Conde | bfef8b9 | 2023-11-08 16:14:28 -0600 | [diff] [blame] | 1181 | PLATFORM_REPORT_CTX_MEM_USE \ |
Yann Gautier | ae770fe | 2024-01-16 19:39:31 +0100 | [diff] [blame] | 1182 | EARLY_CONSOLE \ |
Arvind Ram Prakash | f99a69c | 2023-12-21 00:25:52 -0600 | [diff] [blame] | 1183 | PRESERVE_DSU_PMU_REGS \ |
Levi Yun | 8953568 | 2024-05-13 10:24:31 +0100 | [diff] [blame] | 1184 | HOB_LIST \ |
Manish V Badarkhe | cf48f49 | 2025-04-15 20:16:32 +0100 | [diff] [blame] | 1185 | LFA_SUPPORT \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1186 | ))) |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 1187 | |
Juan Pablo Conde | bfef8b9 | 2023-11-08 16:14:28 -0600 | [diff] [blame] | 1188 | ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) |
| 1189 | ifeq (${DEBUG}, 0) |
| 1190 | $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only") |
| 1191 | override PLATFORM_REPORT_CTX_MEM_USE := 0 |
| 1192 | endif |
| 1193 | endif |
| 1194 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1195 | ifeq (${SANITIZE_UB},trap) |
| 1196 | $(eval $(call add_define,MONITOR_TRAPS)) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1197 | endif #(SANITIZE_UB) |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1198 | |
Sandrine Bailleux | 4c117f6 | 2015-11-26 16:31:34 +0000 | [diff] [blame] | 1199 | # Define the EL3_PAYLOAD_BASE flag only if it is provided. |
| 1200 | ifdef EL3_PAYLOAD_BASE |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 1201 | $(eval $(call add_define,EL3_PAYLOAD_BASE)) |
| 1202 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1203 | # Define the PRELOADED_BL33_BASE flag only if it is provided and |
| 1204 | # EL3_PAYLOAD_BASE is not defined, as it has priority. |
| 1205 | ifdef PRELOADED_BL33_BASE |
Antonio Nino Diaz | 68450a6 | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 1206 | $(eval $(call add_define,PRELOADED_BL33_BASE)) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1207 | endif |
| 1208 | endif #(EL3_PAYLOAD_BASE) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1209 | |
Soby Mathew | 209a60c | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 1210 | # Define the DYN_DISABLE_AUTH flag only if set. |
| 1211 | ifeq (${DYN_DISABLE_AUTH},1) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1212 | $(eval $(call add_define,DYN_DISABLE_AUTH)) |
Soby Mathew | 209a60c | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 1213 | endif |
| 1214 | |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 1215 | ifeq ($($(ARCH)-ld-id),arm-link) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1216 | $(eval $(call add_define,USE_ARM_LINK)) |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 1217 | endif |
| 1218 | |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1219 | # Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1220 | ifeq (${SPD},spmd) |
Olivier Deprez | c33ff19 | 2020-03-19 09:27:11 +0100 | [diff] [blame] | 1221 | ifdef SP_LAYOUT_FILE |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1222 | -include $(BUILD_PLAT)/sp_gen.mk |
| 1223 | FIP_DEPS += sp |
| 1224 | CRT_DEPS += sp |
| 1225 | NEED_SP_PKG := yes |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1226 | else |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1227 | ifeq (${SPMD_SPM_AT_SEL2},1) |
| 1228 | $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") |
| 1229 | endif |
| 1230 | endif #(SP_LAYOUT_FILE) |
| 1231 | endif #(SPD) |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1232 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1233 | ################################################################################ |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1234 | # Build targets |
| 1235 | ################################################################################ |
| 1236 | |
Harrison Mutai | 2329e22 | 2024-08-28 13:27:19 +0000 | [diff] [blame] | 1237 | .PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp tl fwu_fip certtool dtbs memmap doc enctool |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1238 | |
| 1239 | all: msg_start |
| 1240 | |
| 1241 | msg_start: |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1242 | $(s)echo "Building ${PLAT}" |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1243 | |
Soby Mathew | 7a24cba | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1244 | ifeq (${ERROR_DEPRECATED},0) |
Julius Werner | d5dfdeb | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 1245 | # Check if deprecated declarations and cpp warnings should be treated as error or not. |
Chris Kay | 8620bd0 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 1246 | ifneq ($(filter %-clang,$($(ARCH)-cc-id)),) |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 1247 | CPPFLAGS += -Wno-error=deprecated-declarations |
| 1248 | else |
Dan Handley | bc1a03c | 2018-02-27 16:03:58 +0000 | [diff] [blame] | 1249 | CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp |
Soby Mathew | 7a24cba | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1250 | endif |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1251 | endif #(!ERROR_DEPRECATED) |
Soby Mathew | 7a24cba | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1252 | |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1253 | $(eval $(call MAKE_LIB,c)) |
Roberto Vargas | 5fee028 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1254 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1255 | # Expand build macros for the different images |
| 1256 | ifeq (${NEED_BL1},yes) |
Chris Kay | b34635a | 2021-09-28 15:44:19 +0100 | [diff] [blame] | 1257 | BL1_SOURCES := $(sort ${BL1_SOURCES}) |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1258 | $(eval $(call MAKE_BL,bl1)) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1259 | endif #(NEED_BL1) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1260 | |
| 1261 | ifeq (${NEED_BL2},yes) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1262 | |
Arvind Ram Prakash | 42d4d3b | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 1263 | ifeq (${RESET_TO_BL2}, 0) |
Roberto Vargas | c9b31ae | 2018-01-02 11:23:41 +0000 | [diff] [blame] | 1264 | FIP_BL2_ARGS := tb-fw |
| 1265 | endif |
| 1266 | |
Chris Kay | eb1acfb | 2021-09-28 15:44:37 +0100 | [diff] [blame] | 1267 | BL2_SOURCES := $(sort ${BL2_SOURCES}) |
| 1268 | |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1269 | $(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1270 | $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1271 | |
| 1272 | endif #(NEED_BL2) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1273 | |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1274 | ifeq (${NEED_SCP_BL2},yes) |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1275 | $(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1276 | endif #(NEED_SCP_BL2) |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1277 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1278 | ifeq (${NEED_BL31},yes) |
| 1279 | BL31_SOURCES += ${SPD_SOURCES} |
Madhukar Pappireddy | 26d1e0c | 2020-01-27 13:37:51 -0600 | [diff] [blame] | 1280 | # Sort BL31 source files to remove duplicates |
| 1281 | BL31_SOURCES := $(sort ${BL31_SOURCES}) |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1282 | ifneq (${DECRYPTION_SUPPORT},none) |
| 1283 | $(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1284 | $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1285 | else |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1286 | $(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1287 | $(eval $(call MAKE_BL,bl31,soc-fw))) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1288 | endif #(DECRYPTION_SUPPORT) |
| 1289 | endif #(NEED_BL31) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1290 | |
Juan Castillo | 70d1fc5 | 2015-11-12 10:59:26 +0000 | [diff] [blame] | 1291 | # If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the |
Masahiro Yamada | c939d13 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1292 | # build system will call TOOL_ADD_IMG to print a warning message and abort the |
Juan Castillo | 70d1fc5 | 2015-11-12 10:59:26 +0000 | [diff] [blame] | 1293 | # process. Note that the dependency on BL32 applies to the FIP only. |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1294 | ifeq (${NEED_BL32},yes) |
Madhukar Pappireddy | 26d1e0c | 2020-01-27 13:37:51 -0600 | [diff] [blame] | 1295 | # Sort BL32 source files to remove duplicates |
| 1296 | BL32_SOURCES := $(sort ${BL32_SOURCES}) |
Masahiro Yamada | 9cd1523 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1297 | BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) |
| 1298 | |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1299 | ifneq (${DECRYPTION_SUPPORT},none) |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1300 | $(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1301 | $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) |
| 1302 | else |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1303 | $(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1304 | $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1305 | endif #(DECRYPTION_SUPPORT) |
| 1306 | endif #(NEED_BL32) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1307 | |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 1308 | # If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) |
| 1309 | # needs to be built from RMM_SOURCES. |
| 1310 | ifeq (${NEED_RMM},yes) |
| 1311 | # Sort RMM source files to remove duplicates |
| 1312 | RMM_SOURCES := $(sort ${RMM_SOURCES}) |
| 1313 | BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) |
| 1314 | |
| 1315 | $(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1316 | $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) |
| 1317 | endif #(NEED_RMM) |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 1318 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1319 | # Add the BL33 image if required by the platform |
| 1320 | ifeq (${NEED_BL33},yes) |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1321 | $(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1322 | endif #(NEED_BL33) |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 1323 | |
Yatharth Kochar | 9003fa0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1324 | ifeq (${NEED_BL2U},yes) |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1325 | $(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1326 | $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1327 | endif #(NEED_BL2U) |
Yatharth Kochar | 9003fa0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1328 | |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1329 | # Expand build macros for the different images |
| 1330 | ifeq (${NEED_FDT},yes) |
Soby Mathew | 38c14d8 | 2017-12-14 17:44:56 +0000 | [diff] [blame] | 1331 | $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) |
Salman Nabi | 1c08ff3 | 2024-12-12 17:38:54 +0000 | [diff] [blame] | 1332 | |
| 1333 | ifneq (${INITRD_SIZE}${INITRD_PATH},) |
| 1334 | ifndef INITRD_BASE |
| 1335 | $(error INITRD_BASE must be set when inserting initrd properties to the DTB.) |
| 1336 | endif |
| 1337 | |
| 1338 | INITRD_SIZE ?= $(shell printf "0x%x\n" $$(stat -Lc %s $(INITRD_PATH))) |
| 1339 | initrd_end = $(shell printf "0x%x\n" $$(expr $$(($(INITRD_BASE) + $(INITRD_SIZE))))) |
| 1340 | |
| 1341 | define $(HW_CONFIG)-after += |
| 1342 | $(s)echo " INITRD $(HW_CONFIG)" |
| 1343 | $(q)fdtput -t x $@ /chosen linux,initrd-start $(INITRD_BASE) |
| 1344 | $(q)fdtput -t x $@ /chosen linux,initrd-end $(initrd_end) |
| 1345 | endef |
| 1346 | endif |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1347 | endif #(NEED_FDT) |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1348 | |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1349 | # Add Secure Partition packages |
| 1350 | ifeq (${NEED_SP_PKG},yes) |
Chris Kay | fd74ca0 | 2024-07-30 13:33:56 +0000 | [diff] [blame] | 1351 | $(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | $$(@D)/ |
Chris Kay | 679e27c | 2025-03-19 15:04:47 +0000 | [diff] [blame] | 1352 | $(if $(host-poetry),$(q)poetry -q install --no-root) |
Kathleen Capella | dd81623 | 2025-02-13 17:34:21 -0600 | [diff] [blame] | 1353 | $(q)$(if $(host-poetry),poetry run )${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} |
J-Alves | 822c727 | 2022-03-22 16:28:51 +0000 | [diff] [blame] | 1354 | sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1355 | $(s)echo |
| 1356 | $(s)echo "Built SP Images successfully" |
| 1357 | $(s)echo |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1358 | endif #(NEED_SP_PKG) |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1359 | |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1360 | locate-checkpatch: |
| 1361 | ifndef CHECKPATCH |
Etienne Carriere | 66079b0 | 2017-08-23 15:44:01 +0200 | [diff] [blame] | 1362 | $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1363 | else |
| 1364 | ifeq (,$(wildcard ${CHECKPATCH})) |
Etienne Carriere | 66079b0 | 2017-08-23 15:44:01 +0200 | [diff] [blame] | 1365 | $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1366 | endif |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1367 | endif #(CHECKPATCH) |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1368 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1369 | clean: |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1370 | $(s)echo " CLEAN" |
Chris Kay | c327370 | 2025-01-13 15:57:32 +0000 | [diff] [blame] | 1371 | $(q)rm -rf $(BUILD_PLAT) |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1372 | $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1373 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean |
| 1374 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean |
| 1375 | $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1376 | |
James Morrissey | eaaeece | 2013-11-01 13:56:59 +0000 | [diff] [blame] | 1377 | realclean distclean: |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1378 | $(s)echo " REALCLEAN" |
Chris Kay | c327370 | 2025-01-13 15:57:32 +0000 | [diff] [blame] | 1379 | $(q)rm -rf $(BUILD_BASE) |
| 1380 | $(q)rm -rf $(CURDIR)/cscope.* |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1381 | $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1382 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean |
| 1383 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean |
| 1384 | $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1385 | |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1386 | checkcodebase: locate-checkpatch |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1387 | $(s)echo " CHECKING STYLE" |
| 1388 | $(q)if test -d .git ; then \ |
Paul Beesley | 1ef3551 | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 1389 | git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1390 | while read GIT_FILE ; \ |
| 1391 | do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ |
| 1392 | done ; \ |
| 1393 | else \ |
| 1394 | find . -type f -not -iwholename "*.git*" \ |
| 1395 | -not -iwholename "*build*" \ |
| 1396 | -not -iwholename "*libfdt*" \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1397 | -not -iwholename "*libc*" \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1398 | -not -iwholename "*docs*" \ |
Paul Beesley | 1ef3551 | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 1399 | -not -iwholename "*.rst" \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1400 | -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ |
| 1401 | fi |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1402 | |
| 1403 | checkpatch: locate-checkpatch |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1404 | $(s)echo " CHECKING STYLE" |
| 1405 | $(q)if test -n "${CHECKPATCH_OPTS}"; then \ |
Yann Gautier | 02a76d5 | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1406 | echo " with ${CHECKPATCH_OPTS} option(s)"; \ |
| 1407 | fi |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1408 | $(q)COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ |
Yann Gautier | 77a0a7f | 2021-11-02 18:03:31 +0100 | [diff] [blame] | 1409 | for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ |
| 1410 | do \ |
Antonio Nino Diaz | 51d2893 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1411 | printf "\n[*] Checking style of '$$commit'\n\n"; \ |
Yann Gautier | 1a72174 | 2024-08-09 11:52:03 +0200 | [diff] [blame] | 1412 | ( git log --format=email "$$commit~..$$commit" \ |
| 1413 | -- ${CHECK_PATHS} ; \ |
| 1414 | git diff --format=email "$$commit~..$$commit" \ |
| 1415 | -- ${CHECK_PATHS}; ) | \ |
Yann Gautier | 02a76d5 | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1416 | ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ |
Antonio Nino Diaz | 51d2893 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1417 | done |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1418 | |
| 1419 | certtool: ${CRTTOOL} |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1420 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1421 | ${CRTTOOL}: FORCE |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1422 | $(q)${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} DEBUG=${DEBUG} --no-print-directory -C ${CRTTOOLPATH} all |
| 1423 | $(s)echo |
| 1424 | $(s)echo "Built $@ successfully" |
| 1425 | $(s)echo |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1426 | |
| 1427 | ifneq (${GENERATE_COT},0) |
| 1428 | certificates: ${CRT_DEPS} ${CRTTOOL} |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1429 | $(q)${CRTTOOL} ${CRT_ARGS} |
| 1430 | $(s)echo |
| 1431 | $(s)echo "Built $@ successfully" |
| 1432 | $(s)echo "Certificates can be found in ${BUILD_PLAT}" |
| 1433 | $(s)echo |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1434 | endif #(GENERATE_COT) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1435 | |
| 1436 | ${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} |
Pali Rohár | 4727fd1 | 2020-11-24 16:53:04 +0100 | [diff] [blame] | 1437 | $(eval ${CHECK_FIP_CMD}) |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1438 | $(q)${FIPTOOL} create ${FIP_ARGS} $@ |
| 1439 | $(q)${FIPTOOL} info $@ |
| 1440 | $(s)echo |
| 1441 | $(s)echo "Built $@ successfully" |
| 1442 | $(s)echo |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1443 | |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1444 | ifneq (${GENERATE_COT},0) |
| 1445 | fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1446 | $(q)${CRTTOOL} ${FWU_CRT_ARGS} |
| 1447 | $(s)echo |
| 1448 | $(s)echo "Built $@ successfully" |
| 1449 | $(s)echo "FWU certificates can be found in ${BUILD_PLAT}" |
| 1450 | $(s)echo |
Jayanth Dodderi Chidanand | c5e1da8 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1451 | endif #(GENERATE_COT) |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1452 | |
| 1453 | ${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} |
Pali Rohár | 4727fd1 | 2020-11-24 16:53:04 +0100 | [diff] [blame] | 1454 | $(eval ${CHECK_FWU_FIP_CMD}) |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1455 | $(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@ |
| 1456 | $(q)${FIPTOOL} info $@ |
| 1457 | $(s)echo |
| 1458 | $(s)echo "Built $@ successfully" |
| 1459 | $(s)echo |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1460 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1461 | fiptool: ${FIPTOOL} |
| 1462 | fip: ${BUILD_PLAT}/${FIP_NAME} |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1463 | fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} |
Juan Castillo | 6f97162 | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1464 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1465 | ${FIPTOOL}: FORCE |
Manish V Badarkhe | 40469bf | 2024-10-03 20:50:04 +0100 | [diff] [blame] | 1466 | $(q)${MAKE} PLAT=${PLAT} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${FIPTOOLPATH} all |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1467 | |
Manish V Badarkhe | e4a070e | 2024-12-03 21:46:51 +0000 | [diff] [blame] | 1468 | $(BUILD_PLAT)/romlib/romlib.bin $(BUILD_PLAT)/lib/libwrappers.a $&: $(BUILD_PLAT)/lib/libfdt.a $(BUILD_PLAT)/lib/libc.a $(CRYPTO_LIB) |
| 1469 | $(q)${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} CRYPTO_SUPPORT=${CRYPTO_SUPPORT} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES=$(call escape-shell,$(INCLUDES)) DEFINES=$(call escape-shell,$(DEFINES)) --no-print-directory -C ${ROMLIBPATH} all |
Roberto Vargas | 5accce5 | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1470 | |
Louis Mayencourt | cfe8391 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1471 | memmap: all |
Chris Kay | c25405d | 2025-03-10 09:24:34 +0000 | [diff] [blame] | 1472 | $(if $(host-poetry),$(q)poetry -q install --no-root) |
Chris Kay | 8daebef | 2025-04-15 14:00:50 +0100 | [diff] [blame] | 1473 | $(q)$(if $(host-poetry),poetry run )memory symbols --root ${BUILD_PLAT} |
Louis Mayencourt | cfe8391 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1474 | |
Harrison Mutai | 2329e22 | 2024-08-28 13:27:19 +0000 | [diff] [blame] | 1475 | tl: ${BUILD_PLAT}/tl.bin |
| 1476 | ${BUILD_PLAT}/tl.bin: ${HW_CONFIG} |
Chris Kay | c25405d | 2025-03-10 09:24:34 +0000 | [diff] [blame] | 1477 | $(if $(host-poetry),$(q)poetry -q install --no-root) |
Chris Kay | d286739 | 2024-09-26 14:18:04 +0000 | [diff] [blame] | 1478 | $(q)$(if $(host-poetry),poetry run )tlc create --fdt $< -s ${FW_HANDOFF_SIZE} $@ |
Harrison Mutai | 2329e22 | 2024-08-28 13:27:19 +0000 | [diff] [blame] | 1479 | |
Madhukar Pappireddy | 6de3237 | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 1480 | doc: |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1481 | $(s)echo " BUILD DOCUMENTATION" |
Harrison Mutai | c61c9a3 | 2025-05-15 08:47:34 +0000 | [diff] [blame] | 1482 | $(if $(host-poetry),$(q)poetry -q install --with docs --no-root) |
| 1483 | $(q)$(if $(host-poetry),poetry run )${MAKE} --no-print-directory -C ${DOCS_PATH} html |
Madhukar Pappireddy | 6de3237 | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 1484 | |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1485 | enctool: ${ENCTOOL} |
| 1486 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1487 | ${ENCTOOL}: FORCE |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1488 | $(q)${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} --no-print-directory -C ${ENCTOOLPATH} all |
| 1489 | $(s)echo |
| 1490 | $(s)echo "Built $@ successfully" |
| 1491 | $(s)echo |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1492 | |
Joakim Bech | 35fab8c | 2014-01-23 14:51:49 +0100 | [diff] [blame] | 1493 | cscope: |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1494 | $(s)echo " CSCOPE" |
| 1495 | $(q)find ${CURDIR} -name "*.[chsS]" > cscope.files |
| 1496 | $(q)cscope -b -q -k |
Joakim Bech | 35fab8c | 2014-01-23 14:51:49 +0100 | [diff] [blame] | 1497 | |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1498 | help: |
Chris Kay | 7c4e1ee | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1499 | $(s)echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" |
| 1500 | $(s)echo "" |
| 1501 | $(s)echo "PLAT is used to specify which platform you wish to build." |
| 1502 | $(s)echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" |
| 1503 | $(s)echo "" |
| 1504 | $(s)echo "platform = ${PLATFORM_LIST}" |
| 1505 | $(s)echo "" |
| 1506 | $(s)echo "Please refer to the User Guide for a list of all supported options." |
| 1507 | $(s)echo "Note that the build system doesn't track dependencies for build " |
| 1508 | $(s)echo "options. Therefore, if any of the build options are changed " |
| 1509 | $(s)echo "from a previous build, a clean build must be performed." |
| 1510 | $(s)echo "" |
| 1511 | $(s)echo "Supported Targets:" |
| 1512 | $(s)echo " all Build all individual bootloader binaries" |
| 1513 | $(s)echo " bl1 Build the BL1 binary" |
| 1514 | $(s)echo " bl2 Build the BL2 binary" |
| 1515 | $(s)echo " bl2u Build the BL2U binary" |
| 1516 | $(s)echo " bl31 Build the BL31 binary" |
| 1517 | $(s)echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " |
| 1518 | $(s)echo " this builds secure payload specified by AARCH32_SP" |
| 1519 | $(s)echo " certificates Build the certificates (requires 'GENERATE_COT=1')" |
| 1520 | $(s)echo " fip Build the Firmware Image Package (FIP)" |
| 1521 | $(s)echo " fwu_fip Build the FWU Firmware Image Package (FIP)" |
| 1522 | $(s)echo " checkcodebase Check the coding style of the entire source tree" |
| 1523 | $(s)echo " checkpatch Check the coding style on changes in the current" |
| 1524 | $(s)echo " branch against BASE_COMMIT (default origin/master)" |
| 1525 | $(s)echo " clean Clean the build for the selected platform" |
| 1526 | $(s)echo " cscope Generate cscope index" |
| 1527 | $(s)echo " distclean Remove all build artifacts for all platforms" |
| 1528 | $(s)echo " certtool Build the Certificate generation tool" |
| 1529 | $(s)echo " enctool Build the Firmware encryption tool" |
| 1530 | $(s)echo " fiptool Build the Firmware Image Package (FIP) creation tool" |
| 1531 | $(s)echo " sp Build the Secure Partition Packages" |
| 1532 | $(s)echo " sptool Build the Secure Partition Package creation tool" |
| 1533 | $(s)echo " dtbs Build the Device Tree Blobs (if required for the platform)" |
| 1534 | $(s)echo " memmap Print the memory map of the built binaries" |
| 1535 | $(s)echo " doc Build html based documentation using Sphinx tool" |
| 1536 | $(s)echo "" |
| 1537 | $(s)echo "Note: most build targets require PLAT to be set to a specific platform." |
| 1538 | $(s)echo "" |
| 1539 | $(s)echo "example: build all targets for the FVP platform:" |
| 1540 | $(s)echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1541 | |
| 1542 | .PHONY: FORCE |
| 1543 | FORCE:; |