14f6ad66aSAchin Gupta# 2553c24c3SBoyan Karatotev# Copyright (c) 2013-2026, Arm Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta# 482cb2c1aSdp-arm# SPDX-License-Identifier: BSD-3-Clause 54f6ad66aSAchin Gupta# 64f6ad66aSAchin Gupta 7e35c4045SJeenu Viswambharan# 8aaa3e722SJuan Castillo# Trusted Firmware Version 9aaa3e722SJuan Castillo# 101a0f1121SSoby MathewVERSION_MAJOR := 2 111c26b186SArvind Ram PrakashVERSION_MINOR := 14 12c25d1ccfSYann Gautier# VERSION_PATCH is only used for LTS releases 13c25d1ccfSYann GautierVERSION_PATCH := 0 14055ebecaSYann GautierVERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} 15aaa3e722SJuan Castillo 1688154678SJuan Castillo# Default goal is build all images 1788154678SJuan Castillo.DEFAULT_GOAL := all 1888154678SJuan Castillo 1972fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to 2072fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 2172fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual. 2272fc70edSDouglas RaillardMAKEOVERRIDES = 2372fc70edSDouglas Raillard 24231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/ 25231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 26f4dd18c2SChris Kayinclude ${MAKE_HELPERS_DIRECTORY}build-rules.mk 277c4e1eeaSChris Kayinclude ${MAKE_HELPERS_DIRECTORY}common.mk 2873c99d4eSJuan Castillo 29bc9a699dSChris KayMBEDTLS_DIR := contrib/mbed-tls 30bc9a699dSChris Kay 3173c99d4eSJuan Castillo################################################################################ 322fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies 3373c99d4eSJuan Castillo################################################################################ 34e35c4045SJeenu Viswambharan 352fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk 3628973741SBoyan Karatotev# Include the CPU specific operations makefile, which provides default 3728973741SBoyan Karatotev# values for all CPU errata workarounds and CPU specific optimisations. 3828973741SBoyan Karatotev# This can be overridden by the platform. 3928973741SBoyan Karatotevinclude lib/cpus/cpu-ops.mk 4028973741SBoyan Karatotev 41422b181fSYann GautierPLAT := ${DEFAULT_PLAT} 421b2fb6adSAndrey Skvortsovinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 431b2fb6adSAndrey Skvortsov 441b2fb6adSAndrey Skvortsov# To be able to set platform specific defaults 451b2fb6adSAndrey Skvortsovifneq ($(PLAT_DEFAULTS_MAKEFILE_FULL),) 461b2fb6adSAndrey Skvortsovinclude ${PLAT_DEFAULTS_MAKEFILE_FULL} 471b2fb6adSAndrey Skvortsovendif 48872be88aSdp-arm 49cc277de8SChris Kay################################################################################ 50cc277de8SChris Kay# Configure the toolchains used to build TF-A and its tools 51cc277de8SChris Kay################################################################################ 52cc277de8SChris Kay 53cc277de8SChris Kayinclude ${MAKE_HELPERS_DIRECTORY}toolchain.mk 54cc277de8SChris Kay 55cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default 56cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS := ${DEBUG} 572fae4b1eSJeenu ViswambharanENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 5873c99d4eSJuan Castillo 5973c99d4eSJuan Castillo################################################################################ 6073c99d4eSJuan Castillo# Checkpatch script options 6173c99d4eSJuan Castillo################################################################################ 6273c99d4eSJuan Castillo 63f607739cSSandrine BailleuxCHECKCODE_ARGS := --no-patch 64f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files 654501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 664501843fSGilad Ben-Yossef include/drivers/arm, \ 674501843fSGilad Ben-Yossef $(wildcard include/drivers/*))) 68f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 6918818426SChris Kay lib/libfdt \ 7061f72a34SRoberto Vargas include/lib/libc, \ 71f0b489c1SDan Handley $(wildcard include/lib/*))) 72f0b489c1SDan HandleyINC_DIRS_TO_CHECK := $(sort $(filter-out \ 734501843fSGilad Ben-Yossef include/lib \ 744501843fSGilad Ben-Yossef include/drivers, \ 75f0b489c1SDan Handley $(wildcard include/*))) 76f0b489c1SDan HandleyLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 77d801fbb0Sdp-arm lib/compiler-rt \ 7855cdcf75SAntonio Nino Diaz lib/libfdt% \ 7961f72a34SRoberto Vargas lib/libc, \ 80a194255dSDaniel Boulby lib/zlib \ 81f0b489c1SDan Handley $(wildcard lib/*))) 82f0b489c1SDan HandleyROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 83f0b489c1SDan Handley lib \ 84f0b489c1SDan Handley include \ 85f0b489c1SDan Handley docs \ 861ef35512SPaul Beesley %.rst, \ 87f0b489c1SDan Handley $(wildcard *))) 88f0b489c1SDan HandleyCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 89f0b489c1SDan Handley ${INC_DIRS_TO_CHECK} \ 90f0b489c1SDan Handley ${INC_LIB_DIRS_TO_CHECK} \ 914501843fSGilad Ben-Yossef ${LIB_DIRS_TO_CHECK} \ 924501843fSGilad Ben-Yossef ${INC_DRV_DIRS_TO_CHECK} \ 934501843fSGilad Ben-Yossef ${INC_ARM_DIRS_TO_CHECK} 9436eaaf37SIan Spray 9573c99d4eSJuan Castillo################################################################################ 9673c99d4eSJuan Castillo# Process build options 9773c99d4eSJuan Castillo################################################################################ 9873c99d4eSJuan Castillo 997c4e1eeaSChris Kayifeq ($(verbose),) 10036eaaf37SIan Spray CHECKCODE_ARGS += --no-summary --terse 1014f6ad66aSAchin Guptaendif 102ee1ba6d4SAndre Przywara 10373c99d4eSJuan Castillo################################################################################ 104c5e1da83SJayanth Dodderi Chidanand# Auxiliary tools (fiptool, cert_create, etc) 105c5e1da83SJayanth Dodderi Chidanand################################################################################ 106c5e1da83SJayanth Dodderi Chidanand 107c5e1da83SJayanth Dodderi Chidanand# Variables for use with Certificate Generation Tool 108c5e1da83SJayanth Dodderi ChidanandCRTTOOLPATH ?= tools/cert_create 109f4595e6eSBoyan KaratotevCRTTOOL ?= ${BUILD_PLAT}/${CRTTOOLPATH}/cert_create$(.exe) 110c5e1da83SJayanth Dodderi Chidanand 111c5e1da83SJayanth Dodderi Chidanand# Variables for use with Firmware Encryption Tool 112c5e1da83SJayanth Dodderi ChidanandENCTOOLPATH ?= tools/encrypt_fw 11396fbe884SBoyan KaratotevENCTOOL ?= ${BUILD_PLAT}/${ENCTOOLPATH}/encrypt_fw$(.exe) 114c5e1da83SJayanth Dodderi Chidanand 115c5e1da83SJayanth Dodderi Chidanand# Variables for use with Firmware Image Package 116c5e1da83SJayanth Dodderi ChidanandFIPTOOLPATH ?= tools/fiptool 117cbd6cec3SBoyan KaratotevFIPTOOL ?= ${BUILD_PLAT}/${FIPTOOLPATH}/fiptool$(.exe) 118c5e1da83SJayanth Dodderi Chidanand 119c5e1da83SJayanth Dodderi Chidanand# Variables for use with sptool 120c5e1da83SJayanth Dodderi ChidanandSPTOOLPATH ?= tools/sptool 121c5e1da83SJayanth Dodderi ChidanandSPTOOL ?= ${SPTOOLPATH}/sptool.py 122c5e1da83SJayanth Dodderi ChidanandSP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 12320629b31SKarl MeakinSP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts 124c5e1da83SJayanth Dodderi Chidanand 1250fe374efSJ-Alves# Variables for use with sptool 1268cefbe03SAndrei HomescuTLCTOOL ?= $(host-poetry) run tlc 1270fe374efSJ-Alves 128c5e1da83SJayanth Dodderi Chidanand# Variables for use with ROMLIB 129c5e1da83SJayanth Dodderi ChidanandROMLIBPATH ?= lib/romlib 130c5e1da83SJayanth Dodderi Chidanand 131c5e1da83SJayanth Dodderi Chidanand# Variable for use with Python 132c5e1da83SJayanth Dodderi ChidanandPYTHON ?= python3 133c5e1da83SJayanth Dodderi Chidanand 134c5e1da83SJayanth Dodderi Chidanand# Variables for use with documentation build using Sphinx tool 135c5e1da83SJayanth Dodderi ChidanandDOCS_PATH ?= docs 136c5e1da83SJayanth Dodderi Chidanand 13732b209bfSAhmad Fatoum# Process Debug flag 13832b209bfSAhmad Fatoumifneq (${DEBUG}, 0) 13932b209bfSAhmad Fatoum BUILD_TYPE := debug 14032b209bfSAhmad Fatoum # Use LOG_LEVEL_INFO by default for debug builds 14132b209bfSAhmad Fatoum LOG_LEVEL := 40 14232b209bfSAhmad Fatoumelse 14332b209bfSAhmad Fatoum BUILD_TYPE := release 14432b209bfSAhmad Fatoum # Use LOG_LEVEL_NOTICE by default for release builds 14532b209bfSAhmad Fatoum LOG_LEVEL := 20 146fa28b3afSBoyan Karatotev # Enable link-time optimization (AKA "inter-procedural optimization") 147fa28b3afSBoyan Karatotev ifeq (${ARCH},aarch64) 148fa28b3afSBoyan Karatotev ifeq ($($(ARCH)-ld-id),$($(ARCH)-cc-id)) 149fa28b3afSBoyan Karatotev ENABLE_LTO := 1 150fa28b3afSBoyan Karatotev endif 151fa28b3afSBoyan Karatotev endif 152c5e1da83SJayanth Dodderi Chidanandendif #(Debug) 15332b209bfSAhmad Fatoum 154f1de4c8fSPeiyuan Song# Default build string (git branch and commit) 155f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},) 156f1de4c8fSPeiyuan Song BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 157f1de4c8fSPeiyuan Songendif 158dddf4283Slaurenw-armVERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} 159f1de4c8fSPeiyuan Song 160d75a9ecdSBoyan Karatotev# Setting W is quite verbose and most warnings will be pre-existing issues 161d75a9ecdSBoyan Karatotev# outside of the contributor's control. Don't fail the build on them so warnings 162d75a9ecdSBoyan Karatotev# can be seen and hopefully addressed 163d75a9ecdSBoyan Karatotevifdef W 164d75a9ecdSBoyan Karatotev ifneq (${W},0) 165d75a9ecdSBoyan Karatotev E ?= 0 166d75a9ecdSBoyan Karatotev endif 167d75a9ecdSBoyan Karatotevendif 168d75a9ecdSBoyan Karatotev 16973c99d4eSJuan Castillo################################################################################ 17073c99d4eSJuan Castillo# Common sources and include directories 17173c99d4eSJuan Castillo################################################################################ 172d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk 17373c99d4eSJuan Castillo 174758ccb80SChris Kay# Allow overriding the timestamp, for example for reproducible builds, or to 175758ccb80SChris Kay# synchronize timestamps across multiple projects. 176758ccb80SChris Kay# This must be set to a C string (including quotes where applicable). 177758ccb80SChris KayBUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__ 178758ccb80SChris Kay 179758ccb80SChris KayDEFINES += -DBUILD_MESSAGE_TIMESTAMP='$(BUILD_MESSAGE_TIMESTAMP)' 180758ccb80SChris KayDEFINES += -DBUILD_MESSAGE_VERSION_STRING='"$(VERSION_STRING)"' 181758ccb80SChris KayDEFINES += -DBUILD_MESSAGE_VERSION='"$(VERSION)"' 182758ccb80SChris Kay 18373c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 1847f56e9a3SSoby Mathew common/tf_log.c \ 1859d29c227SSoby Mathew common/${ARCH}/debug.S \ 18691b48c9fSJulius Werner drivers/console/multi_console.c \ 1879d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 1889d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 189c73686a1SBoyan Karatotev lib/extensions/pmuv3/${ARCH}/pmuv3.c \ 19038e580e6SBoyan Karatotev lib/locks/exclusive/${ARCH}/spinlock.c \ 191566034fcSSoby Mathew plat/common/plat_bl_common.c \ 1927f56e9a3SSoby Mathew plat/common/plat_log_common.c \ 19375311203Sdp-arm plat/common/${ARCH}/plat_common.c \ 1949d29c227SSoby Mathew plat/common/${ARCH}/platform_helpers.S \ 19561f72a34SRoberto Vargas ${COMPILER_RT_SRCS} 196d7a6b0f8SRyan Harkin 1978620bd0bSChris Kayifeq ($($(ARCH)-cc-id),arm-clang) 1988422a840SAntonio Nino Diaz BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 1998422a840SAntonio Nino Diazendif 2008422a840SAntonio Nino Diaz 2011f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 2021f461979SJustin Chadwell BL_COMMON_SOURCES += plat/common/ubsan.c 2031f461979SJustin Chadwellendif 2041f461979SJustin Chadwell 20501d237cbSYann GautierINCLUDES += -Iinclude \ 206f5478dedSAntonio Nino Diaz -Iinclude/arch/${ARCH} \ 20709d40e0eSAntonio Nino Diaz -Iinclude/lib/cpus/${ARCH} \ 20809d40e0eSAntonio Nino Diaz -Iinclude/lib/el3_runtime/${ARCH} \ 20909d40e0eSAntonio Nino Diaz ${PLAT_INCLUDES} \ 21009d40e0eSAntonio Nino Diaz ${SPD_INCLUDES} 21109d40e0eSAntonio Nino Diaz 2129c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk 2139c6d1c50SAntonio Nino Diaz 21473c99d4eSJuan Castillo################################################################################ 2153547270fSGovindraj Raja# Generic definitions 2163547270fSGovindraj Raja################################################################################ 2173547270fSGovindraj Raja 2183547270fSGovindraj Rajaifeq (${BUILD_BASE},) 2193547270fSGovindraj Raja BUILD_BASE := ./build 2203547270fSGovindraj Rajaendif 2213547270fSGovindraj RajaBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 2223547270fSGovindraj Raja 2233547270fSGovindraj RajaSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 2243547270fSGovindraj Raja 2253547270fSGovindraj Raja# Platforms providing their own TBB makefile may override this value 2263547270fSGovindraj RajaINCLUDE_TBBR_MK := 1 2273547270fSGovindraj Raja 2283547270fSGovindraj Raja################################################################################ 2293547270fSGovindraj Raja# Include SPD Makefile if one has been specified 2303547270fSGovindraj Raja################################################################################ 2313547270fSGovindraj Raja 2323547270fSGovindraj Rajaifneq (${SPD},none) 2333547270fSGovindraj Raja ifeq (${SPD},spmd) 2343547270fSGovindraj Raja # SPMD is located in std_svc directory 2353547270fSGovindraj Raja SPD_DIR := std_svc 2363547270fSGovindraj Raja 2373547270fSGovindraj Raja ifeq ($(SPMD_SPM_AT_SEL2),1) 2383547270fSGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 2393547270fSGovindraj Raja endif 2403547270fSGovindraj Raja 2413547270fSGovindraj Raja ifneq ($(SP_LAYOUT_FILE),) 2423547270fSGovindraj Raja BL2_ENABLE_SP_LOAD := 1 2433547270fSGovindraj Raja endif 2443547270fSGovindraj Raja else 2453547270fSGovindraj Raja # All other SPDs in spd directory 2463547270fSGovindraj Raja SPD_DIR := spd 2473547270fSGovindraj Raja endif #(SPD) 2483547270fSGovindraj Raja 2493547270fSGovindraj Raja # We expect to locate an spd.mk under the specified SPD directory 2503547270fSGovindraj Raja SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 2513547270fSGovindraj Raja 2523547270fSGovindraj Raja ifeq (${SPD_MAKE},) 2533547270fSGovindraj Raja $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 2543547270fSGovindraj Raja endif 2553547270fSGovindraj Raja $(info Including ${SPD_MAKE}) 2563547270fSGovindraj Raja include ${SPD_MAKE} 2573547270fSGovindraj Raja 2583547270fSGovindraj Raja # If there's BL32 companion for the chosen SPD, we expect that the SPD's 2593547270fSGovindraj Raja # Makefile would set NEED_BL32 to "yes". In this case, the build system 2603547270fSGovindraj Raja # supports two mutually exclusive options: 2613547270fSGovindraj Raja # * BL32 is built from source: then BL32_SOURCES must contain the list 2623547270fSGovindraj Raja # of source files to build BL32 2633547270fSGovindraj Raja # * BL32 is a prebuilt binary: then BL32 must point to the image file 2643547270fSGovindraj Raja # that will be included in the FIP 2653547270fSGovindraj Raja # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 2663547270fSGovindraj Raja # over the sources. 2673547270fSGovindraj Rajaendif #(SPD=none) 2683547270fSGovindraj Raja 269b0ddba24SArunachalam Ganapathy# Force set ENABLE_FEAT_RME and ENABLE_RMM to 1 until build option ENABLE_RME is 270b0ddba24SArunachalam Ganapathy# deprecated. constraints.mk prints a warning when this build option is used. 271b0ddba24SArunachalam Ganapathyifeq (${ENABLE_RME},1) 272b0ddba24SArunachalam Ganapathy override ENABLE_FEAT_RME := 1 273b0ddba24SArunachalam Ganapathy override ENABLE_RMM := 1 274b0ddba24SArunachalam Ganapathyendif 275b0ddba24SArunachalam Ganapathy 2763547270fSGovindraj Raja################################################################################ 277696ed168SOlivier Deprez# Include the platform specific Makefile after the SPD Makefile (the platform 278696ed168SOlivier Deprez# makefile may use all previous definitions in this file) 279696ed168SOlivier Deprez################################################################################ 280696ed168SOlivier Deprezinclude ${PLAT_MAKEFILE_FULL} 281696ed168SOlivier Deprez 282696ed168SOlivier Deprez################################################################################ 2838d9f5f25SBoyan Karatotev# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from 2848d9f5f25SBoyan Karatotev# platform. 2858d9f5f25SBoyan Karatotev################################################################################ 2868d9f5f25SBoyan Karatotev 2878d9f5f25SBoyan Karatotevinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 2888d9f5f25SBoyan Karatotev################################################################################ 289f5211420SGovindraj Raja# Process BRANCH_PROTECTION value and set 290f5211420SGovindraj Raja# Pointer Authentication and Branch Target Identification flags 291f5211420SGovindraj Raja################################################################################ 292f5211420SGovindraj Rajaifeq (${BRANCH_PROTECTION},0) 293f5211420SGovindraj Raja # Default value turns off all types of branch protection 294f5211420SGovindraj Raja BP_OPTION := none 295f5211420SGovindraj Rajaelse ifneq (${ARCH},aarch64) 296f5211420SGovindraj Raja $(error BRANCH_PROTECTION requires AArch64) 297f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},1) 298f5211420SGovindraj Raja # Enables all types of branch protection features 299f5211420SGovindraj Raja BP_OPTION := standard 300f5211420SGovindraj Raja ENABLE_BTI := 1 301f5211420SGovindraj Raja ENABLE_PAUTH := 1 302f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},2) 303f5211420SGovindraj Raja # Return address signing to its standard level 304f5211420SGovindraj Raja BP_OPTION := pac-ret 305f5211420SGovindraj Raja ENABLE_PAUTH := 1 306f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},3) 307f5211420SGovindraj Raja # Extend the signing to include leaf functions 308f5211420SGovindraj Raja BP_OPTION := pac-ret+leaf 309f5211420SGovindraj Raja ENABLE_PAUTH := 1 310f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},4) 311f5211420SGovindraj Raja # Turn on branch target identification mechanism 312f5211420SGovindraj Raja BP_OPTION := bti 313f5211420SGovindraj Raja ENABLE_BTI := 1 3148d9f5f25SBoyan Karatotevelse ifeq (${BRANCH_PROTECTION},5) 3158d9f5f25SBoyan Karatotev # Turn on branch target identification mechanism 3168d9f5f25SBoyan Karatotev BP_OPTION := standard 3178d9f5f25SBoyan Karatotev ENABLE_BTI := 2 3188d9f5f25SBoyan Karatotev ENABLE_PAUTH := 2 319f5211420SGovindraj Rajaelse 320f5211420SGovindraj Raja $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 321f5211420SGovindraj Rajaendif #(BRANCH_PROTECTION) 322f5211420SGovindraj Raja 3238d9f5f25SBoyan Karatotevifneq ($(ENABLE_PAUTH),0) 3248d9f5f25SBoyan Karatotev CTX_INCLUDE_PAUTH_REGS := ${ENABLE_PAUTH} 325f5211420SGovindraj Rajaendif 326f5211420SGovindraj Raja 327f5211420SGovindraj Raja# Pointer Authentication sources 3288d9f5f25SBoyan Karatotevifneq (${ENABLE_PAUTH},0) 329f5211420SGovindraj Raja# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 330f5211420SGovindraj Raja# Pauth support. As it's not secure, it must be reimplemented for real platforms 3318d9f5f25SBoyan Karatotev BL_COMMON_SOURCES += lib/extensions/pauth/pauth.c 332f5211420SGovindraj Rajaendif 333f5211420SGovindraj Raja 334*d63c2960SArunachalam Ganapathyifneq (${ENABLE_FEAT_RME},0) 335*d63c2960SArunachalam Ganapathy # bitlocks are only useful with atomics 336*d63c2960SArunachalam Ganapathy ifneq ($(RME_GPT_BITLOCK_BLOCK), 0) 337*d63c2960SArunachalam Ganapathy USE_SPINLOCK_CAS := 1 338*d63c2960SArunachalam Ganapathy endif 339*d63c2960SArunachalam Ganapathyendif 340*d63c2960SArunachalam Ganapathy 341f5211420SGovindraj Raja################################################################################ 342b0ddba24SArunachalam Ganapathy# RMM dependent flags configuration, Enable optional features for RMM. 343f5211420SGovindraj Raja################################################################################ 344b0ddba24SArunachalam Ganapathyifeq (${ENABLE_RMM},1) 345cbba59c4SSona Mathew # RMM relies on SMCCC_ARCH_FEATURE_AVAILABILITY to discover EL3 enablement 346cbba59c4SSona Mathew ARCH_FEATURE_AVAILABILITY := 1 347cbba59c4SSona Mathew 348b0ddba24SArunachalam Ganapathy # RMM requires el2 context to be saved for now. 349f5211420SGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 350f5211420SGovindraj Raja CTX_INCLUDE_AARCH32_REGS := 0 351f5211420SGovindraj Raja CTX_INCLUDE_PAUTH_REGS := 1 352f5211420SGovindraj Raja 353d048af0dSJavier Almansa Sobrino ifneq ($(ENABLE_FEAT_MPAM), 0) 354d048af0dSJavier Almansa Sobrino CTX_INCLUDE_MPAM_REGS := 1 355d048af0dSJavier Almansa Sobrino endif 356d048af0dSJavier Almansa Sobrino 357b0ddba24SArunachalam Ganapathy # RMM enables CSV2_2 extension by default. 358f5211420SGovindraj Raja ENABLE_FEAT_CSV2_2 = 1 359f474a5a0SSoby Mathew # Enable FIRME interface for CCA. 360f474a5a0SSoby Mathew FIRME_SUPPORT := 1 361f5211420SGovindraj Raja 362b0ddba24SArunachalam Ganapathy # Include rmmd Makefile if RMM is enabled 3635b18de09SZelalem Aweke include services/std_svc/rmmd/rmmd.mk 364b0ddba24SArunachalam Ganapathyendif #(ENABLE_RMM) 3655b18de09SZelalem Aweke 3667e84f3cfSTushar Khandelwal################################################################################ 36730655136SGovindraj Raja# Make 128-Bit sysreg read/writes availabe when FEAT_D128 is enabled. 36830655136SGovindraj Raja################################################################################ 36930655136SGovindraj Rajaifneq (${ENABLE_FEAT_D128}, 0) 37030655136SGovindraj Raja BL_COMMON_SOURCES += lib/extensions/sysreg128/sysreg128.S 37130655136SGovindraj Rajaendif 37230655136SGovindraj Raja 37342d4d3baSArvind Ram Prakash# This internal flag is common option which is set to 1 for scenarios 37442d4d3baSArvind Ram Prakash# when the BL2 is running in EL3 level. This occurs in two scenarios - 37542d4d3baSArvind Ram Prakash# 4 world system running BL2 at EL3 and two world system without BL1 running 37642d4d3baSArvind Ram Prakash# BL2 in EL3 37742d4d3baSArvind Ram Prakash 378dfdbda02SAndre Przywaraifneq ($(filter 1 2,${RESET_TO_BL2} ${ENABLE_FEAT_RME}),) 37942d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 38042d4d3baSArvind Ram Prakashelse 38142d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 0 38242d4d3baSArvind Ram Prakashendif 38342d4d3baSArvind Ram Prakash 384f87e54f7SManish Pandey# This internal flag is set to 1 when Firmware First handling of External aborts 385f87e54f7SManish Pandey# is required by lowe ELs. Currently only NS requires this support. 386f87e54f7SManish Pandeyifeq ($(HANDLE_EA_EL3_FIRST_NS),1) 387f87e54f7SManish Pandey FFH_SUPPORT := 1 388f87e54f7SManish Pandeyelse 389f87e54f7SManish Pandey FFH_SUPPORT := 0 390f87e54f7SManish Pandeyendif 391f87e54f7SManish Pandey 392c2dc5129SBoyan Karatotevifneq ($(filter 1,${ERRATA_A53_1530924} ${ERRATA_A55_1530923} \ 3937096d2bcSXialin Liu ${ERRATA_A57_1319537} ${ERRATA_A65_1541130} ${ERRATA_A65AE_1638571} \ 3947096d2bcSXialin Liu ${ERRATA_A72_1319367} ${ERRATA_A76_1165522}),) 395c2dc5129SBoyan KaratotevERRATA_SPECULATIVE_AT := 1 396c2dc5129SBoyan Karatotevelse 397c2dc5129SBoyan KaratotevERRATA_SPECULATIVE_AT := 0 398c2dc5129SBoyan Karatotevendif 399c2dc5129SBoyan Karatotev 400a4409008Sdp-arm################################################################################ 401a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32 402a4409008Sdp-arm################################################################################ 403c5e1da83SJayanth Dodderi Chidanandifeq (${ARCH},aarch32) 404c5e1da83SJayanth Dodderi Chidanand NEED_BL32 := yes 405c5e1da83SJayanth Dodderi Chidanand 406a4409008Sdp-arm ifneq (${AARCH32_SP},none) 407a4409008Sdp-arm # We expect to locate an sp.mk under the specified AARCH32_SP directory 408a4409008Sdp-arm AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 409a4409008Sdp-arm 410a4409008Sdp-arm ifeq (${AARCH32_SP_MAKE},) 411a4409008Sdp-arm $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 412a4409008Sdp-arm endif 413a4409008Sdp-arm $(info Including ${AARCH32_SP_MAKE}) 414a4409008Sdp-arm include ${AARCH32_SP_MAKE} 415a4409008Sdp-arm endif 416c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch32) 4174f6ad66aSAchin Gupta 41873c99d4eSJuan Castillo################################################################################ 41977f1f7a1SVarun Wadekar# Include libc if not overridden 42077f1f7a1SVarun Wadekar################################################################################ 42177f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0) 42277f1f7a1SVarun Wadekarinclude lib/libc/libc.mk 42377f1f7a1SVarun Wadekarendif 42477f1f7a1SVarun Wadekar 4255d893410SBoyan Karatotevifneq (${USE_GIC_DRIVER},0) 4265d893410SBoyan Karatotevinclude drivers/arm/gic/gic.mk 4275d893410SBoyan Karatotevendif 4285d893410SBoyan Karatotev 42977f1f7a1SVarun Wadekar################################################################################ 430c5e1da83SJayanth Dodderi Chidanand# Check incompatible options and dependencies 431cf2c8a33SAntonio Nino Diaz################################################################################ 432b14987cfSBoyan Karatotevinclude ${MAKE_HELPERS_DIRECTORY}constraints.mk 433c5e1da83SJayanth Dodderi Chidanand 434c5e1da83SJayanth Dodderi Chidanand# The cert_create tool cannot generate certificates individually, so we use the 435c5e1da83SJayanth Dodderi Chidanand# target 'certificates' to create them all 436c5e1da83SJayanth Dodderi Chidanandifneq (${GENERATE_COT},0) 437c5e1da83SJayanth Dodderi Chidanand FIP_DEPS += certificates 438c5e1da83SJayanth Dodderi Chidanand FWU_FIP_DEPS += fwu_certificates 439d57362bdSXialin Liu BL2_FIP_DEPS += bl2_certificates 440c5e1da83SJayanth Dodderi Chidanandendif 441c5e1da83SJayanth Dodderi Chidanand 442c5e1da83SJayanth Dodderi Chidanandifneq (${DECRYPTION_SUPPORT},none) 443c5e1da83SJayanth Dodderi Chidanand ENC_ARGS += -f ${FW_ENC_STATUS} 444c5e1da83SJayanth Dodderi Chidanand ENC_ARGS += -k ${ENC_KEY} 445c5e1da83SJayanth Dodderi Chidanand ENC_ARGS += -n ${ENC_NONCE} 446c5e1da83SJayanth Dodderi Chidanand FIP_DEPS += enctool 447c5e1da83SJayanth Dodderi Chidanand FWU_FIP_DEPS += enctool 448d57362bdSXialin Liu BL2_FIP_DEPS += enctool 449c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 450c5e1da83SJayanth Dodderi Chidanand 451cf2c8a33SAntonio Nino Diaz################################################################################ 45273c99d4eSJuan Castillo# Process platform overrideable behaviour 45373c99d4eSJuan Castillo################################################################################ 4544f6ad66aSAchin Gupta 4555f24ce96SManish Pandeyifdef BL1_SOURCES 4565f24ce96SManish Pandey NEED_BL1 := yes 457c5e1da83SJayanth Dodderi Chidanandendif #(BL1_SOURCES) 4585f24ce96SManish Pandey 4595f24ce96SManish Pandeyifdef BL2_SOURCES 4605f24ce96SManish Pandey NEED_BL2 := yes 4615f24ce96SManish Pandey 462bd97f83aSJohn Tsichritzis # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 463bd97f83aSJohn Tsichritzis # Certificate generation tools. This flag can be overridden by the platform. 464cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 465cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 466cf2c8a33SAntonio Nino Diaz # in the FIP file. 4674c117f6cSSandrine Bailleux NEED_BL33 := no 468cf2c8a33SAntonio Nino Diaz else 46968450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 470cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 471cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 472cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 473cf2c8a33SAntonio Nino Diaz else 474cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 475cf2c8a33SAntonio Nino Diaz endif 4764c117f6cSSandrine Bailleux endif 477c5e1da83SJayanth Dodderi Chidanandendif #(BL2_SOURCES) 4786f971622SJuan Castillo 4795f24ce96SManish Pandeyifdef BL2U_SOURCES 4805f24ce96SManish Pandey NEED_BL2U := yes 481c5e1da83SJayanth Dodderi Chidanandendif #(BL2U_SOURCES) 4825f24ce96SManish Pandey 4834d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it. 4844d045d0eSMasahiro Yamadaifdef SCP_BL2 4854d045d0eSMasahiro Yamada NEED_SCP_BL2 := yes 486c5e1da83SJayanth Dodderi Chidanandendif #(SCP_BL2) 4874d045d0eSMasahiro Yamada 4885744e874SSoby Mathew# For AArch32, BL31 is not currently supported. 4895744e874SSoby Mathewifneq (${ARCH},aarch32) 4905744e874SSoby Mathew ifdef BL31_SOURCES 491c5e1da83SJayanth Dodderi Chidanand # When booting an EL3 payload, there is no need to compile the BL31 492c5e1da83SJayanth Dodderi Chidanand # image nor put it in the FIP. 4935744e874SSoby Mathew ifndef EL3_PAYLOAD_BASE 4945744e874SSoby Mathew NEED_BL31 := yes 4955744e874SSoby Mathew endif 4965744e874SSoby Mathew endif 497c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch64) 4985744e874SSoby Mathew 49973c99d4eSJuan Castillo# Process TBB related flags 5006f971622SJuan Castilloifneq (${GENERATE_COT},0) 50173c99d4eSJuan Castillo # Common cert_create options 5026f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 5036f971622SJuan Castillo $(eval CRT_ARGS += -n) 5040191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 505d57362bdSXialin Liu $(eval BL2_CRT_ARGS += -n) 506fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 507fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 5080191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 509d57362bdSXialin Liu $(eval BL2_CRT_ARGS += -k) 510fd34e7baSJuan Castillo endif 5116f971622SJuan Castillo endif 51273c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 51373c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 51473c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 51573c99d4eSJuan Castillo endif 516c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT) 5176f971622SJuan Castillo 5181c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0) 5191c75d5dfSMasahiro Yamada FIP_ARGS += --align ${FIP_ALIGN} 520c5e1da83SJayanth Dodderi Chidanandendif #(FIP_ALIGN) 5211c75d5dfSMasahiro Yamada 5225f24ce96SManish Pandeyifdef FDT_SOURCES 5235f24ce96SManish Pandey NEED_FDT := yes 524c5e1da83SJayanth Dodderi Chidanandendif #(FDT_SOURCES) 5255f24ce96SManish Pandey 52673c99d4eSJuan Castillo################################################################################ 52746e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL 52846e5e035SMichalis Pappas################################################################################ 52946e5e035SMichalis Pappas 53046e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk 53146e5e035SMichalis Pappas 53246e5e035SMichalis Pappas################################################################################ 5338a86052dSSoby Mathew# Include BL specific makefiles 5348a86052dSSoby Mathew################################################################################ 5355f24ce96SManish Pandey 5365f24ce96SManish Pandeyifeq (${NEED_BL1},yes) 5378a86052dSSoby Mathewinclude bl1/bl1.mk 5388a86052dSSoby Mathewendif 5398a86052dSSoby Mathew 5405f24ce96SManish Pandeyifeq (${NEED_BL2},yes) 5418a86052dSSoby Mathewinclude bl2/bl2.mk 5428a86052dSSoby Mathewendif 5438a86052dSSoby Mathew 5445f24ce96SManish Pandeyifeq (${NEED_BL2U},yes) 5458a86052dSSoby Mathewinclude bl2u/bl2u.mk 5468a86052dSSoby Mathewendif 5478a86052dSSoby Mathew 5485744e874SSoby Mathewifeq (${NEED_BL31},yes) 5498a86052dSSoby Mathewinclude bl31/bl31.mk 5508a86052dSSoby Mathewendif 55103b397a8SNishanth Menon 55273c99d4eSJuan Castillo################################################################################ 55373c99d4eSJuan Castillo# Build options checks 55473c99d4eSJuan Castillo################################################################################ 55573c99d4eSJuan Castillo 556c5e1da83SJayanth Dodderi Chidanand# Boolean_Flags 557327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\ 558327131c4SLeonardo Sandoval $(sort \ 559327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 56046789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 561327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 56228973741SBoyan Karatotev $(CPU_FLAG_LIST) \ 563327131c4SLeonardo Sandoval CREATE_KEYS \ 564327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 565327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 56642422622SMadhukar Pappireddy CTX_INCLUDE_SVE_REGS \ 567327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 5689acff28aSArvind Ram Prakash CTX_INCLUDE_MPAM_REGS \ 569327131c4SLeonardo Sandoval DEBUG \ 570327131c4SLeonardo Sandoval DYN_DISABLE_AUTH \ 571327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 5721fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 573873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 574327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 575327131c4SLeonardo Sandoval ENABLE_PIE \ 576327131c4SLeonardo Sandoval ENABLE_PMF \ 577327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 578327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 579dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 5800c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 5818cef63d6SBoyan Karatotev ENABLE_FEAT_GCIE \ 582b0ddba24SArunachalam Ganapathy ENABLE_RMM \ 583f87e54f7SManish Pandey FFH_SUPPORT \ 584327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 585327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 586327131c4SLeonardo Sandoval GENERATE_COT \ 587327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 58846cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 589538516f5SBipin Ravi HARDEN_SLS \ 590327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 591327131c4SLeonardo Sandoval MEASURED_BOOT \ 59236e3d877SAbhi.Singh DISCRETE_TPM \ 593e7f1181fSTamas Ban DICE_PROTECTION_ENVIRONMENT \ 5946a88ec8bSRaghu Krishnamurthy RMMD_ENABLE_EL3_TOKEN_SIGN \ 5952132c707SSona Mathew RMMD_ENABLE_IDE_KEY_PROG \ 59668eacbbfSShruti Gupta RMM_V1_COMPAT \ 59700e28874SManish V Badarkhe DRTM_SUPPORT \ 598327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 599327131c4SLeonardo Sandoval OVERRIDE_LIBC \ 600327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 6015be66449SBoyan Karatotev PLAT_EXTRA_LD_SCRIPT \ 602327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 603327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 60464b4710bSWing Li PSCI_OS_INIT_MODE \ 6058db17052SBoyan Karatotev ARCH_FEATURE_AVAILABILITY \ 606327131c4SLeonardo Sandoval RESET_TO_BL31 \ 607327131c4SLeonardo Sandoval SAVE_KEYS \ 608327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 60996a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 610327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 61186acbbe2SYe Li SEPARATE_RWDATA_REGION \ 612308ebfa1SMadhukar Pappireddy SEPARATE_SIMD_SECTION \ 613327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 614327131c4SLeonardo Sandoval SPM_MM \ 6151d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 616801cd3c8SNishant Sharma SPMC_AT_EL3_SEL0_SP \ 617327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 618890b5088SRaghu Krishnamurthy ENABLE_SPMD_LP \ 6193ba2c151SRaymond Mao TRANSFER_LIST \ 620327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 621327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 622327131c4SLeonardo Sandoval USE_DEBUGFS \ 623291e493dSHarrison Mutai USE_KERNEL_DT_CONVENTION \ 624327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 625327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 626327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 627327131c4SLeonardo Sandoval USE_ROMLIB \ 628327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 629327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 63042d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 631327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 632327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 633327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 634327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 635327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 63600e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 637327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 638327131c4SLeonardo Sandoval USE_SP804_TIMER \ 639396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 64011d05a77SSughosh Ganu PSA_FWU_METADATA_FW_STORE_DESC \ 64168120783SChris Kay ENABLE_MPMM \ 6426a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 6430b22e591SJayanth Dodderi Chidanand TRNG_SUPPORT \ 644593ae354SBoyan Karatotev ENABLE_ERRATA_ALL \ 645ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 646ef63f5beSSona Mathew ERRATA_NON_ARM_INTERCONNECT \ 64704c7303bSOkash Khawaja CONDITIONAL_CMO \ 6485782b890SManish V Badarkhe PSA_CRYPTO \ 64985bebe18SSandrine Bailleux ENABLE_CONSOLE_GETC \ 650183329a5SArvind Ram Prakash INIT_UNUSED_NS_EL2 \ 651bfef8b90SJuan Pablo Conde PLATFORM_REPORT_CTX_MEM_USE \ 652ae770fedSYann Gautier EARLY_CONSOLE \ 653f99a69c3SArvind Ram Prakash PRESERVE_DSU_PMU_REGS \ 6548953568aSLevi Yun HOB_LIST \ 655cf48f49fSManish V Badarkhe LFA_SUPPORT \ 656f5cb144dSMadhukar Pappireddy SUPPORT_SP_LIVE_ACTIVATION \ 65755eb4f56SManish V Badarkhe TEST_IO_SHORT_READ_FI \ 658327131c4SLeonardo Sandoval))) 65973c99d4eSJuan Castillo 660c5e1da83SJayanth Dodderi Chidanand# Numeric_Flags 661327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\ 662327131c4SLeonardo Sandoval $(sort \ 663327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 664327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 665327131c4SLeonardo Sandoval BRANCH_PROTECTION \ 6666a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_PAUTH_REGS \ 6676a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_NEVE_REGS \ 66883a4dae1SBoyan Karatotev DISABLE_MTPMU \ 6691298f2f1SJayanth Dodderi Chidanand ENABLE_BRBE_FOR_NS \ 67047c681b7SJayanth Dodderi Chidanand ENABLE_TRBE_FOR_NS \ 6716a0da736SJayanth Dodderi Chidanand ENABLE_BTI \ 6726a0da736SJayanth Dodderi Chidanand ENABLE_PAUTH \ 673025b1b81SJohn Powell ENABLE_FEAT_PAUTH_LR \ 674cc2523bbSAndre Przywara ENABLE_FEAT_AIE \ 675d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 6766a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 677d6affea1SGovindraj Raja ENABLE_FEAT_CLRBHB \ 678a1032bebSJohn Powell ENABLE_FEAT_CPA2 \ 6796a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 68030019d86SSona Mathew ENABLE_FEAT_CSV2_3 \ 681e8cc9706SXialin Liu ENABLE_FEAT_CRYPTO \ 682e8cc9706SXialin Liu ENABLE_FEAT_CRYPTO_SHA3 \ 68383271d5aSArvind Ram Prakash ENABLE_FEAT_DEBUGV8P9 \ 6846a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_DIT \ 6856a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 686714a1a93SManish Pandey ENABLE_FEAT_EBEP \ 6876a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 68833e6aaacSArvind Ram Prakash ENABLE_FEAT_FGT2 \ 6897e58ab32SBoyan Karatotev ENABLE_FEAT_HDBSS \ 690c2d6bbdcSBoyan Karatotev ENABLE_FEAT_HACDBS \ 691b6cf126aSBoyan Karatotev ENABLE_FEAT_STEP2 \ 6924286d16fSArvind Ram Prakash ENABLE_FEAT_UINJ \ 6934274b526SArvind Ram Prakash ENABLE_FEAT_FGWTE3 \ 694a57e18e4SArvind Ram Prakash ENABLE_FEAT_FPMR \ 6956a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_HCX \ 696f396aec8SArvind Ram Prakash ENABLE_FEAT_IDTE3 \ 69719d52a83SAndre Przywara ENABLE_FEAT_LS64_ACCDATA \ 6987e84f3cfSTushar Khandelwal ENABLE_FEAT_MEC \ 6996b8df7b9SArvind Ram Prakash ENABLE_FEAT_MOPS \ 70027bc1386SManoj Kumar ENABLE_FEAT_MORELLO \ 7018e397889SGovindraj Raja ENABLE_FEAT_MTE2 \ 7026a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 703b3bcfd12SAndre Przywara ENABLE_FEAT_PFAR \ 7046a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_RNG \ 705ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 7066a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 707d3331603SMark Brown ENABLE_FEAT_TCR2 \ 7086d0433f0SJayanth Dodderi Chidanand ENABLE_FEAT_THE \ 7090e4daed2SGovindraj Raja ENABLE_FEAT_SB \ 710062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 711062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 712062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 713062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 7144ec4e545SJayanth Dodderi Chidanand ENABLE_FEAT_SCTLR2 \ 71530655136SGovindraj Raja ENABLE_FEAT_D128 \ 7165e827bf0STimothy Hayes ENABLE_FEAT_RME_GDI \ 717688ab57bSMark Brown ENABLE_FEAT_GCS \ 7186a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 719edebefbcSArvind Ram Prakash ENABLE_FEAT_MPAM \ 720c42aefd3SArvind Ram Prakash ENABLE_FEAT_MPAM_PE_BW_CTRL \ 721553c24c3SBoyan Karatotev ENABLE_FEAT_RAS \ 722dfdbda02SAndre Przywara ENABLE_FEAT_RME \ 7236437a09aSAndre Przywara ENABLE_SPE_FOR_NS \ 724603a0c6fSAndre Przywara ENABLE_SYS_REG_TRACE_FOR_NS \ 72545007acdSJayanth Dodderi Chidanand ENABLE_SME_FOR_NS \ 72603d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 7272b0bc4e0SJayanth Dodderi Chidanand ENABLE_SVE_FOR_NS \ 7286a0da736SJayanth Dodderi Chidanand ENABLE_TRF_FOR_NS \ 729327131c4SLeonardo Sandoval FW_ENC_STATUS \ 7305357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 7315357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 7320322d7afSJay Monkman SPMC_AT_EL3_PARTITION_MAX_UUIDS \ 733781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 734781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 735bebcf27fSMark Brown SVE_VECTOR_LEN \ 73638e580e6SBoyan Karatotev USE_SPINLOCK_CAS \ 7370ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 738ee580c2dSBoyan Karatotev W \ 73955eb4f56SManish V Badarkhe TEST_IO_SHORT_READ_FI_IMAGE_ID \ 740327131c4SLeonardo Sandoval))) 741c877b414SJeenu Viswambharan 742aacff749SJustin Chadwellifdef KEY_SIZE 743aacff749SJustin Chadwell $(eval $(call assert_numeric,KEY_SIZE)) 744aacff749SJustin Chadwellendif 745aacff749SJustin Chadwell 7461f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),) 7471f461979SJustin Chadwell $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 7481f461979SJustin Chadwellendif 7491f461979SJustin Chadwell 75073c99d4eSJuan Castillo################################################################################ 75173c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 75273c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 75373c99d4eSJuan Castillo# platform to overwrite the default options 75473c99d4eSJuan Castillo################################################################################ 75573c99d4eSJuan Castillo 756327131c4SLeonardo Sandoval$(eval $(call add_defines,\ 757327131c4SLeonardo Sandoval $(sort \ 758327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 759327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 760327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 76146789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 762327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 76328973741SBoyan Karatotev $(CPU_FLAG_LIST) \ 764327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 765327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 76642422622SMadhukar Pappireddy CTX_INCLUDE_SVE_REGS \ 767327131c4SLeonardo Sandoval CTX_INCLUDE_PAUTH_REGS \ 7689acff28aSArvind Ram Prakash CTX_INCLUDE_MPAM_REGS \ 769327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 770327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 771062f8aafSArunachalam Ganapathy CTX_INCLUDE_NEVE_REGS \ 772ee580c2dSBoyan Karatotev DEBUG \ 773327131c4SLeonardo Sandoval DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 7740063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 775d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 7761fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 777873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 778327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 779327131c4SLeonardo Sandoval ENABLE_BTI \ 780e8cc9706SXialin Liu ENABLE_FEAT_CRYPTO \ 781e8cc9706SXialin Liu ENABLE_FEAT_CRYPTO_SHA3 \ 78283271d5aSArvind Ram Prakash ENABLE_FEAT_DEBUGV8P9 \ 783f396aec8SArvind Ram Prakash ENABLE_FEAT_IDTE3 \ 784edebefbcSArvind Ram Prakash ENABLE_FEAT_MPAM \ 785c42aefd3SArvind Ram Prakash ENABLE_FEAT_MPAM_PE_BW_CTRL \ 786327131c4SLeonardo Sandoval ENABLE_PAUTH \ 787025b1b81SJohn Powell ENABLE_FEAT_PAUTH_LR \ 788327131c4SLeonardo Sandoval ENABLE_PIE \ 789327131c4SLeonardo Sandoval ENABLE_PMF \ 790327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 791dfdbda02SAndre Przywara ENABLE_FEAT_RME \ 792b0ddba24SArunachalam Ganapathy ENABLE_RMM \ 79368eacbbfSShruti Gupta RMM_V1_COMPAT \ 7946a88ec8bSRaghu Krishnamurthy RMMD_ENABLE_EL3_TOKEN_SIGN \ 7952132c707SSona Mathew RMMD_ENABLE_IDE_KEY_PROG \ 796327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 797dc78e62dSjohpow01 ENABLE_SME_FOR_NS \ 79803d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 799dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 80090118bb5SAndre Przywara ENABLE_SPE_FOR_NS \ 801327131c4SLeonardo Sandoval ENABLE_SVE_FOR_NS \ 8020c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 803970a4a8dSManish Pandey ENABLE_FEAT_RAS \ 804f87e54f7SManish Pandey FFH_SUPPORT \ 805327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 806327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 807327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 808327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 809327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 81046cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 811327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 812327131c4SLeonardo Sandoval LOG_LEVEL \ 813327131c4SLeonardo Sandoval MEASURED_BOOT \ 81436e3d877SAbhi.Singh DISCRETE_TPM \ 815e7f1181fSTamas Ban DICE_PROTECTION_ENVIRONMENT \ 81600e28874SManish V Badarkhe DRTM_SUPPORT \ 817327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 8187256cf0aSRohit Mathew PLATFORM_NODE_COUNT \ 819327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 8205be66449SBoyan Karatotev PLAT_EXTRA_LD_SCRIPT \ 821327131c4SLeonardo Sandoval PLAT_${PLAT} \ 822327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 823327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 82464b4710bSWing Li PSCI_OS_INIT_MODE \ 8258db17052SBoyan Karatotev ARCH_FEATURE_AVAILABILITY \ 826327131c4SLeonardo Sandoval RESET_TO_BL31 \ 827d766084fSAlexeiFedorov RME_GPT_BITLOCK_BLOCK \ 828ec0088bbSAlexeiFedorov RME_GPT_MAX_BLOCK \ 829327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 8305ce4ee1aSXialin Liu SEPARATE_BL2_FIP \ 83196a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 832327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 83386acbbe2SYe Li SEPARATE_RWDATA_REGION \ 834308ebfa1SMadhukar Pappireddy SEPARATE_SIMD_SECTION \ 835327131c4SLeonardo Sandoval RECLAIM_INIT_CODE \ 836327131c4SLeonardo Sandoval SPD_${SPD} \ 837327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 838327131c4SLeonardo Sandoval SPM_MM \ 8391d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 8400322d7afSJay Monkman SPMC_AT_EL3_PARTITION_MAX_UUIDS \ 841801cd3c8SNishant Sharma SPMC_AT_EL3_SEL0_SP \ 842327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 8433ba2c151SRaymond Mao TRANSFER_LIST \ 844327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 8457dfb9911SJimmy Brisson TRNG_SUPPORT \ 846ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 847ef63f5beSSona Mathew ERRATA_NON_ARM_INTERCONNECT \ 848327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 849327131c4SLeonardo Sandoval USE_DEBUGFS \ 850327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 851327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 852327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 853327131c4SLeonardo Sandoval USE_ROMLIB \ 854327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 855291e493dSHarrison Mutai USE_KERNEL_DT_CONVENTION \ 856327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 85742d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 85842d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 \ 859327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 860327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 861327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 862327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 86300e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 864327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 865327131c4SLeonardo Sandoval USE_SP804_TIMER \ 86612cd65e0STomas Pilar ENABLE_FEAT_RNG \ 867ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 8684e04478aSChris Kay ENABLE_FEAT_SB \ 8697d33ffe4SDaniel Boulby ENABLE_FEAT_DIT \ 8705357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 8715357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 872396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 87311d05a77SSughosh Ganu PSA_FWU_METADATA_FW_STORE_DESC \ 874744ad974Sjohpow01 ENABLE_BRBE_FOR_NS \ 875813524eaSManish V Badarkhe ENABLE_TRBE_FOR_NS \ 876d4582d30SManish V Badarkhe ENABLE_SYS_REG_TRACE_FOR_NS \ 8778fcd3d96SManish V Badarkhe ENABLE_TRF_FOR_NS \ 878cc2523bbSAndre Przywara ENABLE_FEAT_AIE \ 879cb4ec47bSjohpow01 ENABLE_FEAT_HCX \ 88068120783SChris Kay ENABLE_MPMM \ 881f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 88233e6aaacSArvind Ram Prakash ENABLE_FEAT_FGT2 \ 8834286d16fSArvind Ram Prakash ENABLE_FEAT_UINJ \ 8844274b526SArvind Ram Prakash ENABLE_FEAT_FGWTE3 \ 885a57e18e4SArvind Ram Prakash ENABLE_FEAT_FPMR \ 886f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 887714a1a93SManish Pandey ENABLE_FEAT_EBEP \ 8886a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 8896a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 8906a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 891d6affea1SGovindraj Raja ENABLE_FEAT_CLRBHB \ 892a1032bebSJohn Powell ENABLE_FEAT_CPA2 \ 8936a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 89430019d86SSona Mathew ENABLE_FEAT_CSV2_3 \ 89519d52a83SAndre Przywara ENABLE_FEAT_LS64_ACCDATA \ 8967e84f3cfSTushar Khandelwal ENABLE_FEAT_MEC \ 89727bc1386SManoj Kumar ENABLE_FEAT_MORELLO \ 8986a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 899d3331603SMark Brown ENABLE_FEAT_TCR2 \ 9006d0433f0SJayanth Dodderi Chidanand ENABLE_FEAT_THE \ 901062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 902062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 903062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 904062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 9054ec4e545SJayanth Dodderi Chidanand ENABLE_FEAT_SCTLR2 \ 906b6cf126aSBoyan Karatotev ENABLE_FEAT_STEP2 \ 90730655136SGovindraj Raja ENABLE_FEAT_D128 \ 9085e827bf0STimothy Hayes ENABLE_FEAT_RME_GDI \ 909688ab57bSMark Brown ENABLE_FEAT_GCS \ 9107e58ab32SBoyan Karatotev ENABLE_FEAT_HDBSS \ 911c2d6bbdcSBoyan Karatotev ENABLE_FEAT_HACDBS \ 9126b8df7b9SArvind Ram Prakash ENABLE_FEAT_MOPS \ 9138cef63d6SBoyan Karatotev ENABLE_FEAT_GCIE \ 9148e397889SGovindraj Raja ENABLE_FEAT_MTE2 \ 915b3bcfd12SAndre Przywara ENABLE_FEAT_PFAR \ 9166a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 917781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 918781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 91904c7303bSOkash Khawaja CONDITIONAL_CMO \ 9200ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 921a8cf6faeSJayanth Dodderi Chidanand SVE_VECTOR_LEN \ 922890b5088SRaghu Krishnamurthy ENABLE_SPMD_LP \ 9235782b890SManish V Badarkhe PSA_CRYPTO \ 92485bebe18SSandrine Bailleux ENABLE_CONSOLE_GETC \ 925183329a5SArvind Ram Prakash INIT_UNUSED_NS_EL2 \ 926bfef8b90SJuan Pablo Conde PLATFORM_REPORT_CTX_MEM_USE \ 927ae770fedSYann Gautier EARLY_CONSOLE \ 928f99a69c3SArvind Ram Prakash PRESERVE_DSU_PMU_REGS \ 9298953568aSLevi Yun HOB_LIST \ 9302f5fd826SHarrison Mutai HW_CONFIG_BASE \ 931cf48f49fSManish V Badarkhe LFA_SUPPORT \ 932f5cb144dSMadhukar Pappireddy SUPPORT_SP_LIVE_ACTIVATION \ 93355eb4f56SManish V Badarkhe TEST_IO_SHORT_READ_FI \ 93455eb4f56SManish V Badarkhe TEST_IO_SHORT_READ_FI_IMAGE_ID \ 935327131c4SLeonardo Sandoval))) 9362fae4b1eSJeenu Viswambharan 937bfef8b90SJuan Pablo Condeifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) 938bfef8b90SJuan Pablo Condeifeq (${DEBUG}, 0) 939bfef8b90SJuan Pablo Conde $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only") 940bfef8b90SJuan Pablo Conde override PLATFORM_REPORT_CTX_MEM_USE := 0 941bfef8b90SJuan Pablo Condeendif 942bfef8b90SJuan Pablo Condeendif 943bfef8b90SJuan Pablo Conde 9441f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 9451f461979SJustin Chadwell $(eval $(call add_define,MONITOR_TRAPS)) 946c5e1da83SJayanth Dodderi Chidanandendif #(SANITIZE_UB) 9471f461979SJustin Chadwell 9484c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 9494c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 9504c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 951cf2c8a33SAntonio Nino Diazelse 95268450a6dSAntonio Nino Diaz# Define the PRELOADED_BL33_BASE flag only if it is provided and 95368450a6dSAntonio Nino Diaz# EL3_PAYLOAD_BASE is not defined, as it has priority. 95468450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 95568450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 9564c117f6cSSandrine Bailleux endif 957c5e1da83SJayanth Dodderi Chidanandendif #(EL3_PAYLOAD_BASE) 95873c99d4eSJuan Castillo 959209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set. 960209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1) 961209a60ccSSoby Mathew $(eval $(call add_define,DYN_DISABLE_AUTH)) 962209a60ccSSoby Mathewendif 963209a60ccSSoby Mathew 9648620bd0bSChris Kayifeq ($($(ARCH)-ld-id),arm-link) 965c2ad38ceSVarun Wadekar $(eval $(call add_define,USE_ARM_LINK)) 966c2ad38ceSVarun Wadekarendif 967c2ad38ceSVarun Wadekar 968ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 969ce2b1ec6SManish Pandeyifeq (${SPD},spmd) 970c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE 971ce2b1ec6SManish Pandey -include $(BUILD_PLAT)/sp_gen.mk 972ce2b1ec6SManish Pandey FIP_DEPS += sp 97307c44475SManish Pandey CRT_DEPS += sp 974ce2b1ec6SManish Pandey NEED_SP_PKG := yes 975ce2b1ec6SManish Pandeyelse 976c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},1) 977c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 978c33ff198SOlivier Deprez endif 979c5e1da83SJayanth Dodderi Chidanandendif #(SP_LAYOUT_FILE) 980c5e1da83SJayanth Dodderi Chidanandendif #(SPD) 981ce2b1ec6SManish Pandey 98273c99d4eSJuan Castillo################################################################################ 9833df79ae7SBoyan Karatotev# Configure the flags for the specified compiler and linker 9843df79ae7SBoyan Karatotev################################################################################ 9853df79ae7SBoyan Karatotevinclude ${MAKE_HELPERS_DIRECTORY}cflags.mk 9863df79ae7SBoyan Karatotev 9873df79ae7SBoyan Karatotev################################################################################ 98873c99d4eSJuan Castillo# Build targets 98973c99d4eSJuan Castillo################################################################################ 99073c99d4eSJuan Castillo 9912329e22bSHarrison Mutai.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp tl fwu_fip certtool dtbs memmap doc enctool 99273c99d4eSJuan Castillo 99373c99d4eSJuan Castilloall: msg_start 99473c99d4eSJuan Castillo 99573c99d4eSJuan Castillomsg_start: 9967c4e1eeaSChris Kay $(s)echo "Building ${PLAT}" 99773c99d4eSJuan Castillo 99861f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c)) 9995fee0287SRoberto Vargas 100073c99d4eSJuan Castillo# Expand build macros for the different images 100173c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 1002b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES}) 1003434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1)) 1004c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL1) 100573c99d4eSJuan Castillo 100673c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 1007c5e1da83SJayanth Dodderi Chidanand 100842d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2}, 0) 1009c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw 1010c9b31ae8SRoberto Vargasendif 1011c9b31ae8SRoberto Vargas 1012eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES}) 1013eb1acfb6SChris Kay 1014d57362bdSXialin Liuifeq (${SEPARATE_BL2_FIP},1) 1015d57362bdSXialin Liu$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS},BL2_)), \ 1016d57362bdSXialin Liu $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS},BL2_))) 1017d57362bdSXialin Liuelse 101833950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})), \ 1019434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 1020d57362bdSXialin Liuendif #(SEPARATE_BL2_FIP) 1021c5e1da83SJayanth Dodderi Chidanand 1022c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL2) 102373c99d4eSJuan Castillo 10244d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes) 102533950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 1026c5e1da83SJayanth Dodderi Chidanandendif #(NEED_SCP_BL2) 10274d045d0eSMasahiro Yamada 102873c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 102973c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 103026d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates 103126d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES}) 1032c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1033c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1034434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1035c6ba9b45SSumit Gargelse 103633950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1037434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw))) 1038c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 1039c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL31) 104073c99d4eSJuan Castillo 104170d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1042c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the 104370d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 104473c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 104526d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates 104626d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES}) 10479cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 10489cd15239SMasahiro Yamada 1049c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1050434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1051c6ba9b45SSumit Garg $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1052c6ba9b45SSumit Gargelse 1053434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 105433950dd8SMasahiro Yamada $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 1055c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 1056c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL32) 105773c99d4eSJuan Castillo 10585b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 10595b18de09SZelalem Aweke# needs to be built from RMM_SOURCES. 10605b18de09SZelalem Awekeifeq (${NEED_RMM},yes) 10615b18de09SZelalem Aweke# Sort RMM source files to remove duplicates 10625b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES}) 10635b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 10645b18de09SZelalem Aweke 10655b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 10665b18de09SZelalem Aweke $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 1067c5e1da83SJayanth Dodderi Chidanandendif #(NEED_RMM) 10685b18de09SZelalem Aweke 106973c99d4eSJuan Castillo# Add the BL33 image if required by the platform 107073c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 107133950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1072c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL33) 1073db6071c9SJuan Castillo 10749003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 107533950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1076434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 1077c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL2U) 10789003fa0bSYatharth Kochar 107903b397a8SNishanth Menon# Expand build macros for the different images 108003b397a8SNishanth Menonifeq (${NEED_FDT},yes) 108103b397a8SNishanth Menon $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 10821c08ff32SSalman Nabi 10831c08ff32SSalman Nabi ifneq (${INITRD_SIZE}${INITRD_PATH},) 10841c08ff32SSalman Nabi ifndef INITRD_BASE 10851c08ff32SSalman Nabi $(error INITRD_BASE must be set when inserting initrd properties to the DTB.) 10861c08ff32SSalman Nabi endif 10871c08ff32SSalman Nabi 10881c08ff32SSalman Nabi INITRD_SIZE ?= $(shell printf "0x%x\n" $$(stat -Lc %s $(INITRD_PATH))) 10891c08ff32SSalman Nabi initrd_end = $(shell printf "0x%x\n" $$(expr $$(($(INITRD_BASE) + $(INITRD_SIZE))))) 10901c08ff32SSalman Nabi 10911c08ff32SSalman Nabi define $(HW_CONFIG)-after += 10921c08ff32SSalman Nabi $(s)echo " INITRD $(HW_CONFIG)" 10931c08ff32SSalman Nabi $(q)fdtput -t x $@ /chosen linux,initrd-start $(INITRD_BASE) 10941c08ff32SSalman Nabi $(q)fdtput -t x $@ /chosen linux,initrd-end $(initrd_end) 10951c08ff32SSalman Nabi endef 10961c08ff32SSalman Nabi endif 1097c5e1da83SJayanth Dodderi Chidanandendif #(NEED_FDT) 109803b397a8SNishanth Menon 1099ce2b1ec6SManish Pandey# Add Secure Partition packages 1100ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes) 1101fd74ca0dSChris Kay$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | $$(@D)/ 11028cefbe03SAndrei Homescu $(if $(host-poetry),$(q)$(host-poetry) -q install --no-root) 11038cefbe03SAndrei Homescu $(q)$(if $(host-poetry),$(host-poetry) run )${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} 1104822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 11057c4e1eeaSChris Kay $(s)echo 11067c4e1eeaSChris Kay $(s)echo "Built SP Images successfully" 11077c4e1eeaSChris Kay $(s)echo 1108c5e1da83SJayanth Dodderi Chidanandendif #(NEED_SP_PKG) 1109ce2b1ec6SManish Pandey 111036eaaf37SIan Spraylocate-checkpatch: 111136eaaf37SIan Sprayifndef CHECKPATCH 111266079b04SEtienne Carriere $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 111336eaaf37SIan Sprayelse 111436eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 111566079b04SEtienne Carriere $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 111636eaaf37SIan Sprayendif 1117c5e1da83SJayanth Dodderi Chidanandendif #(CHECKPATCH) 111836eaaf37SIan Spray 11194f6ad66aSAchin Guptaclean: 11207c4e1eeaSChris Kay $(s)echo " CLEAN" 1121c3273703SChris Kay $(q)rm -rf $(BUILD_PLAT) 1122cbd6cec3SBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${FIPTOOLPATH} clean 1123cbd6cec3SBoyan Karatotev $(q)rm -rf ${FIPTOOLPATH}/fiptool 1124f4595e6eSBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1125f4595e6eSBoyan Karatotev $(q)rm -rf ${CRTTOOLPATH}/cert_create 112696fbe884SBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 11277c4e1eeaSChris Kay $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 11284f6ad66aSAchin Gupta 1129eaaeece2SJames Morrisseyrealclean distclean: 11307c4e1eeaSChris Kay $(s)echo " REALCLEAN" 1131c3273703SChris Kay $(q)rm -rf $(BUILD_BASE) 1132c3273703SChris Kay $(q)rm -rf $(CURDIR)/cscope.* 1133cbd6cec3SBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${FIPTOOLPATH} clean 1134cbd6cec3SBoyan Karatotev $(q)rm -rf ${FIPTOOLPATH}/fiptool 1135f4595e6eSBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1136f4595e6eSBoyan Karatotev $(q)rm -rf ${CRTTOOLPATH}/cert_create 113796fbe884SBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 11387c4e1eeaSChris Kay $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 11394f6ad66aSAchin Gupta 114036eaaf37SIan Spraycheckcodebase: locate-checkpatch 11417c4e1eeaSChris Kay $(s)echo " CHECKING STYLE" 11427c4e1eeaSChris Kay $(q)if test -d .git ; then \ 11431ef35512SPaul Beesley git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 11441a41e8c1SDan Handley while read GIT_FILE ; \ 11451a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 11461a41e8c1SDan Handley done ; \ 114736eaaf37SIan Spray else \ 11481a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 11491a41e8c1SDan Handley -not -iwholename "*build*" \ 11501a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 115161f72a34SRoberto Vargas -not -iwholename "*libc*" \ 11521a41e8c1SDan Handley -not -iwholename "*docs*" \ 11531ef35512SPaul Beesley -not -iwholename "*.rst" \ 11541a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 115536eaaf37SIan Spray fi 115636eaaf37SIan Spray 115736eaaf37SIan Spraycheckpatch: locate-checkpatch 11587c4e1eeaSChris Kay $(s)echo " CHECKING STYLE" 11597c4e1eeaSChris Kay $(q)if test -n "${CHECKPATCH_OPTS}"; then \ 116002a76d5fSYann Gautier echo " with ${CHECKPATCH_OPTS} option(s)"; \ 116102a76d5fSYann Gautier fi 11627c4e1eeaSChris Kay $(q)COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 116377a0a7f1SYann Gautier for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 116477a0a7f1SYann Gautier do \ 116551d28937SAntonio Nino Diaz printf "\n[*] Checking style of '$$commit'\n\n"; \ 11661a721748SYann Gautier ( git log --format=email "$$commit~..$$commit" \ 11671a721748SYann Gautier -- ${CHECK_PATHS} ; \ 116851d28937SAntonio Nino Diaz git diff --format=email "$$commit~..$$commit" \ 11691a721748SYann Gautier -- ${CHECK_PATHS}; ) | \ 117002a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 117151d28937SAntonio Nino Diaz done 117236eaaf37SIan Spray 117373c99d4eSJuan Castillocerttool: ${CRTTOOL} 117473c99d4eSJuan Castillo 1175774fb379SBoyan Karatotev${CRTTOOL}: FORCE | $$(@D)/ 1176f4595e6eSBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${CRTTOOLPATH} all 1177f4595e6eSBoyan Karatotev $(q)ln -sf ${CRTTOOL} ${CRTTOOLPATH}/cert_create 11787c4e1eeaSChris Kay $(s)echo 11797c4e1eeaSChris Kay $(s)echo "Built $@ successfully" 11807c4e1eeaSChris Kay $(s)echo 11816f971622SJuan Castillo 11826f971622SJuan Castilloifneq (${GENERATE_COT},0) 1183f02135a3SFabien Lehousselcertificates: ${CRT_DEPS} ${CRTTOOL} ${DTBS} 11847c4e1eeaSChris Kay $(q)${CRTTOOL} ${CRT_ARGS} 11857c4e1eeaSChris Kay $(s)echo 11867c4e1eeaSChris Kay $(s)echo "Built $@ successfully" 11877c4e1eeaSChris Kay $(s)echo "Certificates can be found in ${BUILD_PLAT}" 11887c4e1eeaSChris Kay $(s)echo 1189c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT) 119027713fb4SSoby Mathew 1191d57362bdSXialin Liuifeq (${SEPARATE_BL2_FIP},1) 1192774fb379SBoyan Karatotev${BUILD_PLAT}/${BL2_FIP_NAME}: ${BL2_FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1193d57362bdSXialin Liu $(eval ${CHECK_BL2_FIP_CMD}) 1194d57362bdSXialin Liu $(q)${FIPTOOL} create ${BL2_FIP_ARGS} $@ 1195d57362bdSXialin Liu $(q)${FIPTOOL} info $@ 1196d57362bdSXialin Liu $(s)echo 1197d57362bdSXialin Liu $(s)echo "Built $@ successfully" 1198d57362bdSXialin Liu $(s)echo 1199d57362bdSXialin Liuendif #(SEPARATE_BL2_FIP) 1200d57362bdSXialin Liu 1201774fb379SBoyan Karatotev${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} | $$(@D)/ 12024727fd13SPali Rohár $(eval ${CHECK_FIP_CMD}) 12037c4e1eeaSChris Kay $(q)${FIPTOOL} create ${FIP_ARGS} $@ 12047c4e1eeaSChris Kay $(q)${FIPTOOL} info $@ 12057c4e1eeaSChris Kay $(s)echo 12067c4e1eeaSChris Kay $(s)echo "Built $@ successfully" 12077c4e1eeaSChris Kay $(s)echo 1208f58ad36fSHarry Liebel 12090191262dSYatharth Kocharifneq (${GENERATE_COT},0) 12100191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 12117c4e1eeaSChris Kay $(q)${CRTTOOL} ${FWU_CRT_ARGS} 12127c4e1eeaSChris Kay $(s)echo 12137c4e1eeaSChris Kay $(s)echo "Built $@ successfully" 12147c4e1eeaSChris Kay $(s)echo "FWU certificates can be found in ${BUILD_PLAT}" 12157c4e1eeaSChris Kay $(s)echo 1216c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT) 12170191262dSYatharth Kochar 1218d57362bdSXialin Liuifneq (${GENERATE_COT},0) 1219774fb379SBoyan Karatotevbl2_certificates: ${BUILD_PLAT}/${FIP_NAME} ${BL2_CRT_DEPS} ${CRTTOOL} | ${BUILD_PLAT}/ 1220d57362bdSXialin Liu $(q)${CRTTOOL} ${BL2_CRT_ARGS} 1221d57362bdSXialin Liu $(s)echo 1222d57362bdSXialin Liu $(s)echo "Built $@ successfully" 1223d57362bdSXialin Liu $(s)echo "BL2 certificates can be found in ${BUILD_PLAT}" 1224d57362bdSXialin Liu $(s)echo 1225d57362bdSXialin Liuendif #(GENERATE_COT) 1226d57362bdSXialin Liu 1227774fb379SBoyan Karatotev${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} | $$(@D)/ 12284727fd13SPali Rohár $(eval ${CHECK_FWU_FIP_CMD}) 12297c4e1eeaSChris Kay $(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@ 12307c4e1eeaSChris Kay $(q)${FIPTOOL} info $@ 12317c4e1eeaSChris Kay $(s)echo 12327c4e1eeaSChris Kay $(s)echo "Built $@ successfully" 12337c4e1eeaSChris Kay $(s)echo 12340191262dSYatharth Kochar 123573c99d4eSJuan Castillofiptool: ${FIPTOOL} 1236d57362bdSXialin Liuifeq (${SEPARATE_BL2_FIP},1) 1237d57362bdSXialin Liubl2_fip: ${BUILD_PLAT}/${BL2_FIP_NAME} 1238d57362bdSXialin Liufip: bl2_fip 1239d57362bdSXialin Liuelse 124073c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 1241d57362bdSXialin Liuendif #(SEPARATE_BL2_FIP) 12420191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 124373c99d4eSJuan Castillo 1244cbd6cec3SBoyan Karatotev# symlink for compatibility before tools were in the build directory 1245774fb379SBoyan Karatotev${FIPTOOL}: FORCE | $$(@D)/ 1246cbd6cec3SBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${FIPTOOLPATH} all 1247cbd6cec3SBoyan Karatotev $(q)ln -sf ${FIPTOOL} ${FIPTOOLPATH}/fiptool 1248f58ad36fSHarry Liebel 1249774fb379SBoyan Karatotev$(BUILD_PLAT)/romlib/romlib.bin $(BUILD_PLAT)/lib/libwrappers.a $&: $(BUILD_PLAT)/lib/libfdt.a $(BUILD_PLAT)/lib/libc.a $(CRYPTO_LIB) | $$(@D)/ 12506e2fe623SLauren Wehrmeister $(q)${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} CRYPTO_LIB=$(CRYPTO_LIB) ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES=$(call escape-shell,$(INCLUDES)) DEFINES=$(call escape-shell,$(DEFINES)) --no-print-directory -C ${ROMLIBPATH} all 12515accce5bSRoberto Vargas 1252cfe83910SLouis Mayencourtmemmap: all 12538cefbe03SAndrei Homescu $(if $(host-poetry),$(q)$(host-poetry) -q install --no-root) 12548cefbe03SAndrei Homescu $(q)$(if $(host-poetry),$(host-poetry) run )memory --root ${BUILD_PLAT} symbols 1255cfe83910SLouis Mayencourt 12562329e22bSHarrison Mutaitl: ${BUILD_PLAT}/tl.bin 1257774fb379SBoyan Karatotev${BUILD_PLAT}/tl.bin: ${HW_CONFIG} | $$(@D)/ 12588cefbe03SAndrei Homescu $(if $(host-poetry),$(q)$(host-poetry) -q install --no-root) 12598cefbe03SAndrei Homescu $(q)$(if $(host-poetry),$(host-poetry) run )tlc create --fdt $< -s ${FW_HANDOFF_SIZE} $@ 12602329e22bSHarrison Mutai 12616de32378SMadhukar Pappireddydoc: 12627c4e1eeaSChris Kay $(s)echo " BUILD DOCUMENTATION" 12638cefbe03SAndrei Homescu $(if $(host-poetry),$(q)$(host-poetry) -q install --with docs --no-root) 12648cefbe03SAndrei Homescu $(q)$(if $(host-poetry),$(host-poetry) run )${MAKE} --no-print-directory -C ${DOCS_PATH} BUILDDIR=$(abspath ${BUILD_BASE}/docs) html 12656de32378SMadhukar Pappireddy 126690aa901fSSumit Gargenctool: ${ENCTOOL} 126790aa901fSSumit Garg 1268774fb379SBoyan Karatotev${ENCTOOL}: FORCE | $$(@D)/ 126996fbe884SBoyan Karatotev $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${ENCTOOLPATH} all 12707c4e1eeaSChris Kay $(s)echo 12717c4e1eeaSChris Kay $(s)echo "Built $@ successfully" 12727c4e1eeaSChris Kay $(s)echo 127390aa901fSSumit Garg 127435fab8c9SJoakim Bechcscope: 12757c4e1eeaSChris Kay $(s)echo " CSCOPE" 12767c4e1eeaSChris Kay $(q)find ${CURDIR} -name "*.[chsS]" > cscope.files 12777c4e1eeaSChris Kay $(q)cscope -b -q -k 127835fab8c9SJoakim Bech 127972ee3314SRyan Harkinhelp: 12807c4e1eeaSChris Kay $(s)echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 12817c4e1eeaSChris Kay $(s)echo "" 12827c4e1eeaSChris Kay $(s)echo "PLAT is used to specify which platform you wish to build." 12837c4e1eeaSChris Kay $(s)echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 12847c4e1eeaSChris Kay $(s)echo "" 12857c4e1eeaSChris Kay $(s)echo "platform = ${PLATFORM_LIST}" 12867c4e1eeaSChris Kay $(s)echo "" 12877c4e1eeaSChris Kay $(s)echo "Please refer to the User Guide for a list of all supported options." 12887c4e1eeaSChris Kay $(s)echo "Note that the build system doesn't track dependencies for build " 12897c4e1eeaSChris Kay $(s)echo "options. Therefore, if any of the build options are changed " 12907c4e1eeaSChris Kay $(s)echo "from a previous build, a clean build must be performed." 12917c4e1eeaSChris Kay $(s)echo "" 12927c4e1eeaSChris Kay $(s)echo "Supported Targets:" 12937c4e1eeaSChris Kay $(s)echo " all Build all individual bootloader binaries" 12947c4e1eeaSChris Kay $(s)echo " bl1 Build the BL1 binary" 12957c4e1eeaSChris Kay $(s)echo " bl2 Build the BL2 binary" 12967c4e1eeaSChris Kay $(s)echo " bl2u Build the BL2U binary" 12977c4e1eeaSChris Kay $(s)echo " bl31 Build the BL31 binary" 12987c4e1eeaSChris Kay $(s)echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 12997c4e1eeaSChris Kay $(s)echo " this builds secure payload specified by AARCH32_SP" 13007c4e1eeaSChris Kay $(s)echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 13017c4e1eeaSChris Kay $(s)echo " fip Build the Firmware Image Package (FIP)" 13027c4e1eeaSChris Kay $(s)echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 13037c4e1eeaSChris Kay $(s)echo " checkcodebase Check the coding style of the entire source tree" 13047c4e1eeaSChris Kay $(s)echo " checkpatch Check the coding style on changes in the current" 13057c4e1eeaSChris Kay $(s)echo " branch against BASE_COMMIT (default origin/master)" 13067c4e1eeaSChris Kay $(s)echo " clean Clean the build for the selected platform" 13077c4e1eeaSChris Kay $(s)echo " cscope Generate cscope index" 13087c4e1eeaSChris Kay $(s)echo " distclean Remove all build artifacts for all platforms" 13097c4e1eeaSChris Kay $(s)echo " certtool Build the Certificate generation tool" 13107c4e1eeaSChris Kay $(s)echo " enctool Build the Firmware encryption tool" 13117c4e1eeaSChris Kay $(s)echo " fiptool Build the Firmware Image Package (FIP) creation tool" 13127c4e1eeaSChris Kay $(s)echo " sp Build the Secure Partition Packages" 13137c4e1eeaSChris Kay $(s)echo " sptool Build the Secure Partition Package creation tool" 13147c4e1eeaSChris Kay $(s)echo " dtbs Build the Device Tree Blobs (if required for the platform)" 13157c4e1eeaSChris Kay $(s)echo " memmap Print the memory map of the built binaries" 13167c4e1eeaSChris Kay $(s)echo " doc Build html based documentation using Sphinx tool" 13177c4e1eeaSChris Kay $(s)echo "" 13187c4e1eeaSChris Kay $(s)echo "Note: most build targets require PLAT to be set to a specific platform." 13197c4e1eeaSChris Kay $(s)echo "" 13207c4e1eeaSChris Kay $(s)echo "example: build all targets for the FVP platform:" 13217c4e1eeaSChris Kay $(s)echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1322a9812206SPali Rohár 1323a9812206SPali Rohár.PHONY: FORCE 1324a9812206SPali RohárFORCE:; 1325