Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | # |
Varun Wadekar | c7e8bda | 2023-02-10 21:23:51 +0000 | [diff] [blame] | 2 | # Copyright (c) 2013-2023, 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 |
laurenw-arm | 0fa7fe5 | 2022-11-15 10:15:34 -0600 | [diff] [blame] | 11 | VERSION_MINOR := 8 |
Release CI | 8b76bf0 | 2025-02-21 15:16:31 +0000 | [diff] [blame] | 12 | VERSION_PATCH := 30 |
Varun Wadekar | c7e8bda | 2023-02-10 21:23:51 +0000 | [diff] [blame] | 13 | VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} |
Juan Castillo | aaa3e72 | 2014-06-30 11:41:46 +0100 | [diff] [blame] | 14 | |
Juan Castillo | 8815467 | 2015-10-22 11:34:44 +0100 | [diff] [blame] | 15 | # Default goal is build all images |
| 16 | .DEFAULT_GOAL := all |
| 17 | |
Douglas Raillard | 72fc70e | 2016-12-28 14:47:50 +0000 | [diff] [blame] | 18 | # Avoid any implicit propagation of command line variable definitions to |
| 19 | # sub-Makefiles, like CFLAGS that we reserved for the firmware images' |
| 20 | # usage. Other command line options like "-s" are still propagated as usual. |
| 21 | MAKEOVERRIDES = |
| 22 | |
Evan Lloyd | 231c147 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 23 | MAKE_HELPERS_DIRECTORY := make_helpers/ |
| 24 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Evan Lloyd | e7f54db | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 25 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 26 | |
| 27 | ################################################################################ |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 28 | # Default values for build configurations, and their dependencies |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 29 | ################################################################################ |
Jeenu Viswambharan | e35c404 | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 30 | |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 31 | include ${MAKE_HELPERS_DIRECTORY}defaults.mk |
dp-arm | 872be88 | 2016-09-19 11:18:44 +0100 | [diff] [blame] | 32 | |
Antonio Nino Diaz | cc8b563 | 2017-04-18 15:16:05 +0100 | [diff] [blame] | 33 | # Assertions enabled for DEBUG builds by default |
Antonio Nino Diaz | cc8b563 | 2017-04-18 15:16:05 +0100 | [diff] [blame] | 34 | ENABLE_ASSERTIONS := ${DEBUG} |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 35 | ENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} |
| 36 | PLAT := ${DEFAULT_PLAT} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 37 | |
| 38 | ################################################################################ |
| 39 | # Checkpatch script options |
| 40 | ################################################################################ |
| 41 | |
Sandrine Bailleux | f607739 | 2016-06-02 11:19:59 +0100 | [diff] [blame] | 42 | CHECKCODE_ARGS := --no-patch |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 43 | # 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] | 44 | INC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 45 | include/drivers/arm, \ |
| 46 | $(wildcard include/drivers/*))) |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 47 | INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 48 | include/lib/libfdt \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 49 | include/lib/libc, \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 50 | $(wildcard include/lib/*))) |
| 51 | INC_DIRS_TO_CHECK := $(sort $(filter-out \ |
Gilad Ben-Yossef | 4501843 | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 52 | include/lib \ |
| 53 | include/drivers, \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 54 | $(wildcard include/*))) |
| 55 | LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
dp-arm | d801fbb | 2017-05-04 12:15:35 +0100 | [diff] [blame] | 56 | lib/compiler-rt \ |
Antonio Nino Diaz | 55cdcf7 | 2017-01-16 17:20:45 +0000 | [diff] [blame] | 57 | lib/libfdt% \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 58 | lib/libc, \ |
Daniel Boulby | a194255 | 2022-10-05 11:05:22 +0100 | [diff] [blame] | 59 | lib/zlib \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 60 | $(wildcard lib/*))) |
| 61 | ROOT_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 62 | lib \ |
| 63 | include \ |
| 64 | docs \ |
Paul Beesley | 1ef3551 | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 65 | %.rst, \ |
Dan Handley | f0b489c | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 66 | $(wildcard *))) |
| 67 | CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ |
| 68 | ${INC_DIRS_TO_CHECK} \ |
| 69 | ${INC_LIB_DIRS_TO_CHECK} \ |
Gilad Ben-Yossef | 4501843 | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 70 | ${LIB_DIRS_TO_CHECK} \ |
| 71 | ${INC_DRV_DIRS_TO_CHECK} \ |
| 72 | ${INC_ARM_DIRS_TO_CHECK} |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 73 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 74 | |
| 75 | ################################################################################ |
| 76 | # Process build options |
| 77 | ################################################################################ |
| 78 | |
| 79 | # Verbose flag |
Jeenu Viswambharan | e35c404 | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 80 | ifeq (${V},0) |
Evan Lloyd | b169f6a | 2015-12-03 09:47:51 +0000 | [diff] [blame] | 81 | Q:=@ |
Andre Przywara | ee1ba6d | 2018-09-27 10:56:05 +0100 | [diff] [blame] | 82 | ECHO:=@echo |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 83 | CHECKCODE_ARGS += --no-summary --terse |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 84 | else |
Evan Lloyd | b169f6a | 2015-12-03 09:47:51 +0000 | [diff] [blame] | 85 | Q:= |
Antonio Nino Diaz | b5a0f4b | 2018-10-19 15:44:30 +0100 | [diff] [blame] | 86 | ECHO:=$(ECHO_QUIET) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 87 | endif |
Andre Przywara | ee1ba6d | 2018-09-27 10:56:05 +0100 | [diff] [blame] | 88 | |
| 89 | ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) |
| 90 | Q:=@ |
Antonio Nino Diaz | b5a0f4b | 2018-10-19 15:44:30 +0100 | [diff] [blame] | 91 | ECHO:=$(ECHO_QUIET) |
Andre Przywara | ee1ba6d | 2018-09-27 10:56:05 +0100 | [diff] [blame] | 92 | endif |
| 93 | |
| 94 | export Q ECHO |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 95 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 96 | # The cert_create tool cannot generate certificates individually, so we use the |
| 97 | # target 'certificates' to create them all |
| 98 | ifneq (${GENERATE_COT},0) |
| 99 | FIP_DEPS += certificates |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 100 | FWU_FIP_DEPS += fwu_certificates |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 101 | endif |
| 102 | |
Alexei Fedorov | 9fc5963 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 103 | # Process BRANCH_PROTECTION value and set |
| 104 | # Pointer Authentication and Branch Target Identification flags |
| 105 | ifeq (${BRANCH_PROTECTION},0) |
| 106 | # Default value turns off all types of branch protection |
| 107 | BP_OPTION := none |
| 108 | else ifneq (${ARCH},aarch64) |
| 109 | $(error BRANCH_PROTECTION requires AArch64) |
| 110 | else ifeq (${BRANCH_PROTECTION},1) |
| 111 | # Enables all types of branch protection features |
| 112 | BP_OPTION := standard |
| 113 | ENABLE_BTI := 1 |
| 114 | ENABLE_PAUTH := 1 |
| 115 | else ifeq (${BRANCH_PROTECTION},2) |
| 116 | # Return address signing to its standard level |
| 117 | BP_OPTION := pac-ret |
| 118 | ENABLE_PAUTH := 1 |
| 119 | else ifeq (${BRANCH_PROTECTION},3) |
| 120 | # Extend the signing to include leaf functions |
| 121 | BP_OPTION := pac-ret+leaf |
| 122 | ENABLE_PAUTH := 1 |
Alexei Fedorov | 3768fec | 2020-06-19 14:33:49 +0100 | [diff] [blame] | 123 | else ifeq (${BRANCH_PROTECTION},4) |
| 124 | # Turn on branch target identification mechanism |
| 125 | BP_OPTION := bti |
| 126 | ENABLE_BTI := 1 |
Alexei Fedorov | 9fc5963 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 127 | else |
| 128 | $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) |
| 129 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 130 | |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 131 | # FEAT_RME |
| 132 | ifeq (${ENABLE_RME},1) |
| 133 | # RME doesn't support PIE |
| 134 | ifneq (${ENABLE_PIE},0) |
| 135 | $(error ENABLE_RME does not support PIE) |
| 136 | endif |
johpow01 | 744ad97 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 137 | # RME doesn't support BRBE |
| 138 | ifneq (${ENABLE_BRBE_FOR_NS},0) |
| 139 | $(error ENABLE_RME does not support BRBE.) |
| 140 | endif |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 141 | # RME requires AARCH64 |
| 142 | ifneq (${ARCH},aarch64) |
| 143 | $(error ENABLE_RME requires AArch64) |
| 144 | endif |
| 145 | # RME requires el2 context to be saved for now. |
| 146 | CTX_INCLUDE_EL2_REGS := 1 |
| 147 | CTX_INCLUDE_AARCH32_REGS := 0 |
| 148 | ARM_ARCH_MAJOR := 8 |
Andre Przywara | 7670ddb | 2022-10-04 13:56:49 +0100 | [diff] [blame] | 149 | ARM_ARCH_MINOR := 5 |
| 150 | ENABLE_FEAT_ECV = 1 |
| 151 | ENABLE_FEAT_FGT = 1 |
| 152 | |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 153 | endif |
| 154 | |
Soby Mathew | c97cba4 | 2019-09-25 14:03:41 +0100 | [diff] [blame] | 155 | # USE_SPINLOCK_CAS requires AArch64 build |
| 156 | ifeq (${USE_SPINLOCK_CAS},1) |
| 157 | ifneq (${ARCH},aarch64) |
| 158 | $(error USE_SPINLOCK_CAS requires AArch64) |
Soby Mathew | c97cba4 | 2019-09-25 14:03:41 +0100 | [diff] [blame] | 159 | endif |
| 160 | endif |
| 161 | |
Olivier Deprez | 0ca3913 | 2019-09-19 17:46:46 +0200 | [diff] [blame] | 162 | # USE_DEBUGFS experimental feature recommended only in debug builds |
| 163 | ifeq (${USE_DEBUGFS},1) |
| 164 | ifeq (${DEBUG},1) |
| 165 | $(warning DEBUGFS experimental feature is enabled.) |
| 166 | else |
| 167 | $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY) |
| 168 | endif |
| 169 | endif |
| 170 | |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 171 | ifneq (${DECRYPTION_SUPPORT},none) |
| 172 | ENC_ARGS += -f ${FW_ENC_STATUS} |
| 173 | ENC_ARGS += -k ${ENC_KEY} |
| 174 | ENC_ARGS += -n ${ENC_NONCE} |
| 175 | FIP_DEPS += enctool |
| 176 | FWU_FIP_DEPS += enctool |
| 177 | endif |
| 178 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 179 | ################################################################################ |
| 180 | # Toolchain |
| 181 | ################################################################################ |
| 182 | |
dp-arm | 72610c4 | 2017-05-02 11:09:11 +0100 | [diff] [blame] | 183 | HOSTCC := gcc |
| 184 | export HOSTCC |
| 185 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 186 | CC := ${CROSS_COMPILE}gcc |
| 187 | CPP := ${CROSS_COMPILE}cpp |
| 188 | AS := ${CROSS_COMPILE}gcc |
| 189 | AR := ${CROSS_COMPILE}ar |
Roberto Vargas | 2adee76 | 2018-04-13 14:26:47 +0100 | [diff] [blame] | 190 | LINKER := ${CROSS_COMPILE}ld |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 191 | OC := ${CROSS_COMPILE}objcopy |
| 192 | OD := ${CROSS_COMPILE}objdump |
| 193 | NM := ${CROSS_COMPILE}nm |
| 194 | PP := ${CROSS_COMPILE}gcc -E |
Soby Mathew | 38c14d8 | 2017-12-14 17:44:56 +0000 | [diff] [blame] | 195 | DTC := dtc |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 196 | |
Julius Werner | b25a577 | 2018-01-10 15:12:47 -0800 | [diff] [blame] | 197 | # Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). |
| 198 | ifneq ($(strip $(wildcard ${LD}.bfd) \ |
Roberto Vargas | 2adee76 | 2018-04-13 14:26:47 +0100 | [diff] [blame] | 199 | $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),) |
| 200 | LINKER := ${LINKER}.bfd |
Julius Werner | b25a577 | 2018-01-10 15:12:47 -0800 | [diff] [blame] | 201 | endif |
| 202 | |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 203 | ifeq (${ARM_ARCH_MAJOR},7) |
| 204 | target32-directive = -target arm-none-eabi |
| 205 | # Will set march32-directive from platform configuration |
| 206 | else |
| 207 | target32-directive = -target armv8a-none-eabi |
Alexei Fedorov | fa6f774 | 2019-03-11 16:51:47 +0000 | [diff] [blame] | 208 | |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 209 | # Set the compiler's target architecture profile based on |
| 210 | # ARM_ARCH_MAJOR ARM_ARCH_MINOR options |
Alexei Fedorov | fa6f774 | 2019-03-11 16:51:47 +0000 | [diff] [blame] | 211 | ifeq (${ARM_ARCH_MINOR},0) |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 212 | march32-directive = -march=armv${ARM_ARCH_MAJOR}-a |
| 213 | march64-directive = -march=armv${ARM_ARCH_MAJOR}-a |
Alexei Fedorov | fa6f774 | 2019-03-11 16:51:47 +0000 | [diff] [blame] | 214 | else |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 215 | march32-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a |
| 216 | march64-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a |
Alexei Fedorov | fa6f774 | 2019-03-11 16:51:47 +0000 | [diff] [blame] | 217 | endif |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 218 | endif |
| 219 | |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 220 | # Memory tagging is supported in architecture Armv8.5-A AArch64 and onwards |
| 221 | ifeq ($(ARCH), aarch64) |
Sami Mujawar | 4a565bd | 2020-04-23 09:28:37 +0100 | [diff] [blame] | 222 | # Check if revision is greater than or equal to 8.5 |
| 223 | ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 224 | mem_tag_arch_support = yes |
| 225 | endif |
| 226 | endif |
| 227 | |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 228 | # Get architecture feature modifiers |
| 229 | arch-features = ${ARM_ARCH_FEATURE} |
| 230 | |
| 231 | # Enable required options for memory stack tagging. |
| 232 | # Currently, these options are enabled only for clang and armclang compiler. |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 233 | ifeq (${SUPPORT_STACK_MEMTAG},yes) |
| 234 | ifdef mem_tag_arch_support |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 235 | # Check for armclang and clang compilers |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 236 | ifneq ( ,$(filter $(notdir $(CC)),armclang clang)) |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 237 | # Add "memtag" architecture feature modifier if not specified |
| 238 | ifeq ( ,$(findstring memtag,$(arch-features))) |
| 239 | arch-features := $(arch-features)+memtag |
| 240 | endif # memtag |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 241 | ifeq ($(notdir $(CC)),armclang) |
| 242 | TF_CFLAGS += -mmemtag-stack |
| 243 | else ifeq ($(notdir $(CC)),clang) |
| 244 | TF_CFLAGS += -fsanitize=memtag |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 245 | endif # armclang |
| 246 | endif # armclang clang |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 247 | else |
| 248 | $(error "Error: stack memory tagging is not supported for architecture \ |
| 249 | ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a") |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 250 | endif # mem_tag_arch_support |
| 251 | endif # SUPPORT_STACK_MEMTAG |
| 252 | |
| 253 | # Set the compiler's architecture feature modifiers |
| 254 | ifneq ($(arch-features), none) |
| 255 | # Strip "none+" from arch-features |
| 256 | arch-features := $(subst none+,,$(arch-features)) |
| 257 | ifeq ($(ARCH), aarch32) |
| 258 | march32-directive := $(march32-directive)+$(arch-features) |
| 259 | else |
| 260 | march64-directive := $(march64-directive)+$(arch-features) |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 261 | endif |
Alexei Fedorov | f182179 | 2020-12-07 16:38:53 +0000 | [diff] [blame] | 262 | # Print features |
| 263 | $(info Arm Architecture Features specified: $(subst +, ,$(arch-features))) |
| 264 | endif # arch-features |
Manish V Badarkhe | 7ff088d | 2020-03-22 05:06:38 +0000 | [diff] [blame] | 265 | |
Tomas Pilar | 12cd65e | 2020-10-29 13:01:16 +0000 | [diff] [blame] | 266 | # Determine if FEAT_RNG is supported |
| 267 | ENABLE_FEAT_RNG = $(if $(findstring rng,${arch-features}),1,0) |
| 268 | |
Chris Kay | 4e04478 | 2021-03-09 13:34:35 +0000 | [diff] [blame] | 269 | # Determine if FEAT_SB is supported |
| 270 | ENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0) |
| 271 | |
origin | c8a992f | 2022-01-19 16:30:14 +0000 | [diff] [blame] | 272 | ifneq ($(findstring clang,$(notdir $(CC))),) |
| 273 | ifneq ($(findstring armclang,$(notdir $(CC))),) |
| 274 | TF_CFLAGS_aarch32 := -target arm-arm-none-eabi $(march32-directive) |
| 275 | TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi $(march64-directive) |
| 276 | LD := $(LINKER) |
| 277 | else |
Arvind Ram Prakash | 94eb127 | 2022-10-19 15:44:51 -0500 | [diff] [blame] | 278 | TF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive) |
origin | c8a992f | 2022-01-19 16:30:14 +0000 | [diff] [blame] | 279 | TF_CFLAGS_aarch64 := -target aarch64-elf $(march64-directive) |
| 280 | LD := $(shell $(CC) --print-prog-name ld.lld) |
| 281 | |
| 282 | AR := $(shell $(CC) --print-prog-name llvm-ar) |
| 283 | OD := $(shell $(CC) --print-prog-name llvm-objdump) |
| 284 | OC := $(shell $(CC) --print-prog-name llvm-objcopy) |
| 285 | endif |
| 286 | |
| 287 | CPP := $(CC) -E $(TF_CFLAGS_$(ARCH)) |
| 288 | PP := $(CC) -E $(TF_CFLAGS_$(ARCH)) |
| 289 | AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) |
zelalem-aweke | edbce9a | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 290 | else ifneq ($(findstring gcc,$(notdir $(CC))),) |
| 291 | TF_CFLAGS_aarch32 = $(march32-directive) |
| 292 | TF_CFLAGS_aarch64 = $(march64-directive) |
| 293 | ifeq ($(ENABLE_LTO),1) |
| 294 | # Enable LTO only for aarch64 |
| 295 | ifeq (${ARCH},aarch64) |
| 296 | LTO_CFLAGS = -flto |
| 297 | # Use gcc as a wrapper for the ld, recommended for LTO |
| 298 | LINKER := ${CROSS_COMPILE}gcc |
| 299 | endif |
| 300 | endif |
| 301 | LD = $(LINKER) |
dp-arm | d546185 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 302 | else |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 303 | TF_CFLAGS_aarch32 = $(march32-directive) |
Alexei Fedorov | fa6f774 | 2019-03-11 16:51:47 +0000 | [diff] [blame] | 304 | TF_CFLAGS_aarch64 = $(march64-directive) |
Roberto Vargas | 2adee76 | 2018-04-13 14:26:47 +0100 | [diff] [blame] | 305 | LD = $(LINKER) |
dp-arm | d546185 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 306 | endif |
| 307 | |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 308 | # Process Debug flag |
| 309 | $(eval $(call add_define,DEBUG)) |
| 310 | ifneq (${DEBUG}, 0) |
| 311 | BUILD_TYPE := debug |
Daniel Boulby | 4466cf8 | 2022-05-03 16:46:16 +0100 | [diff] [blame] | 312 | TF_CFLAGS += -g -gdwarf-4 |
| 313 | ASFLAGS += -g -Wa,-gdwarf-4 |
Ahmad Fatoum | 32b209b | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 314 | |
| 315 | # Use LOG_LEVEL_INFO by default for debug builds |
| 316 | LOG_LEVEL := 40 |
| 317 | else |
| 318 | BUILD_TYPE := release |
| 319 | # Use LOG_LEVEL_NOTICE by default for release builds |
| 320 | LOG_LEVEL := 20 |
| 321 | endif |
| 322 | |
Peiyuan Song | f1de4c8 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 323 | # Default build string (git branch and commit) |
| 324 | ifeq (${BUILD_STRING},) |
| 325 | BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) |
| 326 | endif |
Varun Wadekar | c7e8bda | 2023-02-10 21:23:51 +0000 | [diff] [blame] | 327 | VERSION_STRING := lts-v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} |
Peiyuan Song | f1de4c8 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 328 | |
Antonio Nino Diaz | 8fd9d4d | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 329 | ifeq (${AARCH32_INSTRUCTION_SET},A32) |
| 330 | TF_CFLAGS_aarch32 += -marm |
| 331 | else ifeq (${AARCH32_INSTRUCTION_SET},T32) |
| 332 | TF_CFLAGS_aarch32 += -mthumb |
| 333 | else |
| 334 | $(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET}) |
| 335 | endif |
| 336 | |
Sandrine Bailleux | a9c4dde | 2018-07-03 09:14:45 +0200 | [diff] [blame] | 337 | TF_CFLAGS_aarch32 += -mno-unaligned-access |
dp-arm | d546185 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 338 | TF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 339 | |
Alexei Fedorov | 9fc5963 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 340 | ifneq (${BP_OPTION},none) |
| 341 | TF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} |
| 342 | endif |
| 343 | |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 344 | ASFLAGS_aarch32 = $(march32-directive) |
Alexei Fedorov | fa6f774 | 2019-03-11 16:51:47 +0000 | [diff] [blame] | 345 | ASFLAGS_aarch64 = $(march64-directive) |
Antonio Nino Diaz | b86048c | 2019-02-19 11:53:51 +0000 | [diff] [blame] | 346 | |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 347 | # General warnings |
| 348 | WARNINGS := -Wall -Wmissing-include-dirs -Wunused \ |
Yann Gautier | 34b508b | 2021-05-20 13:18:14 +0200 | [diff] [blame] | 349 | -Wdisabled-optimization -Wvla -Wshadow \ |
Madhukar Pappireddy | ca661a0 | 2019-12-23 14:49:52 -0600 | [diff] [blame] | 350 | -Wno-unused-parameter -Wredundant-decls |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 351 | |
| 352 | # Additional warnings |
| 353 | # Level 1 |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 354 | WARNING1 := -Wextra |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 355 | WARNING1 += -Wmissing-format-attribute |
| 356 | WARNING1 += -Wmissing-prototypes |
| 357 | WARNING1 += -Wold-style-definition |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 358 | |
Justin Chadwell | b7f6525 | 2019-09-17 15:21:50 +0100 | [diff] [blame] | 359 | # Level 2 |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 360 | WARNING2 := -Waggregate-return |
| 361 | WARNING2 += -Wcast-align |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 362 | WARNING2 += -Wnested-externs |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 363 | |
| 364 | WARNING3 := -Wbad-function-cast |
| 365 | WARNING3 += -Wcast-qual |
| 366 | WARNING3 += -Wconversion |
| 367 | WARNING3 += -Wpacked |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 368 | WARNING3 += -Wpointer-arith |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 369 | WARNING3 += -Wswitch-default |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 370 | |
| 371 | ifeq (${W},1) |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 372 | WARNINGS += $(WARNING1) |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 373 | else ifeq (${W},2) |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 374 | WARNINGS += $(WARNING1) $(WARNING2) |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 375 | else ifeq (${W},3) |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 376 | WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) |
Yann Gautier | e7c645b | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 377 | endif |
| 378 | |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 379 | # Compiler specific warnings |
Ambroise Vincent | 0029657 | 2019-05-24 12:47:43 +0100 | [diff] [blame] | 380 | ifeq ($(findstring clang,$(notdir $(CC))),) |
Justin Chadwell | 93c690e | 2019-07-03 14:15:56 +0100 | [diff] [blame] | 381 | # not using clang |
Justin Chadwell | d7b4cd4 | 2019-09-18 14:13:42 +0100 | [diff] [blame] | 382 | WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ |
| 383 | -Wpacked-bitfield-compat -Wshift-overflow=2 \ |
| 384 | -Wlogical-op |
Govindraj Raja | 8c1c54e | 2023-05-05 09:09:36 -0500 | [diff] [blame] | 385 | |
| 386 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 |
| 387 | TF_CFLAGS += $(call cc_option, --param=min-pagesize=0) |
| 388 | |
Yann Gautier | 7ecb8ad | 2023-12-04 09:59:23 +0100 | [diff] [blame] | 389 | ifeq ($(HARDEN_SLS), 1) |
| 390 | TF_CFLAGS_aarch64 += $(call cc_option, -mharden-sls=all) |
| 391 | endif |
| 392 | |
Justin Chadwell | 93c690e | 2019-07-03 14:15:56 +0100 | [diff] [blame] | 393 | else |
| 394 | # using clang |
Justin Chadwell | d7b4cd4 | 2019-09-18 14:13:42 +0100 | [diff] [blame] | 395 | WARNINGS += -Wshift-overflow -Wshift-sign-overflow \ |
| 396 | -Wlogical-op-parentheses |
Ambroise Vincent | 0029657 | 2019-05-24 12:47:43 +0100 | [diff] [blame] | 397 | endif |
| 398 | |
Yann Gautier | 6336b07 | 2018-12-10 18:08:53 +0100 | [diff] [blame] | 399 | ifneq (${E},0) |
| 400 | ERRORS := -Werror |
| 401 | endif |
| 402 | |
Justin Chadwell | 9ab81b5 | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 403 | CPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ |
| 404 | $(ERRORS) $(WARNINGS) |
Masahiro Yamada | 59de509 | 2016-12-22 12:51:53 +0900 | [diff] [blame] | 405 | ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ |
Julius Werner | d5dfdeb | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 406 | -ffreestanding -Wa,--fatal-warnings |
Masahiro Yamada | 59de509 | 2016-12-22 12:51:53 +0900 | [diff] [blame] | 407 | TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ |
Samuel Holland | ebd6efa | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 408 | -ffunction-sections -fdata-sections \ |
| 409 | -ffreestanding -fno-builtin -fno-common \ |
| 410 | -Os -std=gnu99 |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 411 | |
Mark Brown | bebcf27 | 2022-04-20 18:14:32 +0100 | [diff] [blame] | 412 | $(eval $(call add_define,SVE_VECTOR_LEN)) |
| 413 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 414 | ifeq (${SANITIZE_UB},on) |
| 415 | TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover |
| 416 | endif |
| 417 | ifeq (${SANITIZE_UB},trap) |
| 418 | TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ |
| 419 | -fsanitize-undefined-trap-on-error |
| 420 | endif |
| 421 | |
david cunado | f7ec31d | 2017-11-30 21:58:01 +0000 | [diff] [blame] | 422 | GCC_V_OUTPUT := $(shell $(CC) -v 2>&1) |
david cunado | f7ec31d | 2017-11-30 21:58:01 +0000 | [diff] [blame] | 423 | |
Marco Felsch | 1fdc979 | 2022-11-09 12:59:09 +0100 | [diff] [blame] | 424 | TF_LDFLAGS += -z noexecstack |
| 425 | |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 426 | # LD = armlink |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 427 | ifneq ($(findstring armlink,$(notdir $(LD))),) |
| 428 | TF_LDFLAGS += --diag_error=warning --lto_level=O1 |
| 429 | TF_LDFLAGS += --remove --info=unused,unusedsymbols |
zelalem-aweke | edbce9a | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 430 | TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 431 | |
| 432 | # LD = gcc (used when GCC LTO is enabled) |
zelalem-aweke | edbce9a | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 433 | else ifneq ($(findstring gcc,$(notdir $(LD))),) |
| 434 | # Pass ld options with Wl or Xlinker switches |
| 435 | TF_LDFLAGS += -Wl,--fatal-warnings -O1 |
| 436 | TF_LDFLAGS += -Wl,--gc-sections |
| 437 | ifeq ($(ENABLE_LTO),1) |
| 438 | ifeq (${ARCH},aarch64) |
| 439 | TF_LDFLAGS += -flto -fuse-linker-plugin |
| 440 | endif |
| 441 | endif |
| 442 | # GCC automatically adds fix-cortex-a53-843419 flag when used to link |
| 443 | # which breaks some builds, so disable if errata fix is not explicitly enabled |
| 444 | ifneq (${ERRATA_A53_843419},1) |
| 445 | TF_LDFLAGS += -mno-fix-cortex-a53-843419 |
| 446 | endif |
| 447 | TF_LDFLAGS += -nostdlib |
| 448 | TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 449 | |
| 450 | # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 451 | else |
Marco Felsch | 1fdc979 | 2022-11-09 12:59:09 +0100 | [diff] [blame] | 452 | # With ld.bfd version 2.39 and newer new warnings are added. Skip those since we |
| 453 | # are not loaded by a elf loader. |
| 454 | TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) |
Yabin Cui | 37bee49 | 2023-01-19 20:06:04 +0000 | [diff] [blame] | 455 | TF_LDFLAGS += -O1 |
Douglas Raillard | c2b8806 | 2017-06-22 14:44:48 +0100 | [diff] [blame] | 456 | TF_LDFLAGS += --gc-sections |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 457 | # ld.lld doesn't recognize the errata flags, |
Yabin Cui | 37bee49 | 2023-01-19 20:06:04 +0000 | [diff] [blame] | 458 | # therefore don't add those in that case. |
| 459 | # ld.lld reports section type mismatch warnings, |
| 460 | # therefore don't add --fatal-warnings to it. |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 461 | ifeq ($(findstring ld.lld,$(notdir $(LD))),) |
Yabin Cui | 37bee49 | 2023-01-19 20:06:04 +0000 | [diff] [blame] | 462 | TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings |
zelalem-aweke | edbce9a | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 463 | endif |
Ambroise Vincent | 641f16e | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 464 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 465 | |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 466 | DTC_FLAGS += -I dts -O dtb |
Louis Mayencourt | a6de824 | 2020-02-28 16:57:30 +0000 | [diff] [blame] | 467 | DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ |
| 468 | -x assembler-with-cpp $(DEFINES) |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 469 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 470 | ################################################################################ |
| 471 | # Common sources and include directories |
| 472 | ################################################################################ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 473 | include ${MAKE_HELPERS_DIRECTORY}arch_features.mk |
dp-arm | d801fbb | 2017-05-04 12:15:35 +0100 | [diff] [blame] | 474 | include lib/compiler-rt/compiler-rt.mk |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 475 | |
| 476 | BL_COMMON_SOURCES += common/bl_common.c \ |
Soby Mathew | 7f56e9a | 2017-09-04 11:49:29 +0100 | [diff] [blame] | 477 | common/tf_log.c \ |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 478 | common/${ARCH}/debug.S \ |
Julius Werner | 91b48c9 | 2018-11-27 22:10:56 -0800 | [diff] [blame] | 479 | drivers/console/multi_console.c \ |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 480 | lib/${ARCH}/cache_helpers.S \ |
| 481 | lib/${ARCH}/misc_helpers.S \ |
Soby Mathew | 566034f | 2018-02-08 17:45:12 +0000 | [diff] [blame] | 482 | plat/common/plat_bl_common.c \ |
Soby Mathew | 7f56e9a | 2017-09-04 11:49:29 +0100 | [diff] [blame] | 483 | plat/common/plat_log_common.c \ |
dp-arm | 7531120 | 2017-03-07 11:02:47 +0000 | [diff] [blame] | 484 | plat/common/${ARCH}/plat_common.c \ |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 485 | plat/common/${ARCH}/platform_helpers.S \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 486 | ${COMPILER_RT_SRCS} |
Ryan Harkin | d7a6b0f | 2014-01-13 14:40:13 +0000 | [diff] [blame] | 487 | |
Antonio Nino Diaz | 8422a84 | 2018-08-16 15:42:44 +0100 | [diff] [blame] | 488 | ifeq ($(notdir $(CC)),armclang) |
| 489 | BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S |
| 490 | endif |
| 491 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 492 | ifeq (${SANITIZE_UB},on) |
| 493 | BL_COMMON_SOURCES += plat/common/ubsan.c |
| 494 | endif |
| 495 | |
Yann Gautier | 01d237c | 2018-06-18 16:00:23 +0200 | [diff] [blame] | 496 | INCLUDES += -Iinclude \ |
Antonio Nino Diaz | f5478de | 2018-12-17 17:20:57 +0000 | [diff] [blame] | 497 | -Iinclude/arch/${ARCH} \ |
Antonio Nino Diaz | 09d40e0 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 498 | -Iinclude/lib/cpus/${ARCH} \ |
| 499 | -Iinclude/lib/el3_runtime/${ARCH} \ |
| 500 | ${PLAT_INCLUDES} \ |
| 501 | ${SPD_INCLUDES} |
| 502 | |
Antonio Nino Diaz | 9c6d1c5 | 2018-11-19 11:48:30 +0000 | [diff] [blame] | 503 | include common/backtrace/backtrace.mk |
| 504 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 505 | ################################################################################ |
| 506 | # Generic definitions |
| 507 | ################################################################################ |
| 508 | |
Evan Lloyd | 231c147 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 509 | include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk |
| 510 | |
Grant Likely | 29214e9 | 2020-07-30 08:50:10 +0100 | [diff] [blame] | 511 | ifeq (${BUILD_BASE},) |
| 512 | BUILD_BASE := ./build |
| 513 | endif |
| 514 | BUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 515 | |
Evan Lloyd | 231c147 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 516 | SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 517 | |
| 518 | # Platforms providing their own TBB makefile may override this value |
| 519 | INCLUDE_TBBR_MK := 1 |
| 520 | |
| 521 | |
| 522 | ################################################################################ |
| 523 | # Include SPD Makefile if one has been specified |
| 524 | ################################################################################ |
| 525 | |
| 526 | ifneq (${SPD},none) |
Max Shvetsov | 28f39f0 | 2020-02-25 13:56:19 +0000 | [diff] [blame] | 527 | ifeq (${ARCH},aarch32) |
Sandrine Bailleux | 44a8738 | 2018-10-03 14:56:38 +0200 | [diff] [blame] | 528 | $(error "Error: SPD is incompatible with AArch32.") |
Max Shvetsov | 28f39f0 | 2020-02-25 13:56:19 +0000 | [diff] [blame] | 529 | endif |
| 530 | |
| 531 | ifdef EL3_PAYLOAD_BASE |
Sandrine Bailleux | 4c117f6 | 2015-11-26 16:31:34 +0000 | [diff] [blame] | 532 | $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") |
| 533 | $(warning "The SPD and its BL32 companion will be present but ignored.") |
Max Shvetsov | 28f39f0 | 2020-02-25 13:56:19 +0000 | [diff] [blame] | 534 | endif |
Achin Gupta | c3fb00d | 2019-10-11 15:50:43 +0100 | [diff] [blame] | 535 | |
Max Shvetsov | 28f39f0 | 2020-02-25 13:56:19 +0000 | [diff] [blame] | 536 | ifeq (${SPD},spmd) |
| 537 | # SPMD is located in std_svc directory |
| 538 | SPD_DIR := std_svc |
Achin Gupta | c3fb00d | 2019-10-11 15:50:43 +0100 | [diff] [blame] | 539 | |
Max Shvetsov | 033039f | 2020-02-25 13:55:00 +0000 | [diff] [blame] | 540 | ifeq ($(SPMD_SPM_AT_SEL2),1) |
| 541 | ifeq ($(CTX_INCLUDE_EL2_REGS),0) |
| 542 | $(error SPMD with SPM at S-EL2 requires CTX_INCLUDE_EL2_REGS option) |
| 543 | endif |
Marc Bonnici | 1d63ae4 | 2021-12-01 18:00:40 +0000 | [diff] [blame] | 544 | ifeq ($(SPMC_AT_EL3),1) |
| 545 | $(error SPM cannot be enabled in both S-EL2 and EL3.) |
| 546 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 547 | endif |
Olivier Deprez | db1ef41 | 2020-04-01 21:28:26 +0200 | [diff] [blame] | 548 | |
| 549 | ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) |
| 550 | DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG |
| 551 | endif |
Davidson K | ca93248 | 2021-03-10 12:07:15 +0530 | [diff] [blame] | 552 | |
| 553 | ifeq ($(TS_SP_FW_CONFIG),1) |
| 554 | DTC_CPPFLAGS += -DTS_SP_FW_CONFIG |
| 555 | endif |
Balint Dobszay | 33993a3 | 2021-03-26 15:19:11 +0100 | [diff] [blame] | 556 | |
| 557 | ifneq ($(ARM_BL2_SP_LIST_DTS),) |
| 558 | DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) |
| 559 | endif |
Balint Dobszay | 46789a7 | 2021-03-26 16:23:18 +0100 | [diff] [blame] | 560 | |
| 561 | ifneq ($(SP_LAYOUT_FILE),) |
| 562 | BL2_ENABLE_SP_LOAD := 1 |
| 563 | endif |
Max Shvetsov | 28f39f0 | 2020-02-25 13:56:19 +0000 | [diff] [blame] | 564 | else |
| 565 | # All other SPDs in spd directory |
| 566 | SPD_DIR := spd |
| 567 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 568 | |
Max Shvetsov | 28f39f0 | 2020-02-25 13:56:19 +0000 | [diff] [blame] | 569 | # We expect to locate an spd.mk under the specified SPD directory |
| 570 | SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) |
| 571 | |
| 572 | ifeq (${SPD_MAKE},) |
| 573 | $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) |
| 574 | endif |
| 575 | $(info Including ${SPD_MAKE}) |
| 576 | include ${SPD_MAKE} |
| 577 | |
| 578 | # If there's BL32 companion for the chosen SPD, we expect that the SPD's |
| 579 | # Makefile would set NEED_BL32 to "yes". In this case, the build system |
| 580 | # supports two mutually exclusive options: |
| 581 | # * BL32 is built from source: then BL32_SOURCES must contain the list |
| 582 | # of source files to build BL32 |
| 583 | # * BL32 is a prebuilt binary: then BL32 must point to the image file |
| 584 | # that will be included in the FIP |
| 585 | # If both BL32_SOURCES and BL32 are defined, the binary takes precedence |
| 586 | # over the sources. |
Jeenu Viswambharan | e35c404 | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 587 | endif |
| 588 | |
Douglas Raillard | 51faada | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 589 | ################################################################################ |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 590 | # Include rmmd Makefile if RME is enabled |
| 591 | ################################################################################ |
| 592 | |
| 593 | ifneq (${ENABLE_RME},0) |
| 594 | ifneq (${ARCH},aarch64) |
| 595 | $(error ENABLE_RME requires AArch64) |
| 596 | endif |
Marc Bonnici | 1d63ae4 | 2021-12-01 18:00:40 +0000 | [diff] [blame] | 597 | ifeq ($(SPMC_AT_EL3),1) |
| 598 | $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) |
| 599 | endif |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 600 | include services/std_svc/rmmd/rmmd.mk |
| 601 | $(warning "RME is an experimental feature") |
| 602 | endif |
| 603 | |
| 604 | ################################################################################ |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 605 | # Include the platform specific Makefile after the SPD Makefile (the platform |
| 606 | # makefile may use all previous definitions in this file) |
| 607 | ################################################################################ |
Jeenu Viswambharan | 2da8d8b | 2014-05-12 15:28:47 +0100 | [diff] [blame] | 608 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 609 | include ${PLAT_MAKEFILE_FULL} |
Juan Castillo | 0f21c54 | 2014-06-25 17:26:36 +0100 | [diff] [blame] | 610 | |
Masahiro Yamada | 8012cc5 | 2017-11-04 03:12:28 +0900 | [diff] [blame] | 611 | $(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) |
| 612 | |
Etienne Carriere | 26e63c4 | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 613 | ifeq (${ARM_ARCH_MAJOR},7) |
| 614 | include make_helpers/armv7-a-cpus.mk |
| 615 | endif |
| 616 | |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 617 | PIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) |
| 618 | ifneq ($(PIE_FOUND),) |
| 619 | TF_CFLAGS += -fno-PIE |
Samuel Holland | 7b59241 | 2022-04-08 21:56:02 -0500 | [diff] [blame] | 620 | ifneq ($(findstring gcc,$(notdir $(LD))),) |
| 621 | TF_LDFLAGS += -no-pie |
| 622 | endif |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 623 | endif |
| 624 | |
| 625 | ifneq ($(findstring gcc,$(notdir $(LD))),) |
| 626 | PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker |
Soby Mathew | 3bd17c0 | 2018-08-28 11:13:55 +0100 | [diff] [blame] | 627 | else |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 628 | PIE_LDFLAGS += -pie --no-dynamic-linker |
| 629 | endif |
| 630 | |
| 631 | ifeq ($(ENABLE_PIE),1) |
Masahiro Yamada | 69af7fc | 2020-01-17 13:45:02 +0900 | [diff] [blame] | 632 | ifeq ($(BL2_AT_EL3),1) |
| 633 | ifneq ($(BL2_IN_XIP_MEM),1) |
| 634 | BL2_CFLAGS += -fpie |
| 635 | BL2_LDFLAGS += $(PIE_LDFLAGS) |
| 636 | endif |
| 637 | endif |
Masahiro Yamada | 320920c | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 638 | BL31_CFLAGS += -fpie |
| 639 | BL31_LDFLAGS += $(PIE_LDFLAGS) |
Masahiro Yamada | d974301 | 2020-01-17 13:45:14 +0900 | [diff] [blame] | 640 | BL32_CFLAGS += -fpie |
| 641 | BL32_LDFLAGS += $(PIE_LDFLAGS) |
| 642 | endif |
Soby Mathew | 3bd17c0 | 2018-08-28 11:13:55 +0100 | [diff] [blame] | 643 | |
Boyan Karatotev | 49d1200 | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 644 | BL1_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 645 | BL31_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 646 | BL32_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 647 | |
Masahiro Yamada | 9cefb4b | 2020-04-01 14:20:58 +0900 | [diff] [blame] | 648 | BL1_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | d5e97a1 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 649 | ifeq ($(BL2_AT_EL3),1) |
Masahiro Yamada | 9cefb4b | 2020-04-01 14:20:58 +0900 | [diff] [blame] | 650 | BL2_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | d5e97a1 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 651 | else |
Masahiro Yamada | 9cefb4b | 2020-04-01 14:20:58 +0900 | [diff] [blame] | 652 | BL2_CPPFLAGS += -DIMAGE_AT_EL1 |
Masahiro Yamada | d5e97a1 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 653 | endif |
Boyan Karatotev | 49d1200 | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 654 | |
| 655 | ifeq (${ARCH},aarch64) |
Masahiro Yamada | 9cefb4b | 2020-04-01 14:20:58 +0900 | [diff] [blame] | 656 | BL2U_CPPFLAGS += -DIMAGE_AT_EL1 |
| 657 | BL31_CPPFLAGS += -DIMAGE_AT_EL3 |
| 658 | BL32_CPPFLAGS += -DIMAGE_AT_EL1 |
Boyan Karatotev | 49d1200 | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 659 | else |
| 660 | BL32_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | d5e97a1 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 661 | endif |
| 662 | |
Sandrine Bailleux | 54035fc | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 663 | # Include the CPU specific operations makefile, which provides default |
| 664 | # values for all CPU errata workarounds and CPU specific optimisations. |
| 665 | # This can be overridden by the platform. |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 666 | include lib/cpus/cpu-ops.mk |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 667 | |
dp-arm | a440900 | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 668 | ifeq (${ARCH},aarch32) |
| 669 | NEED_BL32 := yes |
| 670 | |
| 671 | ################################################################################ |
| 672 | # Build `AARCH32_SP` as BL32 image for AArch32 |
| 673 | ################################################################################ |
| 674 | ifneq (${AARCH32_SP},none) |
| 675 | # We expect to locate an sp.mk under the specified AARCH32_SP directory |
| 676 | AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) |
| 677 | |
| 678 | ifeq (${AARCH32_SP_MAKE},) |
| 679 | $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) |
| 680 | endif |
| 681 | |
| 682 | $(info Including ${AARCH32_SP_MAKE}) |
| 683 | include ${AARCH32_SP_MAKE} |
| 684 | endif |
| 685 | |
| 686 | endif |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 687 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 688 | ################################################################################ |
Varun Wadekar | 77f1f7a | 2019-01-31 09:22:30 -0800 | [diff] [blame] | 689 | # Include libc if not overridden |
| 690 | ################################################################################ |
| 691 | ifeq (${OVERRIDE_LIBC},0) |
| 692 | include lib/libc/libc.mk |
| 693 | endif |
| 694 | |
| 695 | ################################################################################ |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 696 | # Check incompatible options |
| 697 | ################################################################################ |
| 698 | |
| 699 | ifdef EL3_PAYLOAD_BASE |
Antonio Nino Diaz | 68450a6 | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 700 | ifdef PRELOADED_BL33_BASE |
| 701 | $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ |
| 702 | incompatible build options. EL3_PAYLOAD_BASE has priority.") |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 703 | endif |
Qixiang Xu | 76580f3 | 2017-08-24 11:03:23 +0800 | [diff] [blame] | 704 | ifneq (${GENERATE_COT},0) |
| 705 | $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.") |
| 706 | endif |
| 707 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 708 | $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.") |
| 709 | endif |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 710 | endif |
| 711 | |
| 712 | ifeq (${NEED_BL33},yes) |
| 713 | ifdef EL3_PAYLOAD_BASE |
| 714 | $(warning "BL33 image is not needed when option \ |
| 715 | BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") |
| 716 | endif |
Antonio Nino Diaz | 68450a6 | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 717 | ifdef PRELOADED_BL33_BASE |
| 718 | $(warning "BL33 image is not needed when option \ |
| 719 | PRELOADED_BL33_BASE is used and won't be added to the FIP \ |
| 720 | file.") |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 721 | endif |
| 722 | endif |
| 723 | |
Jeenu Viswambharan | d4593e4 | 2017-01-06 16:14:42 +0000 | [diff] [blame] | 724 | # When building for systems with hardware-assisted coherency, there's no need to |
| 725 | # use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. |
| 726 | ifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) |
| 727 | $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) |
| 728 | endif |
Yatharth Kochar | 1a0a3f0 | 2016-06-28 16:58:26 +0100 | [diff] [blame] | 729 | |
Jiafei Pan | 7d173fc | 2018-03-21 07:20:09 +0000 | [diff] [blame] | 730 | #For now, BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is 1. |
| 731 | ifeq ($(BL2_AT_EL3)-$(BL2_IN_XIP_MEM),0-1) |
| 732 | $(error "BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is enabled") |
| 733 | endif |
| 734 | |
Jeenu Viswambharan | 14c6016 | 2018-04-04 16:07:11 +0100 | [diff] [blame] | 735 | # For RAS_EXTENSION, require that EAs are handled in EL3 first |
| 736 | ifeq ($(RAS_EXTENSION),1) |
Manish Pandey | 46cc41d | 2022-10-10 11:43:08 +0100 | [diff] [blame] | 737 | ifneq ($(HANDLE_EA_EL3_FIRST_NS),1) |
| 738 | $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST_NS must also be 1) |
Jeenu Viswambharan | 14c6016 | 2018-04-04 16:07:11 +0100 | [diff] [blame] | 739 | endif |
| 740 | endif |
| 741 | |
Jeenu Viswambharan | 1a7c1cf | 2017-12-08 12:13:51 +0000 | [diff] [blame] | 742 | # When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled |
| 743 | ifeq ($(FAULT_INJECTION_SUPPORT),1) |
| 744 | ifneq ($(RAS_EXTENSION),1) |
| 745 | $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1) |
| 746 | endif |
| 747 | endif |
| 748 | |
Roberto Vargas | ed51b51 | 2018-09-24 17:20:48 +0100 | [diff] [blame] | 749 | # DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 |
Soby Mathew | 209a60c | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 750 | ifeq ($(DYN_DISABLE_AUTH), 1) |
| 751 | ifeq (${TRUSTED_BOARD_BOOT}, 0) |
| 752 | $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.") |
| 753 | endif |
Soby Mathew | 209a60c | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 754 | endif |
| 755 | |
Manish V Badarkhe | 2bf4f27 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 756 | ifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) |
| 757 | # Support authentication verification and hash calculation |
| 758 | CRYPTO_SUPPORT := 3 |
| 759 | else ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) |
| 760 | # Support authentication verification and hash calculation |
| 761 | CRYPTO_SUPPORT := 3 |
| 762 | else ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) |
| 763 | # Support hash calculation only |
| 764 | CRYPTO_SUPPORT := 2 |
| 765 | else ifeq (${TRUSTED_BOARD_BOOT},1) |
| 766 | # Support authentication verification only |
Manish V Badarkhe | c9c56f6 | 2022-01-08 22:56:06 +0000 | [diff] [blame] | 767 | CRYPTO_SUPPORT := 1 |
| 768 | else |
| 769 | CRYPTO_SUPPORT := 0 |
| 770 | endif |
| 771 | |
Balint Dobszay | cbf9e84 | 2019-12-18 15:28:00 +0100 | [diff] [blame] | 772 | # SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. |
| 773 | ifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) |
Manish Pandey | 700e768 | 2021-10-21 21:53:49 +0100 | [diff] [blame] | 774 | $(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") |
Manish V Badarkhe | 84ef9cd | 2020-06-29 10:32:53 +0100 | [diff] [blame] | 775 | endif |
| 776 | |
Antonio Nino Diaz | b86048c | 2019-02-19 11:53:51 +0000 | [diff] [blame] | 777 | # If pointer authentication is used in the firmware, make sure that all the |
Alexei Fedorov | 9fc5963 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 778 | # registers associated to it are also saved and restored. |
| 779 | # Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. |
Antonio Nino Diaz | b86048c | 2019-02-19 11:53:51 +0000 | [diff] [blame] | 780 | ifeq ($(ENABLE_PAUTH),1) |
Alexei Fedorov | 9fc5963 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 781 | ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) |
| 782 | $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) |
| 783 | endif |
| 784 | endif |
| 785 | |
| 786 | ifeq ($(CTX_INCLUDE_PAUTH_REGS),1) |
| 787 | ifneq (${ARCH},aarch64) |
| 788 | $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) |
Alexei Fedorov | 06715f8 | 2019-03-13 11:05:07 +0000 | [diff] [blame] | 789 | endif |
Alexei Fedorov | 9fc5963 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 790 | endif |
| 791 | |
Justin Chadwell | 9dd9438 | 2019-07-18 14:25:33 +0100 | [diff] [blame] | 792 | ifeq ($(CTX_INCLUDE_MTE_REGS),1) |
| 793 | ifneq (${ARCH},aarch64) |
| 794 | $(error CTX_INCLUDE_MTE_REGS requires AArch64) |
Justin Chadwell | 9dd9438 | 2019-07-18 14:25:33 +0100 | [diff] [blame] | 795 | endif |
| 796 | endif |
| 797 | |
Manish V Badarkhe | 396b339 | 2021-06-25 23:28:59 +0100 | [diff] [blame] | 798 | ifeq ($(PSA_FWU_SUPPORT),1) |
| 799 | $(info PSA_FWU_SUPPORT is an experimental feature) |
| 800 | endif |
| 801 | |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 802 | ifeq ($(FEATURE_DETECTION),1) |
| 803 | $(info FEATURE_DETECTION is an experimental feature) |
| 804 | endif |
| 805 | |
Petre-Ionut Tudor | 60e8f3c | 2019-11-07 15:18:03 +0000 | [diff] [blame] | 806 | ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) |
| 807 | ifeq (${ALLOW_RO_XLAT_TABLES}, 1) |
| 808 | $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2") |
| 809 | endif |
| 810 | endif |
| 811 | |
Sumit Garg | 7cda17b | 2019-11-15 10:43:00 +0530 | [diff] [blame] | 812 | ifneq (${DECRYPTION_SUPPORT},none) |
| 813 | ifeq (${TRUSTED_BOARD_BOOT}, 0) |
| 814 | $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set) |
Sumit Garg | 7cda17b | 2019-11-15 10:43:00 +0530 | [diff] [blame] | 815 | endif |
| 816 | endif |
| 817 | |
johpow01 | 744ad97 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 818 | # Ensure that no Aarch64-only features are enabled in Aarch32 build |
johpow01 | dc78e62 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 819 | ifeq (${ARCH},aarch32) |
johpow01 | 744ad97 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 820 | |
| 821 | # SME/SVE only supported on AArch64 |
johpow01 | dc78e62 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 822 | ifeq (${ENABLE_SME_FOR_NS},1) |
| 823 | $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") |
| 824 | endif |
| 825 | ifeq (${ENABLE_SVE_FOR_NS},1) |
| 826 | # Warning instead of error due to CI dependency on this |
Yann Gautier | 24ab2c0 | 2021-11-19 11:35:46 +0100 | [diff] [blame] | 827 | $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") |
johpow01 | dc78e62 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 828 | endif |
johpow01 | 744ad97 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 829 | |
Juan Pablo Conde | ff86e0b | 2022-07-12 16:40:29 -0400 | [diff] [blame] | 830 | # BRBE is not supported in AArch32 |
johpow01 | 744ad97 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 831 | ifeq (${ENABLE_BRBE_FOR_NS},1) |
| 832 | $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") |
| 833 | endif |
| 834 | |
Juan Pablo Conde | ff86e0b | 2022-07-12 16:40:29 -0400 | [diff] [blame] | 835 | # FEAT_RNG_TRAP is not supported in AArch32 |
| 836 | ifeq (${ENABLE_FEAT_RNG_TRAP},1) |
| 837 | $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") |
| 838 | endif |
johpow01 | dc78e62 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 839 | endif |
| 840 | |
| 841 | # Ensure ENABLE_RME is not used with SME |
| 842 | ifeq (${ENABLE_RME},1) |
| 843 | ifeq (${ENABLE_SME_FOR_NS},1) |
| 844 | $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME") |
| 845 | endif |
| 846 | endif |
| 847 | |
| 848 | # Secure SME/SVE requires the non-secure component as well |
| 849 | ifeq (${ENABLE_SME_FOR_SWD},1) |
| 850 | ifeq (${ENABLE_SME_FOR_NS},0) |
| 851 | $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") |
| 852 | endif |
| 853 | endif |
| 854 | ifeq (${ENABLE_SVE_FOR_SWD},1) |
| 855 | ifeq (${ENABLE_SVE_FOR_NS},0) |
| 856 | $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") |
| 857 | endif |
| 858 | endif |
| 859 | |
| 860 | # SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does |
| 861 | # its own context management including FPU registers. |
| 862 | ifeq (${CTX_INCLUDE_FPREGS},1) |
| 863 | ifeq (${ENABLE_SME_FOR_NS},1) |
| 864 | $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") |
| 865 | endif |
| 866 | ifeq (${ENABLE_SVE_FOR_NS},1) |
| 867 | # Warning instead of error due to CI dependency on this |
| 868 | $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") |
| 869 | $(warning "Forced ENABLE_SVE_FOR_NS=0") |
| 870 | override ENABLE_SVE_FOR_NS := 0 |
| 871 | endif |
| 872 | endif |
| 873 | |
Manish V Badarkhe | 00e2887 | 2022-03-02 12:06:35 +0000 | [diff] [blame] | 874 | ifeq ($(DRTM_SUPPORT),1) |
| 875 | $(info DRTM_SUPPORT is an experimental feature) |
| 876 | endif |
| 877 | |
Chris Kay | 274a69e | 2022-09-29 16:21:24 +0100 | [diff] [blame] | 878 | ifeq (${ENABLE_RME},1) |
| 879 | ifneq (${SEPARATE_CODE_AND_RODATA},1) |
| 880 | $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) |
| 881 | endif |
| 882 | endif |
| 883 | |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 884 | ################################################################################ |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 885 | # Process platform overrideable behaviour |
| 886 | ################################################################################ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 887 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 888 | ifdef BL1_SOURCES |
| 889 | NEED_BL1 := yes |
| 890 | endif |
| 891 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 892 | ifdef BL2_SOURCES |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 893 | NEED_BL2 := yes |
| 894 | |
| 895 | # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and |
| 896 | # Certificate generation tools. This flag can be overridden by the platform. |
| 897 | ifdef EL3_PAYLOAD_BASE |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 898 | # If booting an EL3 payload there is no need for a BL33 image |
| 899 | # in the FIP file. |
| 900 | NEED_BL33 := no |
| 901 | else |
Antonio Nino Diaz | 68450a6 | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 902 | ifdef PRELOADED_BL33_BASE |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 903 | # If booting a BL33 preloaded image there is no need of |
| 904 | # another one in the FIP file. |
| 905 | NEED_BL33 := no |
| 906 | else |
| 907 | NEED_BL33 ?= yes |
| 908 | endif |
| 909 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 910 | endif |
| 911 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 912 | ifdef BL2U_SOURCES |
| 913 | NEED_BL2U := yes |
| 914 | endif |
| 915 | |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 916 | # If SCP_BL2 is given, we always want FIP to include it. |
| 917 | ifdef SCP_BL2 |
| 918 | NEED_SCP_BL2 := yes |
| 919 | endif |
| 920 | |
Soby Mathew | 5744e87 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 921 | # For AArch32, BL31 is not currently supported. |
| 922 | ifneq (${ARCH},aarch32) |
| 923 | ifdef BL31_SOURCES |
| 924 | # When booting an EL3 payload, there is no need to compile the BL31 image nor |
| 925 | # put it in the FIP. |
| 926 | ifndef EL3_PAYLOAD_BASE |
| 927 | NEED_BL31 := yes |
| 928 | endif |
| 929 | endif |
| 930 | endif |
| 931 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 932 | # Process TBB related flags |
| 933 | ifneq (${GENERATE_COT},0) |
| 934 | # Common cert_create options |
| 935 | ifneq (${CREATE_KEYS},0) |
| 936 | $(eval CRT_ARGS += -n) |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 937 | $(eval FWU_CRT_ARGS += -n) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 938 | ifneq (${SAVE_KEYS},0) |
| 939 | $(eval CRT_ARGS += -k) |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 940 | $(eval FWU_CRT_ARGS += -k) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 941 | endif |
| 942 | endif |
| 943 | # Include TBBR makefile (unless the platform indicates otherwise) |
| 944 | ifeq (${INCLUDE_TBBR_MK},1) |
| 945 | include make_helpers/tbbr/tbbr_tools.mk |
| 946 | endif |
| 947 | endif |
| 948 | |
Masahiro Yamada | 1c75d5d | 2016-12-25 13:52:22 +0900 | [diff] [blame] | 949 | ifneq (${FIP_ALIGN},0) |
| 950 | FIP_ARGS += --align ${FIP_ALIGN} |
| 951 | endif |
| 952 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 953 | ifdef FDT_SOURCES |
| 954 | NEED_FDT := yes |
| 955 | endif |
| 956 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 957 | ################################################################################ |
Michalis Pappas | 46e5e03 | 2018-03-20 13:01:27 +0800 | [diff] [blame] | 958 | # Include libraries' Makefile that are used in all BL |
| 959 | ################################################################################ |
| 960 | |
| 961 | include lib/stack_protector/stack_protector.mk |
| 962 | |
| 963 | ################################################################################ |
dp-arm | 819281e | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 964 | # Auxiliary tools (fiptool, cert_create, etc) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 965 | ################################################################################ |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 966 | |
Juan Castillo | 6f97162 | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 967 | # Variables for use with Certificate Generation Tool |
| 968 | CRTTOOLPATH ?= tools/cert_create |
Evan Lloyd | 42a45b5 | 2015-12-03 11:35:40 +0000 | [diff] [blame] | 969 | CRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} |
Juan Castillo | 6f97162 | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 970 | |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 971 | # Variables for use with Firmware Encryption Tool |
| 972 | ENCTOOLPATH ?= tools/encrypt_fw |
| 973 | ENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} |
| 974 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 975 | # Variables for use with Firmware Image Package |
dp-arm | 819281e | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 976 | FIPTOOLPATH ?= tools/fiptool |
| 977 | FIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} |
Juan Castillo | 6f97162 | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 978 | |
Antonio Nino Diaz | 26010da | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 979 | # Variables for use with sptool |
| 980 | SPTOOLPATH ?= tools/sptool |
J-Alves | 822c727 | 2022-03-22 16:28:51 +0000 | [diff] [blame] | 981 | SPTOOL ?= ${SPTOOLPATH}/sptool.py |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 982 | SP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py |
Antonio Nino Diaz | 26010da | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 983 | |
Roberto Vargas | 5accce5 | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 984 | # Variables for use with ROMLIB |
| 985 | ROMLIBPATH ?= lib/romlib |
| 986 | |
Louis Mayencourt | cfe8391 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 987 | # Variable for use with Python |
| 988 | PYTHON ?= python3 |
| 989 | |
| 990 | # Variables for use with PRINT_MEMORY_MAP |
| 991 | PRINT_MEMORY_MAP_PATH ?= tools/memory |
| 992 | PRINT_MEMORY_MAP ?= ${PRINT_MEMORY_MAP_PATH}/print_memory_map.py |
| 993 | |
Madhukar Pappireddy | 6de3237 | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 994 | # Variables for use with documentation build using Sphinx tool |
| 995 | DOCS_PATH ?= docs |
| 996 | |
Abdul Halim, Muhammad Hadi Asyrafi | 1f1c020 | 2020-06-29 12:15:27 +0800 | [diff] [blame] | 997 | # Defination of SIMICS flag |
| 998 | SIMICS_BUILD ?= 0 |
| 999 | |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1000 | ################################################################################ |
| 1001 | # Include BL specific makefiles |
| 1002 | ################################################################################ |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1003 | |
| 1004 | ifeq (${NEED_BL1},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1005 | include bl1/bl1.mk |
| 1006 | endif |
| 1007 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1008 | ifeq (${NEED_BL2},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1009 | include bl2/bl2.mk |
| 1010 | endif |
| 1011 | |
Manish Pandey | 5f24ce9 | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1012 | ifeq (${NEED_BL2U},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1013 | include bl2u/bl2u.mk |
| 1014 | endif |
| 1015 | |
Soby Mathew | 5744e87 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 1016 | ifeq (${NEED_BL31},yes) |
Soby Mathew | 8a86052 | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1017 | include bl31/bl31.mk |
| 1018 | endif |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1019 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1020 | ################################################################################ |
| 1021 | # Build options checks |
| 1022 | ################################################################################ |
Juan Castillo | b7124ea | 2014-11-04 17:36:40 +0000 | [diff] [blame] | 1023 | |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1024 | $(eval $(call assert_booleans,\ |
| 1025 | $(sort \ |
| 1026 | ALLOW_RO_XLAT_TABLES \ |
Balint Dobszay | 46789a7 | 2021-03-26 16:23:18 +0100 | [diff] [blame] | 1027 | BL2_ENABLE_SP_LOAD \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1028 | COLD_BOOT_SINGLE_CPU \ |
| 1029 | CREATE_KEYS \ |
| 1030 | CTX_INCLUDE_AARCH32_REGS \ |
| 1031 | CTX_INCLUDE_FPREGS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1032 | CTX_INCLUDE_EL2_REGS \ |
| 1033 | DEBUG \ |
Javier Almansa Sobrino | 0063dd1 | 2020-11-23 18:38:15 +0000 | [diff] [blame] | 1034 | DISABLE_MTPMU \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1035 | DYN_DISABLE_AUTH \ |
| 1036 | EL3_EXCEPTION_HANDLING \ |
| 1037 | ENABLE_AMU \ |
Chris Kay | 1fd685a | 2021-05-25 10:42:56 +0100 | [diff] [blame] | 1038 | ENABLE_AMU_AUXILIARY_COUNTERS \ |
Chris Kay | 742ca23 | 2021-08-19 11:21:52 +0100 | [diff] [blame] | 1039 | ENABLE_AMU_FCONF \ |
johpow01 | 873d424 | 2020-10-02 13:41:11 -0500 | [diff] [blame] | 1040 | AMU_RESTRICT_COUNTERS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1041 | ENABLE_ASSERTIONS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1042 | ENABLE_PIE \ |
| 1043 | ENABLE_PMF \ |
| 1044 | ENABLE_PSCI_STAT \ |
| 1045 | ENABLE_RUNTIME_INSTRUMENTATION \ |
johpow01 | dc78e62 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 1046 | ENABLE_SME_FOR_NS \ |
| 1047 | ENABLE_SME_FOR_SWD \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1048 | ENABLE_SPE_FOR_LOWER_ELS \ |
| 1049 | ENABLE_SVE_FOR_NS \ |
Max Shvetsov | 0c5e7d1 | 2021-03-22 11:59:37 +0000 | [diff] [blame] | 1050 | ENABLE_SVE_FOR_SWD \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1051 | ERROR_DEPRECATED \ |
| 1052 | FAULT_INJECTION_SUPPORT \ |
| 1053 | GENERATE_COT \ |
| 1054 | GICV2_G0_FOR_EL3 \ |
Manish Pandey | 46cc41d | 2022-10-10 11:43:08 +0100 | [diff] [blame] | 1055 | HANDLE_EA_EL3_FIRST_NS \ |
Yann Gautier | 7ecb8ad | 2023-12-04 09:59:23 +0100 | [diff] [blame] | 1056 | HARDEN_SLS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1057 | HW_ASSISTED_COHERENCY \ |
| 1058 | INVERTED_MEMMAP \ |
| 1059 | MEASURED_BOOT \ |
Manish V Badarkhe | 00e2887 | 2022-03-02 12:06:35 +0000 | [diff] [blame] | 1060 | DRTM_SUPPORT \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1061 | NS_TIMER_SWITCH \ |
| 1062 | OVERRIDE_LIBC \ |
| 1063 | PL011_GENERIC_UART \ |
Tamas Ban | 0ce2072 | 2022-01-18 16:20:47 +0100 | [diff] [blame] | 1064 | PLAT_RSS_NOT_SUPPORTED \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1065 | PROGRAMMABLE_RESET_ADDRESS \ |
| 1066 | PSCI_EXTENDED_STATE_ID \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1067 | RESET_TO_BL31 \ |
Jorge Ramirez-Ortiz | 25844ff | 2022-04-15 11:46:47 +0200 | [diff] [blame] | 1068 | RESET_TO_BL31_WITH_PARAMS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1069 | SAVE_KEYS \ |
| 1070 | SEPARATE_CODE_AND_RODATA \ |
Jiafei Pan | 96a8ed1 | 2022-02-24 10:47:33 +0800 | [diff] [blame] | 1071 | SEPARATE_BL2_NOLOAD_REGION \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1072 | SEPARATE_NOBITS_REGION \ |
| 1073 | SPIN_ON_BL1_EXIT \ |
| 1074 | SPM_MM \ |
Marc Bonnici | 1d63ae4 | 2021-12-01 18:00:40 +0000 | [diff] [blame] | 1075 | SPMC_AT_EL3 \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1076 | SPMD_SPM_AT_SEL2 \ |
| 1077 | TRUSTED_BOARD_BOOT \ |
| 1078 | USE_COHERENT_MEM \ |
| 1079 | USE_DEBUGFS \ |
| 1080 | ARM_IO_IN_DTB \ |
| 1081 | SDEI_IN_FCONF \ |
| 1082 | SEC_INT_DESC_IN_FCONF \ |
| 1083 | USE_ROMLIB \ |
| 1084 | USE_TBBR_DEFS \ |
| 1085 | WARMBOOT_ENABLE_DCACHE_EARLY \ |
| 1086 | BL2_AT_EL3 \ |
| 1087 | BL2_IN_XIP_MEM \ |
| 1088 | BL2_INV_DCACHE \ |
| 1089 | USE_SPINLOCK_CAS \ |
| 1090 | ENCRYPT_BL31 \ |
| 1091 | ENCRYPT_BL32 \ |
| 1092 | ERRATA_SPECULATIVE_AT \ |
Manish Pandey | 00e8f79 | 2022-09-27 14:30:34 +0100 | [diff] [blame] | 1093 | RAS_TRAP_NS_ERR_REC_ACCESS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1094 | COT_DESC_IN_DTB \ |
| 1095 | USE_SP804_TIMER \ |
Manish V Badarkhe | 396b339 | 2021-06-25 23:28:59 +0100 | [diff] [blame] | 1096 | PSA_FWU_SUPPORT \ |
Manish V Badarkhe | d4582d3 | 2021-06-29 11:44:20 +0100 | [diff] [blame] | 1097 | ENABLE_SYS_REG_TRACE_FOR_NS \ |
Chris Kay | 6812078 | 2021-05-05 13:38:30 +0100 | [diff] [blame] | 1098 | ENABLE_MPMM \ |
| 1099 | ENABLE_MPMM_FCONF \ |
Abdul Halim, Muhammad Hadi Asyrafi | 1f1c020 | 2020-06-29 12:15:27 +0800 | [diff] [blame] | 1100 | SIMICS_BUILD \ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1101 | FEATURE_DETECTION \ |
Jayanth Dodderi Chidanand | 0b22e59 | 2022-10-11 17:16:07 +0100 | [diff] [blame] | 1102 | TRNG_SUPPORT \ |
Sona Mathew | bb9d6fa | 2022-11-18 18:05:38 -0600 | [diff] [blame] | 1103 | ERRATA_ABI_SUPPORT \ |
Sona Mathew | 4a001ff | 2023-03-14 14:02:03 -0500 | [diff] [blame] | 1104 | ERRATA_NON_ARM_INTERCONNECT \ |
Okash Khawaja | 04c7303 | 2022-11-04 12:38:01 +0000 | [diff] [blame] | 1105 | CONDITIONAL_CMO \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1106 | ))) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1107 | |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1108 | $(eval $(call assert_numerics,\ |
| 1109 | $(sort \ |
| 1110 | ARM_ARCH_MAJOR \ |
| 1111 | ARM_ARCH_MINOR \ |
| 1112 | BRANCH_PROTECTION \ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1113 | CTX_INCLUDE_PAUTH_REGS \ |
| 1114 | CTX_INCLUDE_MTE_REGS \ |
| 1115 | CTX_INCLUDE_NEVE_REGS \ |
Manish V Badarkhe | 2bf4f27 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 1116 | CRYPTO_SUPPORT \ |
Jayanth Dodderi Chidanand | 1298f2f | 2022-05-09 12:33:03 +0100 | [diff] [blame] | 1117 | ENABLE_BRBE_FOR_NS \ |
Jayanth Dodderi Chidanand | 47c681b | 2022-05-19 14:08:28 +0100 | [diff] [blame] | 1118 | ENABLE_TRBE_FOR_NS \ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1119 | ENABLE_BTI \ |
| 1120 | ENABLE_PAUTH \ |
| 1121 | ENABLE_FEAT_AMUv1 \ |
| 1122 | ENABLE_FEAT_AMUv1p1 \ |
| 1123 | ENABLE_FEAT_CSV2_2 \ |
| 1124 | ENABLE_FEAT_DIT \ |
| 1125 | ENABLE_FEAT_ECV \ |
| 1126 | ENABLE_FEAT_FGT \ |
| 1127 | ENABLE_FEAT_HCX \ |
| 1128 | ENABLE_FEAT_PAN \ |
| 1129 | ENABLE_FEAT_RNG \ |
Juan Pablo Conde | ff86e0b | 2022-07-12 16:40:29 -0400 | [diff] [blame] | 1130 | ENABLE_FEAT_RNG_TRAP \ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1131 | ENABLE_FEAT_SB \ |
| 1132 | ENABLE_FEAT_SEL2 \ |
| 1133 | ENABLE_FEAT_VHE \ |
| 1134 | ENABLE_MPAM_FOR_LOWER_ELS \ |
| 1135 | ENABLE_RME \ |
| 1136 | ENABLE_TRF_FOR_NS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1137 | FW_ENC_STATUS \ |
Manish V Badarkhe | 5357f83 | 2021-03-16 10:01:27 +0000 | [diff] [blame] | 1138 | NR_OF_FW_BANKS \ |
| 1139 | NR_OF_IMAGES_IN_FW_BANK \ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1140 | RAS_EXTENSION \ |
Jayanth Dodderi Chidanand | 781d07a | 2022-03-28 15:28:55 +0100 | [diff] [blame] | 1141 | TWED_DELAY \ |
| 1142 | ENABLE_FEAT_TWED \ |
Mark Brown | bebcf27 | 2022-04-20 18:14:32 +0100 | [diff] [blame] | 1143 | SVE_VECTOR_LEN \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1144 | ))) |
Jeenu Viswambharan | c877b41 | 2017-01-16 16:52:35 +0000 | [diff] [blame] | 1145 | |
Justin Chadwell | aacff74 | 2019-07-29 17:13:10 +0100 | [diff] [blame] | 1146 | ifdef KEY_SIZE |
| 1147 | $(eval $(call assert_numeric,KEY_SIZE)) |
| 1148 | endif |
| 1149 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1150 | ifeq ($(filter $(SANITIZE_UB), on off trap),) |
| 1151 | $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") |
| 1152 | endif |
| 1153 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1154 | ################################################################################ |
| 1155 | # Add definitions to the cpp preprocessor based on the current build options. |
| 1156 | # This is done after including the platform specific makefile to allow the |
| 1157 | # platform to overwrite the default options |
| 1158 | ################################################################################ |
| 1159 | |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1160 | $(eval $(call add_defines,\ |
| 1161 | $(sort \ |
| 1162 | ALLOW_RO_XLAT_TABLES \ |
| 1163 | ARM_ARCH_MAJOR \ |
| 1164 | ARM_ARCH_MINOR \ |
Balint Dobszay | 46789a7 | 2021-03-26 16:23:18 +0100 | [diff] [blame] | 1165 | BL2_ENABLE_SP_LOAD \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1166 | COLD_BOOT_SINGLE_CPU \ |
| 1167 | CTX_INCLUDE_AARCH32_REGS \ |
| 1168 | CTX_INCLUDE_FPREGS \ |
| 1169 | CTX_INCLUDE_PAUTH_REGS \ |
| 1170 | EL3_EXCEPTION_HANDLING \ |
| 1171 | CTX_INCLUDE_MTE_REGS \ |
| 1172 | CTX_INCLUDE_EL2_REGS \ |
Arunachalam Ganapathy | 062f8aa | 2020-05-28 11:57:09 +0100 | [diff] [blame] | 1173 | CTX_INCLUDE_NEVE_REGS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1174 | DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ |
Javier Almansa Sobrino | 0063dd1 | 2020-11-23 18:38:15 +0000 | [diff] [blame] | 1175 | DISABLE_MTPMU \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1176 | ENABLE_AMU \ |
Chris Kay | 1fd685a | 2021-05-25 10:42:56 +0100 | [diff] [blame] | 1177 | ENABLE_AMU_AUXILIARY_COUNTERS \ |
Chris Kay | 742ca23 | 2021-08-19 11:21:52 +0100 | [diff] [blame] | 1178 | ENABLE_AMU_FCONF \ |
johpow01 | 873d424 | 2020-10-02 13:41:11 -0500 | [diff] [blame] | 1179 | AMU_RESTRICT_COUNTERS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1180 | ENABLE_ASSERTIONS \ |
| 1181 | ENABLE_BTI \ |
| 1182 | ENABLE_MPAM_FOR_LOWER_ELS \ |
| 1183 | ENABLE_PAUTH \ |
| 1184 | ENABLE_PIE \ |
| 1185 | ENABLE_PMF \ |
| 1186 | ENABLE_PSCI_STAT \ |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 1187 | ENABLE_RME \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1188 | ENABLE_RUNTIME_INSTRUMENTATION \ |
johpow01 | dc78e62 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 1189 | ENABLE_SME_FOR_NS \ |
| 1190 | ENABLE_SME_FOR_SWD \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1191 | ENABLE_SPE_FOR_LOWER_ELS \ |
| 1192 | ENABLE_SVE_FOR_NS \ |
Max Shvetsov | 0c5e7d1 | 2021-03-22 11:59:37 +0000 | [diff] [blame] | 1193 | ENABLE_SVE_FOR_SWD \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1194 | ENCRYPT_BL31 \ |
| 1195 | ENCRYPT_BL32 \ |
| 1196 | ERROR_DEPRECATED \ |
| 1197 | FAULT_INJECTION_SUPPORT \ |
| 1198 | GICV2_G0_FOR_EL3 \ |
Manish Pandey | 46cc41d | 2022-10-10 11:43:08 +0100 | [diff] [blame] | 1199 | HANDLE_EA_EL3_FIRST_NS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1200 | HW_ASSISTED_COHERENCY \ |
| 1201 | LOG_LEVEL \ |
| 1202 | MEASURED_BOOT \ |
Manish V Badarkhe | 00e2887 | 2022-03-02 12:06:35 +0000 | [diff] [blame] | 1203 | DRTM_SUPPORT \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1204 | NS_TIMER_SWITCH \ |
| 1205 | PL011_GENERIC_UART \ |
| 1206 | PLAT_${PLAT} \ |
Tamas Ban | 0ce2072 | 2022-01-18 16:20:47 +0100 | [diff] [blame] | 1207 | PLAT_RSS_NOT_SUPPORTED \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1208 | PROGRAMMABLE_RESET_ADDRESS \ |
| 1209 | PSCI_EXTENDED_STATE_ID \ |
| 1210 | RAS_EXTENSION \ |
| 1211 | RESET_TO_BL31 \ |
Jorge Ramirez-Ortiz | 25844ff | 2022-04-15 11:46:47 +0200 | [diff] [blame] | 1212 | RESET_TO_BL31_WITH_PARAMS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1213 | SEPARATE_CODE_AND_RODATA \ |
Jiafei Pan | 96a8ed1 | 2022-02-24 10:47:33 +0800 | [diff] [blame] | 1214 | SEPARATE_BL2_NOLOAD_REGION \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1215 | SEPARATE_NOBITS_REGION \ |
| 1216 | RECLAIM_INIT_CODE \ |
| 1217 | SPD_${SPD} \ |
| 1218 | SPIN_ON_BL1_EXIT \ |
| 1219 | SPM_MM \ |
Marc Bonnici | 1d63ae4 | 2021-12-01 18:00:40 +0000 | [diff] [blame] | 1220 | SPMC_AT_EL3 \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1221 | SPMD_SPM_AT_SEL2 \ |
| 1222 | TRUSTED_BOARD_BOOT \ |
Manish V Badarkhe | c9c56f6 | 2022-01-08 22:56:06 +0000 | [diff] [blame] | 1223 | CRYPTO_SUPPORT \ |
Jimmy Brisson | 7dfb991 | 2020-06-22 14:18:42 -0500 | [diff] [blame] | 1224 | TRNG_SUPPORT \ |
Sona Mathew | bb9d6fa | 2022-11-18 18:05:38 -0600 | [diff] [blame] | 1225 | ERRATA_ABI_SUPPORT \ |
Sona Mathew | 4a001ff | 2023-03-14 14:02:03 -0500 | [diff] [blame] | 1226 | ERRATA_NON_ARM_INTERCONNECT \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1227 | USE_COHERENT_MEM \ |
| 1228 | USE_DEBUGFS \ |
| 1229 | ARM_IO_IN_DTB \ |
| 1230 | SDEI_IN_FCONF \ |
| 1231 | SEC_INT_DESC_IN_FCONF \ |
| 1232 | USE_ROMLIB \ |
| 1233 | USE_TBBR_DEFS \ |
| 1234 | WARMBOOT_ENABLE_DCACHE_EARLY \ |
| 1235 | BL2_AT_EL3 \ |
| 1236 | BL2_IN_XIP_MEM \ |
| 1237 | BL2_INV_DCACHE \ |
| 1238 | USE_SPINLOCK_CAS \ |
| 1239 | ERRATA_SPECULATIVE_AT \ |
Manish Pandey | 00e8f79 | 2022-09-27 14:30:34 +0100 | [diff] [blame] | 1240 | RAS_TRAP_NS_ERR_REC_ACCESS \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1241 | COT_DESC_IN_DTB \ |
| 1242 | USE_SP804_TIMER \ |
Tomas Pilar | 12cd65e | 2020-10-29 13:01:16 +0000 | [diff] [blame] | 1243 | ENABLE_FEAT_RNG \ |
Juan Pablo Conde | ff86e0b | 2022-07-12 16:40:29 -0400 | [diff] [blame] | 1244 | ENABLE_FEAT_RNG_TRAP \ |
Chris Kay | 4e04478 | 2021-03-09 13:34:35 +0000 | [diff] [blame] | 1245 | ENABLE_FEAT_SB \ |
Daniel Boulby | 7d33ffe | 2021-05-25 18:09:34 +0100 | [diff] [blame] | 1246 | ENABLE_FEAT_DIT \ |
Manish V Badarkhe | 5357f83 | 2021-03-16 10:01:27 +0000 | [diff] [blame] | 1247 | NR_OF_FW_BANKS \ |
| 1248 | NR_OF_IMAGES_IN_FW_BANK \ |
Manish V Badarkhe | 396b339 | 2021-06-25 23:28:59 +0100 | [diff] [blame] | 1249 | PSA_FWU_SUPPORT \ |
johpow01 | 744ad97 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 1250 | ENABLE_BRBE_FOR_NS \ |
Manish V Badarkhe | 813524e | 2021-07-02 09:10:56 +0100 | [diff] [blame] | 1251 | ENABLE_TRBE_FOR_NS \ |
Manish V Badarkhe | d4582d3 | 2021-06-29 11:44:20 +0100 | [diff] [blame] | 1252 | ENABLE_SYS_REG_TRACE_FOR_NS \ |
Manish V Badarkhe | 8fcd3d9 | 2021-07-08 09:33:18 +0100 | [diff] [blame] | 1253 | ENABLE_TRF_FOR_NS \ |
johpow01 | cb4ec47 | 2021-08-04 19:38:18 -0500 | [diff] [blame] | 1254 | ENABLE_FEAT_HCX \ |
Chris Kay | 6812078 | 2021-05-05 13:38:30 +0100 | [diff] [blame] | 1255 | ENABLE_MPMM \ |
| 1256 | ENABLE_MPMM_FCONF \ |
Jayanth Dodderi Chidanand | f74cb0b | 2021-11-25 14:59:30 +0000 | [diff] [blame] | 1257 | ENABLE_FEAT_FGT \ |
| 1258 | ENABLE_FEAT_AMUv1 \ |
| 1259 | ENABLE_FEAT_ECV \ |
Abdul Halim, Muhammad Hadi Asyrafi | 1f1c020 | 2020-06-29 12:15:27 +0800 | [diff] [blame] | 1260 | SIMICS_BUILD \ |
Jayanth Dodderi Chidanand | 6a0da73 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 1261 | ENABLE_FEAT_AMUv1p1 \ |
| 1262 | ENABLE_FEAT_SEL2 \ |
| 1263 | ENABLE_FEAT_VHE \ |
| 1264 | ENABLE_FEAT_CSV2_2 \ |
| 1265 | ENABLE_FEAT_PAN \ |
| 1266 | FEATURE_DETECTION \ |
Jayanth Dodderi Chidanand | 781d07a | 2022-03-28 15:28:55 +0100 | [diff] [blame] | 1267 | TWED_DELAY \ |
| 1268 | ENABLE_FEAT_TWED \ |
Okash Khawaja | 04c7303 | 2022-11-04 12:38:01 +0000 | [diff] [blame] | 1269 | CONDITIONAL_CMO \ |
Leonardo Sandoval | 327131c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1270 | ))) |
Jeenu Viswambharan | 2fae4b1 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 1271 | |
Justin Chadwell | 1f46197 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1272 | ifeq (${SANITIZE_UB},trap) |
| 1273 | $(eval $(call add_define,MONITOR_TRAPS)) |
| 1274 | endif |
| 1275 | |
Sandrine Bailleux | 4c117f6 | 2015-11-26 16:31:34 +0000 | [diff] [blame] | 1276 | # Define the EL3_PAYLOAD_BASE flag only if it is provided. |
| 1277 | ifdef EL3_PAYLOAD_BASE |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 1278 | $(eval $(call add_define,EL3_PAYLOAD_BASE)) |
| 1279 | else |
Antonio Nino Diaz | 68450a6 | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 1280 | # Define the PRELOADED_BL33_BASE flag only if it is provided and |
| 1281 | # EL3_PAYLOAD_BASE is not defined, as it has priority. |
| 1282 | ifdef PRELOADED_BL33_BASE |
| 1283 | $(eval $(call add_define,PRELOADED_BL33_BASE)) |
Antonio Nino Diaz | cf2c8a3 | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 1284 | endif |
Sandrine Bailleux | 4c117f6 | 2015-11-26 16:31:34 +0000 | [diff] [blame] | 1285 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1286 | |
Soby Mathew | 209a60c | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 1287 | # Define the DYN_DISABLE_AUTH flag only if set. |
| 1288 | ifeq (${DYN_DISABLE_AUTH},1) |
| 1289 | $(eval $(call add_define,DYN_DISABLE_AUTH)) |
| 1290 | endif |
| 1291 | |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 1292 | ifneq ($(findstring armlink,$(notdir $(LD))),) |
| 1293 | $(eval $(call add_define,USE_ARM_LINK)) |
| 1294 | endif |
| 1295 | |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1296 | # 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] | 1297 | ifeq (${SPD},spmd) |
Olivier Deprez | c33ff19 | 2020-03-19 09:27:11 +0100 | [diff] [blame] | 1298 | ifdef SP_LAYOUT_FILE |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1299 | -include $(BUILD_PLAT)/sp_gen.mk |
| 1300 | FIP_DEPS += sp |
Manish Pandey | 07c4447 | 2020-05-26 23:59:36 +0100 | [diff] [blame] | 1301 | CRT_DEPS += sp |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1302 | NEED_SP_PKG := yes |
| 1303 | else |
Olivier Deprez | c33ff19 | 2020-03-19 09:27:11 +0100 | [diff] [blame] | 1304 | ifeq (${SPMD_SPM_AT_SEL2},1) |
| 1305 | $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") |
| 1306 | endif |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1307 | endif |
| 1308 | endif |
| 1309 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1310 | ################################################################################ |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1311 | # Build targets |
| 1312 | ################################################################################ |
| 1313 | |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1314 | .PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1315 | .SUFFIXES: |
| 1316 | |
| 1317 | all: msg_start |
| 1318 | |
| 1319 | msg_start: |
| 1320 | @echo "Building ${PLAT}" |
| 1321 | |
Soby Mathew | 7a24cba | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1322 | ifeq (${ERROR_DEPRECATED},0) |
Julius Werner | d5dfdeb | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 1323 | # Check if deprecated declarations and cpp warnings should be treated as error or not. |
Varun Wadekar | c2ad38c | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 1324 | ifneq ($(findstring clang,$(notdir $(CC))),) |
| 1325 | CPPFLAGS += -Wno-error=deprecated-declarations |
| 1326 | else |
Dan Handley | bc1a03c | 2018-02-27 16:03:58 +0000 | [diff] [blame] | 1327 | CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp |
Soby Mathew | 7a24cba | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1328 | endif |
Julius Werner | d5dfdeb | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 1329 | endif # !ERROR_DEPRECATED |
Soby Mathew | 7a24cba | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1330 | |
Roberto Vargas | 5accce5 | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1331 | $(eval $(call MAKE_LIB_DIRS)) |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1332 | $(eval $(call MAKE_LIB,c)) |
Roberto Vargas | 5fee028 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1333 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1334 | # Expand build macros for the different images |
| 1335 | ifeq (${NEED_BL1},yes) |
Chris Kay | b34635a | 2021-09-28 15:44:19 +0100 | [diff] [blame] | 1336 | BL1_SOURCES := $(sort ${BL1_SOURCES}) |
| 1337 | |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1338 | $(eval $(call MAKE_BL,bl1)) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1339 | endif |
| 1340 | |
| 1341 | ifeq (${NEED_BL2},yes) |
Roberto Vargas | c9b31ae | 2018-01-02 11:23:41 +0000 | [diff] [blame] | 1342 | ifeq (${BL2_AT_EL3}, 0) |
| 1343 | FIP_BL2_ARGS := tb-fw |
| 1344 | endif |
| 1345 | |
Chris Kay | eb1acfb | 2021-09-28 15:44:37 +0100 | [diff] [blame] | 1346 | BL2_SOURCES := $(sort ${BL2_SOURCES}) |
| 1347 | |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1348 | $(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1349 | $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1350 | endif |
| 1351 | |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1352 | ifeq (${NEED_SCP_BL2},yes) |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1353 | $(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) |
Masahiro Yamada | 4d045d0 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1354 | endif |
| 1355 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1356 | ifeq (${NEED_BL31},yes) |
| 1357 | BL31_SOURCES += ${SPD_SOURCES} |
Madhukar Pappireddy | 26d1e0c | 2020-01-27 13:37:51 -0600 | [diff] [blame] | 1358 | # Sort BL31 source files to remove duplicates |
| 1359 | BL31_SOURCES := $(sort ${BL31_SOURCES}) |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1360 | ifneq (${DECRYPTION_SUPPORT},none) |
| 1361 | $(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1362 | $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1363 | else |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1364 | $(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1365 | $(eval $(call MAKE_BL,bl31,soc-fw))) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1366 | endif |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1367 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1368 | |
Juan Castillo | 70d1fc5 | 2015-11-12 10:59:26 +0000 | [diff] [blame] | 1369 | # 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] | 1370 | # 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] | 1371 | # process. Note that the dependency on BL32 applies to the FIP only. |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1372 | ifeq (${NEED_BL32},yes) |
Madhukar Pappireddy | 26d1e0c | 2020-01-27 13:37:51 -0600 | [diff] [blame] | 1373 | # Sort BL32 source files to remove duplicates |
| 1374 | BL32_SOURCES := $(sort ${BL32_SOURCES}) |
Masahiro Yamada | 9cd1523 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1375 | BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) |
| 1376 | |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1377 | ifneq (${DECRYPTION_SUPPORT},none) |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1378 | $(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1379 | $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) |
| 1380 | else |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1381 | $(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1382 | $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1383 | endif |
Sumit Garg | c6ba9b4 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1384 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1385 | |
Zelalem Aweke | 5b18de0 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 1386 | # If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) |
| 1387 | # needs to be built from RMM_SOURCES. |
| 1388 | ifeq (${NEED_RMM},yes) |
| 1389 | # Sort RMM source files to remove duplicates |
| 1390 | RMM_SOURCES := $(sort ${RMM_SOURCES}) |
| 1391 | BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) |
| 1392 | |
| 1393 | $(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ |
| 1394 | $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) |
| 1395 | endif |
| 1396 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1397 | # Add the BL33 image if required by the platform |
| 1398 | ifeq (${NEED_BL33},yes) |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1399 | $(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 1400 | endif |
| 1401 | |
Yatharth Kochar | 9003fa0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1402 | ifeq (${NEED_BL2U},yes) |
Masahiro Yamada | 33950dd | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1403 | $(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ |
Zelalem Aweke | 434d049 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1404 | $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) |
Yatharth Kochar | 9003fa0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1405 | endif |
| 1406 | |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1407 | # Expand build macros for the different images |
| 1408 | ifeq (${NEED_FDT},yes) |
Soby Mathew | 38c14d8 | 2017-12-14 17:44:56 +0000 | [diff] [blame] | 1409 | $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) |
Nishanth Menon | 03b397a | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1410 | endif |
| 1411 | |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1412 | # Add Secure Partition packages |
| 1413 | ifeq (${NEED_SP_PKG},yes) |
| 1414 | $(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} |
Ruari Phipps | 1e7528e | 2020-07-24 16:20:57 +0100 | [diff] [blame] | 1415 | ${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} |
J-Alves | 822c727 | 2022-03-22 16:28:51 +0000 | [diff] [blame] | 1416 | sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1417 | @${ECHO_BLANK_LINE} |
| 1418 | @echo "Built SP Images successfully" |
| 1419 | @${ECHO_BLANK_LINE} |
| 1420 | endif |
| 1421 | |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1422 | locate-checkpatch: |
| 1423 | ifndef CHECKPATCH |
Etienne Carriere | 66079b0 | 2017-08-23 15:44:01 +0200 | [diff] [blame] | 1424 | $(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] | 1425 | else |
| 1426 | ifeq (,$(wildcard ${CHECKPATCH})) |
Etienne Carriere | 66079b0 | 2017-08-23 15:44:01 +0200 | [diff] [blame] | 1427 | $(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] | 1428 | endif |
| 1429 | endif |
| 1430 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1431 | clean: |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1432 | @echo " CLEAN" |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1433 | $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) |
Sami Mujawar | 88a1cf1 | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1434 | ifdef UNIX_MK |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1435 | ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean |
Sami Mujawar | 88a1cf1 | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1436 | else |
| 1437 | # Clear the MAKEFLAGS as we do not want |
| 1438 | # to pass the gnumake flags to nmake. |
| 1439 | ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean |
| 1440 | endif |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1441 | ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1442 | ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean |
Roberto Vargas | 5accce5 | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1443 | ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1444 | |
James Morrissey | eaaeece | 2013-11-01 13:56:59 +0000 | [diff] [blame] | 1445 | realclean distclean: |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1446 | @echo " REALCLEAN" |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1447 | $(call SHELL_REMOVE_DIR,${BUILD_BASE}) |
| 1448 | $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) |
Sami Mujawar | 88a1cf1 | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1449 | ifdef UNIX_MK |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1450 | ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean |
Sami Mujawar | 88a1cf1 | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1451 | else |
| 1452 | # Clear the MAKEFLAGS as we do not want |
| 1453 | # to pass the gnumake flags to nmake. |
| 1454 | ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean |
| 1455 | endif |
Nicolas Boulenguez | e15591a | 2021-03-31 12:22:45 +0200 | [diff] [blame] | 1456 | ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1457 | ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean |
Roberto Vargas | 5accce5 | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1458 | ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1459 | |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1460 | checkcodebase: locate-checkpatch |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1461 | @echo " CHECKING STYLE" |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1462 | @if test -d .git ; then \ |
Paul Beesley | 1ef3551 | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 1463 | git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1464 | while read GIT_FILE ; \ |
| 1465 | do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ |
| 1466 | done ; \ |
| 1467 | else \ |
| 1468 | find . -type f -not -iwholename "*.git*" \ |
| 1469 | -not -iwholename "*build*" \ |
| 1470 | -not -iwholename "*libfdt*" \ |
Roberto Vargas | 61f72a3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1471 | -not -iwholename "*libc*" \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1472 | -not -iwholename "*docs*" \ |
Paul Beesley | 1ef3551 | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 1473 | -not -iwholename "*.rst" \ |
Dan Handley | 1a41e8c | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1474 | -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ |
| 1475 | fi |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1476 | |
| 1477 | checkpatch: locate-checkpatch |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1478 | @echo " CHECKING STYLE" |
Yann Gautier | 02a76d5 | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1479 | @if test -n "${CHECKPATCH_OPTS}"; then \ |
| 1480 | echo " with ${CHECKPATCH_OPTS} option(s)"; \ |
| 1481 | fi |
Antonio Nino Diaz | 51d2893 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1482 | ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ |
Yann Gautier | 77a0a7f | 2021-11-02 18:03:31 +0100 | [diff] [blame] | 1483 | for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ |
| 1484 | do \ |
Antonio Nino Diaz | 51d2893 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1485 | printf "\n[*] Checking style of '$$commit'\n\n"; \ |
| 1486 | git log --format=email "$$commit~..$$commit" \ |
Yann Gautier | 02a76d5 | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1487 | -- ${CHECK_PATHS} | \ |
| 1488 | ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ |
Antonio Nino Diaz | 51d2893 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1489 | git diff --format=email "$$commit~..$$commit" \ |
Yann Gautier | 02a76d5 | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1490 | -- ${CHECK_PATHS} | \ |
| 1491 | ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ |
Antonio Nino Diaz | 51d2893 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1492 | done |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1493 | |
| 1494 | certtool: ${CRTTOOL} |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1495 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1496 | ${CRTTOOL}: FORCE |
Lionel Debieve | 598b166 | 2022-11-14 11:05:09 +0100 | [diff] [blame] | 1497 | ${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${CRTTOOLPATH} all |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1498 | @${ECHO_BLANK_LINE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1499 | @echo "Built $@ successfully" |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1500 | @${ECHO_BLANK_LINE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1501 | |
| 1502 | ifneq (${GENERATE_COT},0) |
| 1503 | certificates: ${CRT_DEPS} ${CRTTOOL} |
| 1504 | ${Q}${CRTTOOL} ${CRT_ARGS} |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1505 | @${ECHO_BLANK_LINE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1506 | @echo "Built $@ successfully" |
| 1507 | @echo "Certificates can be found in ${BUILD_PLAT}" |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1508 | @${ECHO_BLANK_LINE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1509 | endif |
| 1510 | |
| 1511 | ${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} |
Pali Rohár | 4727fd1 | 2020-11-24 16:53:04 +0100 | [diff] [blame] | 1512 | $(eval ${CHECK_FIP_CMD}) |
dp-arm | 819281e | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 1513 | ${Q}${FIPTOOL} create ${FIP_ARGS} $@ |
| 1514 | ${Q}${FIPTOOL} info $@ |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1515 | @${ECHO_BLANK_LINE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1516 | @echo "Built $@ successfully" |
Evan Lloyd | f1477d4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1517 | @${ECHO_BLANK_LINE} |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1518 | |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1519 | ifneq (${GENERATE_COT},0) |
| 1520 | fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} |
| 1521 | ${Q}${CRTTOOL} ${FWU_CRT_ARGS} |
Evan Lloyd | 052ab52 | 2017-04-11 16:52:00 +0100 | [diff] [blame] | 1522 | @${ECHO_BLANK_LINE} |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1523 | @echo "Built $@ successfully" |
| 1524 | @echo "FWU certificates can be found in ${BUILD_PLAT}" |
Evan Lloyd | 052ab52 | 2017-04-11 16:52:00 +0100 | [diff] [blame] | 1525 | @${ECHO_BLANK_LINE} |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1526 | endif |
| 1527 | |
| 1528 | ${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} |
Pali Rohár | 4727fd1 | 2020-11-24 16:53:04 +0100 | [diff] [blame] | 1529 | $(eval ${CHECK_FWU_FIP_CMD}) |
dp-arm | 819281e | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 1530 | ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ |
| 1531 | ${Q}${FIPTOOL} info $@ |
Evan Lloyd | 052ab52 | 2017-04-11 16:52:00 +0100 | [diff] [blame] | 1532 | @${ECHO_BLANK_LINE} |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1533 | @echo "Built $@ successfully" |
Evan Lloyd | 052ab52 | 2017-04-11 16:52:00 +0100 | [diff] [blame] | 1534 | @${ECHO_BLANK_LINE} |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1535 | |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1536 | fiptool: ${FIPTOOL} |
| 1537 | fip: ${BUILD_PLAT}/${FIP_NAME} |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1538 | fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} |
Juan Castillo | 6f97162 | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1539 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1540 | ${FIPTOOL}: FORCE |
Sami Mujawar | 88a1cf1 | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1541 | ifdef UNIX_MK |
Lionel Debieve | 598b166 | 2022-11-14 11:05:09 +0100 | [diff] [blame] | 1542 | ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all |
Sami Mujawar | 88a1cf1 | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1543 | else |
| 1544 | # Clear the MAKEFLAGS as we do not want |
| 1545 | # to pass the gnumake flags to nmake. |
| 1546 | ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) |
| 1547 | endif |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1548 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1549 | romlib.bin: libraries FORCE |
John Tsichritzis | bbb24f6 | 2019-05-21 15:47:37 +0100 | [diff] [blame] | 1550 | ${Q}${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all |
Roberto Vargas | 5accce5 | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1551 | |
Louis Mayencourt | cfe8391 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1552 | # Call print_memory_map tool |
| 1553 | memmap: all |
Louis Mayencourt | b890b36 | 2020-02-13 08:21:34 +0000 | [diff] [blame] | 1554 | ${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP} |
Louis Mayencourt | cfe8391 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1555 | |
Madhukar Pappireddy | 6de3237 | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 1556 | doc: |
| 1557 | @echo " BUILD DOCUMENTATION" |
| 1558 | ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html |
| 1559 | |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1560 | enctool: ${ENCTOOL} |
| 1561 | |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1562 | ${ENCTOOL}: FORCE |
Lionel Debieve | 598b166 | 2022-11-14 11:05:09 +0100 | [diff] [blame] | 1563 | ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1564 | @${ECHO_BLANK_LINE} |
| 1565 | @echo "Built $@ successfully" |
| 1566 | @${ECHO_BLANK_LINE} |
| 1567 | |
Joakim Bech | 35fab8c | 2014-01-23 14:51:49 +0100 | [diff] [blame] | 1568 | cscope: |
| 1569 | @echo " CSCOPE" |
| 1570 | ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files |
| 1571 | ${Q}cscope -b -q -k |
| 1572 | |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1573 | help: |
John Tsichritzis | 7c23126 | 2019-05-21 15:57:31 +0100 | [diff] [blame] | 1574 | @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1575 | @echo "" |
| 1576 | @echo "PLAT is used to specify which platform you wish to build." |
Sandrine Bailleux | 08c7ed0 | 2014-03-21 13:16:35 +0000 | [diff] [blame] | 1577 | @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1578 | @echo "" |
John Tsichritzis | 7c23126 | 2019-05-21 15:57:31 +0100 | [diff] [blame] | 1579 | @echo "platform = ${PLATFORM_LIST}" |
| 1580 | @echo "" |
Sandrine Bailleux | 1b57859 | 2015-02-18 16:18:00 +0000 | [diff] [blame] | 1581 | @echo "Please refer to the User Guide for a list of all supported options." |
| 1582 | @echo "Note that the build system doesn't track dependencies for build " |
| 1583 | @echo "options. Therefore, if any of the build options are changed " |
| 1584 | @echo "from a previous build, a clean build must be performed." |
| 1585 | @echo "" |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1586 | @echo "Supported Targets:" |
Sandrine Bailleux | 1b57859 | 2015-02-18 16:18:00 +0000 | [diff] [blame] | 1587 | @echo " all Build all individual bootloader binaries" |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1588 | @echo " bl1 Build the BL1 binary" |
Jeenu Viswambharan | 8aa559c | 2014-02-21 11:42:08 +0000 | [diff] [blame] | 1589 | @echo " bl2 Build the BL2 binary" |
Yatharth Kochar | 9003fa0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1590 | @echo " bl2u Build the BL2U binary" |
Juan Castillo | d178637 | 2015-12-14 09:35:25 +0000 | [diff] [blame] | 1591 | @echo " bl31 Build the BL31 binary" |
Soby Mathew | 9d29c22 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 1592 | @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " |
| 1593 | @echo " this builds secure payload specified by AARCH32_SP" |
Juan Castillo | 73c99d4 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1594 | @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" |
Sandrine Bailleux | 1b57859 | 2015-02-18 16:18:00 +0000 | [diff] [blame] | 1595 | @echo " fip Build the Firmware Image Package (FIP)" |
Yatharth Kochar | 0191262 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1596 | @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1597 | @echo " checkcodebase Check the coding style of the entire source tree" |
| 1598 | @echo " checkpatch Check the coding style on changes in the current" |
| 1599 | @echo " branch against BASE_COMMIT (default origin/master)" |
| 1600 | @echo " clean Clean the build for the selected platform" |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1601 | @echo " cscope Generate cscope index" |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1602 | @echo " distclean Remove all build artifacts for all platforms" |
Juan Castillo | 6f97162 | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1603 | @echo " certtool Build the Certificate generation tool" |
Sumit Garg | 90aa901 | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1604 | @echo " enctool Build the Firmware encryption tool" |
Andreas Färber | 59dead2 | 2016-10-10 05:18:49 +0200 | [diff] [blame] | 1605 | @echo " fiptool Build the Firmware Image Package (FIP) creation tool" |
Manish Pandey | ce2b1ec | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1606 | @echo " sp Build the Secure Partition Packages" |
Antonio Nino Diaz | 26010da | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 1607 | @echo " sptool Build the Secure Partition Package creation tool" |
Soby Mathew | 38c14d8 | 2017-12-14 17:44:56 +0000 | [diff] [blame] | 1608 | @echo " dtbs Build the Device Tree Blobs (if required for the platform)" |
Louis Mayencourt | cfe8391 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1609 | @echo " memmap Print the memory map of the built binaries" |
Madhukar Pappireddy | 6de3237 | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 1610 | @echo " doc Build html based documentation using Sphinx tool" |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1611 | @echo "" |
Sandrine Bailleux | 1b57859 | 2015-02-18 16:18:00 +0000 | [diff] [blame] | 1612 | @echo "Note: most build targets require PLAT to be set to a specific platform." |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1613 | @echo "" |
| 1614 | @echo "example: build all targets for the FVP platform:" |
| 1615 | @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" |
Pali Rohár | a981220 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1616 | |
| 1617 | .PHONY: FORCE |
| 1618 | FORCE:; |