1*91f16700Schasinglulu# 2*91f16700Schasinglulu# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. 3*91f16700Schasinglulu# 4*91f16700Schasinglulu# SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu# 6*91f16700Schasinglulu 7*91f16700Schasinglulu# 8*91f16700Schasinglulu# Trusted Firmware Version 9*91f16700Schasinglulu# 10*91f16700SchasingluluVERSION_MAJOR := 2 11*91f16700SchasingluluVERSION_MINOR := 10 12*91f16700SchasingluluVERSION_PATCH := 0 # Only used for LTS releases 13*91f16700SchasingluluVERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} 14*91f16700Schasinglulu 15*91f16700Schasinglulu# Default goal is build all images 16*91f16700Schasinglulu.DEFAULT_GOAL := all 17*91f16700Schasinglulu 18*91f16700Schasinglulu# Avoid any implicit propagation of command line variable definitions to 19*91f16700Schasinglulu# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 20*91f16700Schasinglulu# usage. Other command line options like "-s" are still propagated as usual. 21*91f16700SchasingluluMAKEOVERRIDES = 22*91f16700Schasinglulu 23*91f16700SchasingluluMAKE_HELPERS_DIRECTORY := make_helpers/ 24*91f16700Schasingluluinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 25*91f16700Schasingluluinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk 26*91f16700Schasinglulu 27*91f16700Schasinglulu################################################################################ 28*91f16700Schasinglulu# Default values for build configurations, and their dependencies 29*91f16700Schasinglulu################################################################################ 30*91f16700Schasinglulu 31*91f16700Schasingluluinclude ${MAKE_HELPERS_DIRECTORY}defaults.mk 32*91f16700Schasinglulu 33*91f16700Schasinglulu# Assertions enabled for DEBUG builds by default 34*91f16700SchasingluluENABLE_ASSERTIONS := ${DEBUG} 35*91f16700SchasingluluENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 36*91f16700SchasingluluPLAT := ${DEFAULT_PLAT} 37*91f16700Schasinglulu 38*91f16700Schasinglulu################################################################################ 39*91f16700Schasinglulu# Checkpatch script options 40*91f16700Schasinglulu################################################################################ 41*91f16700Schasinglulu 42*91f16700SchasingluluCHECKCODE_ARGS := --no-patch 43*91f16700Schasinglulu# Do not check the coding style on imported library files or documentation files 44*91f16700SchasingluluINC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 45*91f16700Schasinglulu include/drivers/arm, \ 46*91f16700Schasinglulu $(wildcard include/drivers/*))) 47*91f16700SchasingluluINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 48*91f16700Schasinglulu include/lib/libfdt \ 49*91f16700Schasinglulu include/lib/libc, \ 50*91f16700Schasinglulu $(wildcard include/lib/*))) 51*91f16700SchasingluluINC_DIRS_TO_CHECK := $(sort $(filter-out \ 52*91f16700Schasinglulu include/lib \ 53*91f16700Schasinglulu include/drivers, \ 54*91f16700Schasinglulu $(wildcard include/*))) 55*91f16700SchasingluluLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 56*91f16700Schasinglulu lib/compiler-rt \ 57*91f16700Schasinglulu lib/libfdt% \ 58*91f16700Schasinglulu lib/libc, \ 59*91f16700Schasinglulu lib/zlib \ 60*91f16700Schasinglulu $(wildcard lib/*))) 61*91f16700SchasingluluROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 62*91f16700Schasinglulu lib \ 63*91f16700Schasinglulu include \ 64*91f16700Schasinglulu docs \ 65*91f16700Schasinglulu %.rst, \ 66*91f16700Schasinglulu $(wildcard *))) 67*91f16700SchasingluluCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 68*91f16700Schasinglulu ${INC_DIRS_TO_CHECK} \ 69*91f16700Schasinglulu ${INC_LIB_DIRS_TO_CHECK} \ 70*91f16700Schasinglulu ${LIB_DIRS_TO_CHECK} \ 71*91f16700Schasinglulu ${INC_DRV_DIRS_TO_CHECK} \ 72*91f16700Schasinglulu ${INC_ARM_DIRS_TO_CHECK} 73*91f16700Schasinglulu 74*91f16700Schasinglulu################################################################################ 75*91f16700Schasinglulu# Process build options 76*91f16700Schasinglulu################################################################################ 77*91f16700Schasinglulu 78*91f16700Schasinglulu# Verbose flag 79*91f16700Schasingluluifeq (${V},0) 80*91f16700Schasinglulu Q:=@ 81*91f16700Schasinglulu ECHO:=@echo 82*91f16700Schasinglulu CHECKCODE_ARGS += --no-summary --terse 83*91f16700Schasingluluelse 84*91f16700Schasinglulu Q:= 85*91f16700Schasinglulu ECHO:=$(ECHO_QUIET) 86*91f16700Schasingluluendif 87*91f16700Schasinglulu 88*91f16700Schasingluluifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) 89*91f16700Schasinglulu Q:=@ 90*91f16700Schasinglulu ECHO:=$(ECHO_QUIET) 91*91f16700Schasingluluendif 92*91f16700Schasinglulu 93*91f16700Schasingluluexport Q ECHO 94*91f16700Schasinglulu 95*91f16700Schasinglulu################################################################################ 96*91f16700Schasinglulu# Toolchain 97*91f16700Schasinglulu################################################################################ 98*91f16700Schasinglulu 99*91f16700SchasingluluHOSTCC := gcc 100*91f16700Schasingluluexport HOSTCC 101*91f16700Schasinglulu 102*91f16700SchasingluluCC := ${CROSS_COMPILE}gcc 103*91f16700SchasingluluCPP := ${CROSS_COMPILE}cpp 104*91f16700SchasingluluAS := ${CROSS_COMPILE}gcc 105*91f16700SchasingluluAR := ${CROSS_COMPILE}ar 106*91f16700SchasingluluLINKER := ${CROSS_COMPILE}ld 107*91f16700SchasingluluOC := ${CROSS_COMPILE}objcopy 108*91f16700SchasingluluOD := ${CROSS_COMPILE}objdump 109*91f16700SchasingluluNM := ${CROSS_COMPILE}nm 110*91f16700SchasingluluPP := ${CROSS_COMPILE}gcc -E 111*91f16700SchasingluluDTC := dtc 112*91f16700Schasinglulu 113*91f16700Schasinglulu# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). 114*91f16700Schasingluluifneq ($(strip $(wildcard ${LD}.bfd) \ 115*91f16700Schasinglulu $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),) 116*91f16700SchasingluluLINKER := ${LINKER}.bfd 117*91f16700Schasingluluendif 118*91f16700Schasinglulu 119*91f16700Schasinglulu################################################################################ 120*91f16700Schasinglulu# Auxiliary tools (fiptool, cert_create, etc) 121*91f16700Schasinglulu################################################################################ 122*91f16700Schasinglulu 123*91f16700Schasinglulu# Variables for use with Certificate Generation Tool 124*91f16700SchasingluluCRTTOOLPATH ?= tools/cert_create 125*91f16700SchasingluluCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 126*91f16700Schasinglulu 127*91f16700Schasinglulu# Variables for use with Firmware Encryption Tool 128*91f16700SchasingluluENCTOOLPATH ?= tools/encrypt_fw 129*91f16700SchasingluluENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} 130*91f16700Schasinglulu 131*91f16700Schasinglulu# Variables for use with Firmware Image Package 132*91f16700SchasingluluFIPTOOLPATH ?= tools/fiptool 133*91f16700SchasingluluFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 134*91f16700Schasinglulu 135*91f16700Schasinglulu# Variables for use with sptool 136*91f16700SchasingluluSPTOOLPATH ?= tools/sptool 137*91f16700SchasingluluSPTOOL ?= ${SPTOOLPATH}/sptool.py 138*91f16700SchasingluluSP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 139*91f16700SchasingluluSP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts 140*91f16700Schasinglulu 141*91f16700Schasinglulu# Variables for use with ROMLIB 142*91f16700SchasingluluROMLIBPATH ?= lib/romlib 143*91f16700Schasinglulu 144*91f16700Schasinglulu# Variable for use with Python 145*91f16700SchasingluluPYTHON ?= python3 146*91f16700Schasinglulu 147*91f16700Schasinglulu# Variables for use with documentation build using Sphinx tool 148*91f16700SchasingluluDOCS_PATH ?= docs 149*91f16700Schasinglulu 150*91f16700Schasinglulu################################################################################ 151*91f16700Schasinglulu# Compiler Configuration based on ARCH_MAJOR and ARCH_MINOR flags 152*91f16700Schasinglulu################################################################################ 153*91f16700Schasingluluifeq (${ARM_ARCH_MAJOR},7) 154*91f16700Schasinglulu target32-directive = -target arm-none-eabi 155*91f16700Schasinglulu# Will set march-directive from platform configuration 156*91f16700Schasingluluelse 157*91f16700Schasinglulu target32-directive = -target armv8a-none-eabi 158*91f16700Schasingluluendif #(ARM_ARCH_MAJOR) 159*91f16700Schasinglulu 160*91f16700Schasinglulu################################################################################ 161*91f16700Schasinglulu# Get Architecture Feature Modifiers 162*91f16700Schasinglulu################################################################################ 163*91f16700Schasingluluarch-features = ${ARM_ARCH_FEATURE} 164*91f16700Schasinglulu 165*91f16700Schasinglulu# Set the compiler's architecture feature modifiers 166*91f16700Schasingluluifneq ($(arch-features), none) 167*91f16700Schasinglulu # Strip "none+" from arch-features 168*91f16700Schasinglulu arch-features := $(subst none+,,$(arch-features)) 169*91f16700Schasinglulu march-directive := $(march-directive)+$(arch-features) 170*91f16700Schasinglulu# Print features 171*91f16700Schasinglulu $(info Arm Architecture Features specified: $(subst +, ,$(arch-features))) 172*91f16700Schasingluluendif #(arch-features) 173*91f16700Schasinglulu 174*91f16700Schasingluluifneq ($(findstring clang,$(notdir $(CC))),) 175*91f16700Schasinglulu ifneq ($(findstring armclang,$(notdir $(CC))),) 176*91f16700Schasinglulu TF_CFLAGS_aarch32 := -target arm-arm-none-eabi 177*91f16700Schasinglulu TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi 178*91f16700Schasinglulu LD := $(LINKER) 179*91f16700Schasinglulu else 180*91f16700Schasinglulu TF_CFLAGS_aarch32 = $(target32-directive) 181*91f16700Schasinglulu TF_CFLAGS_aarch64 := -target aarch64-elf 182*91f16700Schasinglulu LD := $(shell $(CC) --print-prog-name ld.lld) 183*91f16700Schasinglulu 184*91f16700Schasinglulu AR := $(shell $(CC) --print-prog-name llvm-ar) 185*91f16700Schasinglulu OD := $(shell $(CC) --print-prog-name llvm-objdump) 186*91f16700Schasinglulu OC := $(shell $(CC) --print-prog-name llvm-objcopy) 187*91f16700Schasinglulu endif 188*91f16700Schasinglulu 189*91f16700Schasinglulu CPP := $(CC) -E $(TF_CFLAGS_$(ARCH)) 190*91f16700Schasinglulu PP := $(CC) -E $(TF_CFLAGS_$(ARCH)) 191*91f16700Schasinglulu AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) 192*91f16700Schasingluluelse ifneq ($(findstring gcc,$(notdir $(CC))),) 193*91f16700Schasinglulu ifeq ($(ENABLE_LTO),1) 194*91f16700Schasinglulu # Enable LTO only for aarch64 195*91f16700Schasinglulu ifeq (${ARCH},aarch64) 196*91f16700Schasinglulu LTO_CFLAGS = -flto 197*91f16700Schasinglulu # Use gcc as a wrapper for the ld, recommended for LTO 198*91f16700Schasinglulu LINKER := ${CROSS_COMPILE}gcc 199*91f16700Schasinglulu endif 200*91f16700Schasinglulu endif 201*91f16700Schasinglulu LD = $(LINKER) 202*91f16700Schasingluluelse 203*91f16700Schasinglulu LD = $(LINKER) 204*91f16700Schasingluluendif #(clang) 205*91f16700Schasinglulu 206*91f16700Schasinglulu# Process Debug flag 207*91f16700Schasinglulu$(eval $(call add_define,DEBUG)) 208*91f16700Schasingluluifneq (${DEBUG}, 0) 209*91f16700Schasinglulu BUILD_TYPE := debug 210*91f16700Schasinglulu TF_CFLAGS += -g -gdwarf-4 211*91f16700Schasinglulu ASFLAGS += -g -Wa,-gdwarf-4 212*91f16700Schasinglulu 213*91f16700Schasinglulu # Use LOG_LEVEL_INFO by default for debug builds 214*91f16700Schasinglulu LOG_LEVEL := 40 215*91f16700Schasingluluelse 216*91f16700Schasinglulu BUILD_TYPE := release 217*91f16700Schasinglulu # Use LOG_LEVEL_NOTICE by default for release builds 218*91f16700Schasinglulu LOG_LEVEL := 20 219*91f16700Schasingluluendif #(Debug) 220*91f16700Schasinglulu 221*91f16700Schasinglulu# Default build string (git branch and commit) 222*91f16700Schasingluluifeq (${BUILD_STRING},) 223*91f16700Schasinglulu BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 224*91f16700Schasingluluendif 225*91f16700SchasingluluVERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} 226*91f16700Schasinglulu 227*91f16700Schasingluluifeq (${AARCH32_INSTRUCTION_SET},A32) 228*91f16700Schasinglulu TF_CFLAGS_aarch32 += -marm 229*91f16700Schasingluluelse ifeq (${AARCH32_INSTRUCTION_SET},T32) 230*91f16700Schasinglulu TF_CFLAGS_aarch32 += -mthumb 231*91f16700Schasingluluelse 232*91f16700Schasinglulu $(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET}) 233*91f16700Schasingluluendif #(AARCH32_INSTRUCTION_SET) 234*91f16700Schasinglulu 235*91f16700SchasingluluTF_CFLAGS_aarch32 += -mno-unaligned-access 236*91f16700SchasingluluTF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align 237*91f16700Schasinglulu 238*91f16700SchasingluluASFLAGS += $(march-directive) 239*91f16700Schasinglulu 240*91f16700Schasinglulu############################################################################## 241*91f16700Schasinglulu# WARNINGS Configuration 242*91f16700Schasinglulu############################################################################### 243*91f16700Schasinglulu# General warnings 244*91f16700SchasingluluWARNINGS := -Wall -Wmissing-include-dirs -Wunused \ 245*91f16700Schasinglulu -Wdisabled-optimization -Wvla -Wshadow \ 246*91f16700Schasinglulu -Wredundant-decls 247*91f16700Schasinglulu# stricter warnings 248*91f16700SchasingluluWARNINGS += -Wextra -Wno-trigraphs 249*91f16700Schasinglulu# too verbose for generic build 250*91f16700SchasingluluWARNINGS += -Wno-missing-field-initializers \ 251*91f16700Schasinglulu -Wno-type-limits -Wno-sign-compare \ 252*91f16700Schasinglulu# on clang this flag gets reset if -Wextra is set after it. No difference on gcc 253*91f16700SchasingluluWARNINGS += -Wno-unused-parameter 254*91f16700Schasinglulu 255*91f16700Schasinglulu# Additional warnings 256*91f16700Schasinglulu# Level 1 - infrequent warnings we should have none of 257*91f16700Schasinglulu# full -Wextra 258*91f16700SchasingluluWARNING1 += -Wsign-compare 259*91f16700SchasingluluWARNING1 += -Wtype-limits 260*91f16700SchasingluluWARNING1 += -Wmissing-field-initializers 261*91f16700Schasinglulu 262*91f16700Schasinglulu# Level 2 - problematic warnings that we want 263*91f16700Schasinglulu# zlib, compiler-rt, coreboot, and mbdedtls blow up with these 264*91f16700Schasinglulu# TODO: disable just for them and move into default build 265*91f16700SchasingluluWARNING2 += -Wold-style-definition 266*91f16700SchasingluluWARNING2 += -Wmissing-prototypes 267*91f16700SchasingluluWARNING2 += -Wmissing-format-attribute 268*91f16700Schasinglulu# TF-A aims to comply with this eventually. Effort too large at present 269*91f16700SchasingluluWARNING2 += -Wundef 270*91f16700Schasinglulu# currently very involved and many platforms set this off 271*91f16700SchasingluluWARNING2 += -Wunused-const-variable=2 272*91f16700Schasinglulu 273*91f16700Schasinglulu# Level 3 - very pedantic, frequently ignored 274*91f16700SchasingluluWARNING3 := -Wbad-function-cast 275*91f16700SchasingluluWARNING3 += -Waggregate-return 276*91f16700SchasingluluWARNING3 += -Wnested-externs 277*91f16700SchasingluluWARNING3 += -Wcast-align 278*91f16700SchasingluluWARNING3 += -Wcast-qual 279*91f16700SchasingluluWARNING3 += -Wconversion 280*91f16700SchasingluluWARNING3 += -Wpacked 281*91f16700SchasingluluWARNING3 += -Wpointer-arith 282*91f16700SchasingluluWARNING3 += -Wswitch-default 283*91f16700Schasinglulu 284*91f16700Schasinglulu# Setting W is quite verbose and most warnings will be pre-existing issues 285*91f16700Schasinglulu# outside of the contributor's control. Don't fail the build on them so warnings 286*91f16700Schasinglulu# can be seen and hopefully addressed 287*91f16700Schasingluluifdef W 288*91f16700Schasinglulu ifneq (${W},0) 289*91f16700Schasinglulu E ?= 0 290*91f16700Schasinglulu endif 291*91f16700Schasingluluendif 292*91f16700Schasinglulu 293*91f16700Schasingluluifeq (${W},1) 294*91f16700Schasinglulu WARNINGS += $(WARNING1) 295*91f16700Schasingluluelse ifeq (${W},2) 296*91f16700Schasinglulu WARNINGS += $(WARNING1) $(WARNING2) 297*91f16700Schasingluluelse ifeq (${W},3) 298*91f16700Schasinglulu WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) 299*91f16700Schasingluluendif #(W) 300*91f16700Schasinglulu 301*91f16700Schasinglulu# Compiler specific warnings 302*91f16700Schasingluluifeq ($(findstring clang,$(notdir $(CC))),) 303*91f16700Schasinglulu# not using clang 304*91f16700SchasingluluWARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ 305*91f16700Schasinglulu -Wpacked-bitfield-compat -Wshift-overflow=2 \ 306*91f16700Schasinglulu -Wlogical-op 307*91f16700Schasinglulu 308*91f16700Schasinglulu# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 309*91f16700SchasingluluTF_CFLAGS += $(call cc_option, --param=min-pagesize=0) 310*91f16700Schasinglulu 311*91f16700Schasingluluelse 312*91f16700Schasinglulu# using clang 313*91f16700SchasingluluWARNINGS += -Wshift-overflow -Wshift-sign-overflow \ 314*91f16700Schasinglulu -Wlogical-op-parentheses 315*91f16700Schasingluluendif #(Clang Warning) 316*91f16700Schasinglulu 317*91f16700Schasingluluifneq (${E},0) 318*91f16700Schasinglulu ERRORS := -Werror 319*91f16700Schasingluluendif #(E) 320*91f16700Schasinglulu 321*91f16700Schasinglulu################################################################################ 322*91f16700Schasinglulu# Compiler and Linker Directives 323*91f16700Schasinglulu################################################################################ 324*91f16700SchasingluluCPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ 325*91f16700Schasinglulu $(ERRORS) $(WARNINGS) 326*91f16700SchasingluluASFLAGS += $(CPPFLAGS) \ 327*91f16700Schasinglulu -ffreestanding -Wa,--fatal-warnings 328*91f16700SchasingluluTF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 329*91f16700Schasinglulu -ffunction-sections -fdata-sections \ 330*91f16700Schasinglulu -ffreestanding -fno-builtin -fno-common \ 331*91f16700Schasinglulu -Os -std=gnu99 332*91f16700Schasinglulu 333*91f16700Schasingluluifeq (${SANITIZE_UB},on) 334*91f16700Schasinglulu TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover 335*91f16700Schasingluluendif #(${SANITIZE_UB},on) 336*91f16700Schasinglulu 337*91f16700Schasingluluifeq (${SANITIZE_UB},trap) 338*91f16700Schasinglulu TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ 339*91f16700Schasinglulu -fsanitize-undefined-trap-on-error 340*91f16700Schasingluluendif #(${SANITIZE_UB},trap) 341*91f16700Schasinglulu 342*91f16700SchasingluluGCC_V_OUTPUT := $(shell $(CC) -v 2>&1) 343*91f16700Schasinglulu 344*91f16700SchasingluluTF_LDFLAGS += -z noexecstack 345*91f16700Schasinglulu 346*91f16700Schasinglulu# LD = armlink 347*91f16700Schasingluluifneq ($(findstring armlink,$(notdir $(LD))),) 348*91f16700Schasinglulu TF_LDFLAGS += --diag_error=warning --lto_level=O1 349*91f16700Schasinglulu TF_LDFLAGS += --remove --info=unused,unusedsymbols 350*91f16700Schasinglulu TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 351*91f16700Schasinglulu 352*91f16700Schasinglulu# LD = gcc (used when GCC LTO is enabled) 353*91f16700Schasingluluelse ifneq ($(findstring gcc,$(notdir $(LD))),) 354*91f16700Schasinglulu # Pass ld options with Wl or Xlinker switches 355*91f16700Schasinglulu TF_LDFLAGS += -Wl,--fatal-warnings -O1 356*91f16700Schasinglulu TF_LDFLAGS += -Wl,--gc-sections 357*91f16700Schasinglulu 358*91f16700Schasinglulu TF_LDFLAGS += -Wl,-z,common-page-size=4096 #Configure page size constants 359*91f16700Schasinglulu TF_LDFLAGS += -Wl,-z,max-page-size=4096 360*91f16700Schasinglulu 361*91f16700Schasinglulu ifeq ($(ENABLE_LTO),1) 362*91f16700Schasinglulu ifeq (${ARCH},aarch64) 363*91f16700Schasinglulu TF_LDFLAGS += -flto -fuse-linker-plugin 364*91f16700Schasinglulu endif 365*91f16700Schasinglulu endif #(ENABLE_LTO) 366*91f16700Schasinglulu 367*91f16700Schasinglulu# GCC automatically adds fix-cortex-a53-843419 flag when used to link 368*91f16700Schasinglulu# which breaks some builds, so disable if errata fix is not explicitly enabled 369*91f16700Schasinglulu ifeq (${ARCH},aarch64) 370*91f16700Schasinglulu ifneq (${ERRATA_A53_843419},1) 371*91f16700Schasinglulu TF_LDFLAGS += -mno-fix-cortex-a53-843419 372*91f16700Schasinglulu endif 373*91f16700Schasinglulu endif 374*91f16700Schasinglulu TF_LDFLAGS += -nostdlib 375*91f16700Schasinglulu TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) 376*91f16700Schasinglulu 377*91f16700Schasinglulu# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other 378*91f16700Schasingluluelse 379*91f16700Schasinglulu# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we 380*91f16700Schasinglulu# are not loaded by a elf loader. 381*91f16700Schasinglulu TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) 382*91f16700Schasinglulu TF_LDFLAGS += -O1 383*91f16700Schasinglulu TF_LDFLAGS += --gc-sections 384*91f16700Schasinglulu 385*91f16700Schasinglulu TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants 386*91f16700Schasinglulu TF_LDFLAGS += -z max-page-size=4096 387*91f16700Schasinglulu 388*91f16700Schasinglulu# ld.lld doesn't recognize the errata flags, 389*91f16700Schasinglulu# therefore don't add those in that case. 390*91f16700Schasinglulu# ld.lld reports section type mismatch warnings, 391*91f16700Schasinglulu# therefore don't add --fatal-warnings to it. 392*91f16700Schasinglulu ifeq ($(findstring ld.lld,$(notdir $(LD))),) 393*91f16700Schasinglulu TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings 394*91f16700Schasinglulu endif 395*91f16700Schasinglulu 396*91f16700Schasingluluendif #(LD = armlink) 397*91f16700Schasinglulu 398*91f16700Schasinglulu################################################################################ 399*91f16700Schasinglulu# Setup ARCH_MAJOR/MINOR before parsing arch_features. 400*91f16700Schasinglulu################################################################################ 401*91f16700Schasingluluifeq (${ENABLE_RME},1) 402*91f16700Schasinglulu ARM_ARCH_MAJOR := 8 403*91f16700Schasinglulu ARM_ARCH_MINOR := 6 404*91f16700Schasingluluendif 405*91f16700Schasinglulu 406*91f16700Schasinglulu################################################################################ 407*91f16700Schasinglulu# Common sources and include directories 408*91f16700Schasinglulu################################################################################ 409*91f16700Schasingluluinclude lib/compiler-rt/compiler-rt.mk 410*91f16700Schasinglulu 411*91f16700SchasingluluBL_COMMON_SOURCES += common/bl_common.c \ 412*91f16700Schasinglulu common/tf_log.c \ 413*91f16700Schasinglulu common/${ARCH}/debug.S \ 414*91f16700Schasinglulu drivers/console/multi_console.c \ 415*91f16700Schasinglulu lib/${ARCH}/cache_helpers.S \ 416*91f16700Schasinglulu lib/${ARCH}/misc_helpers.S \ 417*91f16700Schasinglulu lib/extensions/pmuv3/${ARCH}/pmuv3.c \ 418*91f16700Schasinglulu plat/common/plat_bl_common.c \ 419*91f16700Schasinglulu plat/common/plat_log_common.c \ 420*91f16700Schasinglulu plat/common/${ARCH}/plat_common.c \ 421*91f16700Schasinglulu plat/common/${ARCH}/platform_helpers.S \ 422*91f16700Schasinglulu ${COMPILER_RT_SRCS} 423*91f16700Schasinglulu 424*91f16700Schasingluluifeq ($(notdir $(CC)),armclang) 425*91f16700Schasinglulu BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 426*91f16700Schasingluluendif 427*91f16700Schasinglulu 428*91f16700Schasingluluifeq (${SANITIZE_UB},on) 429*91f16700Schasinglulu BL_COMMON_SOURCES += plat/common/ubsan.c 430*91f16700Schasingluluendif 431*91f16700Schasinglulu 432*91f16700SchasingluluINCLUDES += -Iinclude \ 433*91f16700Schasinglulu -Iinclude/arch/${ARCH} \ 434*91f16700Schasinglulu -Iinclude/lib/cpus/${ARCH} \ 435*91f16700Schasinglulu -Iinclude/lib/el3_runtime/${ARCH} \ 436*91f16700Schasinglulu ${PLAT_INCLUDES} \ 437*91f16700Schasinglulu ${SPD_INCLUDES} 438*91f16700Schasinglulu 439*91f16700SchasingluluDTC_FLAGS += -I dts -O dtb 440*91f16700SchasingluluDTC_CPPFLAGS += -P -nostdinc $(INCLUDES) -Ifdts -undef \ 441*91f16700Schasinglulu -x assembler-with-cpp $(DEFINES) 442*91f16700Schasinglulu 443*91f16700Schasingluluinclude common/backtrace/backtrace.mk 444*91f16700Schasinglulu 445*91f16700Schasinglulu################################################################################ 446*91f16700Schasinglulu# Generic definitions 447*91f16700Schasinglulu################################################################################ 448*91f16700Schasingluluinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 449*91f16700Schasinglulu 450*91f16700Schasingluluifeq (${BUILD_BASE},) 451*91f16700Schasinglulu BUILD_BASE := ./build 452*91f16700Schasingluluendif 453*91f16700SchasingluluBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 454*91f16700Schasinglulu 455*91f16700SchasingluluSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 456*91f16700Schasinglulu 457*91f16700Schasinglulu# Platforms providing their own TBB makefile may override this value 458*91f16700SchasingluluINCLUDE_TBBR_MK := 1 459*91f16700Schasinglulu 460*91f16700Schasinglulu################################################################################ 461*91f16700Schasinglulu# Include SPD Makefile if one has been specified 462*91f16700Schasinglulu################################################################################ 463*91f16700Schasinglulu 464*91f16700Schasingluluifneq (${SPD},none) 465*91f16700Schasinglulu ifeq (${ARCH},aarch32) 466*91f16700Schasinglulu $(error "Error: SPD is incompatible with AArch32.") 467*91f16700Schasinglulu endif 468*91f16700Schasinglulu 469*91f16700Schasinglulu ifdef EL3_PAYLOAD_BASE 470*91f16700Schasinglulu $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 471*91f16700Schasinglulu $(warning "The SPD and its BL32 companion will be present but \ 472*91f16700Schasinglulu ignored.") 473*91f16700Schasinglulu endif 474*91f16700Schasinglulu 475*91f16700Schasinglulu ifeq (${SPD},spmd) 476*91f16700Schasinglulu # SPMD is located in std_svc directory 477*91f16700Schasinglulu SPD_DIR := std_svc 478*91f16700Schasinglulu 479*91f16700Schasinglulu ifeq ($(SPMD_SPM_AT_SEL2),1) 480*91f16700Schasinglulu CTX_INCLUDE_EL2_REGS := 1 481*91f16700Schasinglulu ifeq ($(SPMC_AT_EL3),1) 482*91f16700Schasinglulu $(error SPM cannot be enabled in both S-EL2 and EL3.) 483*91f16700Schasinglulu endif 484*91f16700Schasinglulu endif 485*91f16700Schasinglulu 486*91f16700Schasinglulu ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) 487*91f16700Schasinglulu DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG 488*91f16700Schasinglulu endif 489*91f16700Schasinglulu 490*91f16700Schasinglulu ifeq ($(TS_SP_FW_CONFIG),1) 491*91f16700Schasinglulu DTC_CPPFLAGS += -DTS_SP_FW_CONFIG 492*91f16700Schasinglulu endif 493*91f16700Schasinglulu 494*91f16700Schasinglulu ifneq ($(ARM_BL2_SP_LIST_DTS),) 495*91f16700Schasinglulu DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) 496*91f16700Schasinglulu endif 497*91f16700Schasinglulu 498*91f16700Schasinglulu ifneq ($(SP_LAYOUT_FILE),) 499*91f16700Schasinglulu BL2_ENABLE_SP_LOAD := 1 500*91f16700Schasinglulu endif 501*91f16700Schasinglulu 502*91f16700Schasinglulu ifeq ($(SPMC_AT_EL3_SEL0_SP),1) 503*91f16700Schasinglulu ifneq ($(SPMC_AT_EL3),1) 504*91f16700Schasinglulu $(error SEL0 SP cannot be enabled without SPMC at EL3) 505*91f16700Schasinglulu endif 506*91f16700Schasinglulu endif 507*91f16700Schasinglulu else 508*91f16700Schasinglulu # All other SPDs in spd directory 509*91f16700Schasinglulu SPD_DIR := spd 510*91f16700Schasinglulu endif #(SPD) 511*91f16700Schasinglulu 512*91f16700Schasinglulu # We expect to locate an spd.mk under the specified SPD directory 513*91f16700Schasinglulu SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 514*91f16700Schasinglulu 515*91f16700Schasinglulu ifeq (${SPD_MAKE},) 516*91f16700Schasinglulu $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 517*91f16700Schasinglulu endif 518*91f16700Schasinglulu $(info Including ${SPD_MAKE}) 519*91f16700Schasinglulu include ${SPD_MAKE} 520*91f16700Schasinglulu 521*91f16700Schasinglulu # If there's BL32 companion for the chosen SPD, we expect that the SPD's 522*91f16700Schasinglulu # Makefile would set NEED_BL32 to "yes". In this case, the build system 523*91f16700Schasinglulu # supports two mutually exclusive options: 524*91f16700Schasinglulu # * BL32 is built from source: then BL32_SOURCES must contain the list 525*91f16700Schasinglulu # of source files to build BL32 526*91f16700Schasinglulu # * BL32 is a prebuilt binary: then BL32 must point to the image file 527*91f16700Schasinglulu # that will be included in the FIP 528*91f16700Schasinglulu # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 529*91f16700Schasinglulu # over the sources. 530*91f16700Schasingluluendif #(SPD=none) 531*91f16700Schasinglulu 532*91f16700Schasingluluifeq (${ENABLE_SPMD_LP}, 1) 533*91f16700Schasingluluifneq (${SPD},spmd) 534*91f16700Schasinglulu $(error Error: ENABLE_SPMD_LP requires SPD=spmd.) 535*91f16700Schasingluluendif 536*91f16700Schasingluluifeq ($(SPMC_AT_EL3),1) 537*91f16700Schasinglulu $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.) 538*91f16700Schasingluluendif 539*91f16700Schasingluluendif 540*91f16700Schasinglulu 541*91f16700Schasinglulu################################################################################ 542*91f16700Schasinglulu# Process BRANCH_PROTECTION value and set 543*91f16700Schasinglulu# Pointer Authentication and Branch Target Identification flags 544*91f16700Schasinglulu################################################################################ 545*91f16700Schasingluluifeq (${BRANCH_PROTECTION},0) 546*91f16700Schasinglulu # Default value turns off all types of branch protection 547*91f16700Schasinglulu BP_OPTION := none 548*91f16700Schasingluluelse ifneq (${ARCH},aarch64) 549*91f16700Schasinglulu $(error BRANCH_PROTECTION requires AArch64) 550*91f16700Schasingluluelse ifeq (${BRANCH_PROTECTION},1) 551*91f16700Schasinglulu # Enables all types of branch protection features 552*91f16700Schasinglulu BP_OPTION := standard 553*91f16700Schasinglulu ENABLE_BTI := 1 554*91f16700Schasinglulu ENABLE_PAUTH := 1 555*91f16700Schasingluluelse ifeq (${BRANCH_PROTECTION},2) 556*91f16700Schasinglulu # Return address signing to its standard level 557*91f16700Schasinglulu BP_OPTION := pac-ret 558*91f16700Schasinglulu ENABLE_PAUTH := 1 559*91f16700Schasingluluelse ifeq (${BRANCH_PROTECTION},3) 560*91f16700Schasinglulu # Extend the signing to include leaf functions 561*91f16700Schasinglulu BP_OPTION := pac-ret+leaf 562*91f16700Schasinglulu ENABLE_PAUTH := 1 563*91f16700Schasingluluelse ifeq (${BRANCH_PROTECTION},4) 564*91f16700Schasinglulu # Turn on branch target identification mechanism 565*91f16700Schasinglulu BP_OPTION := bti 566*91f16700Schasinglulu ENABLE_BTI := 1 567*91f16700Schasingluluelse 568*91f16700Schasinglulu $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 569*91f16700Schasingluluendif #(BRANCH_PROTECTION) 570*91f16700Schasinglulu 571*91f16700Schasingluluifeq ($(ENABLE_PAUTH),1) 572*91f16700Schasinglulu CTX_INCLUDE_PAUTH_REGS := 1 573*91f16700Schasingluluendif 574*91f16700Schasingluluifneq (${BP_OPTION},none) 575*91f16700Schasinglulu TF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} 576*91f16700Schasingluluendif #(BP_OPTION) 577*91f16700Schasinglulu 578*91f16700Schasinglulu# Pointer Authentication sources 579*91f16700Schasingluluifeq (${ENABLE_PAUTH}, 1) 580*91f16700Schasinglulu# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 581*91f16700Schasinglulu# Pauth support. As it's not secure, it must be reimplemented for real platforms 582*91f16700Schasinglulu BL_COMMON_SOURCES += lib/extensions/pauth/pauth_helpers.S 583*91f16700Schasingluluendif 584*91f16700Schasinglulu 585*91f16700Schasinglulu################################################################################ 586*91f16700Schasinglulu# Include the platform specific Makefile after the SPD Makefile (the platform 587*91f16700Schasinglulu# makefile may use all previous definitions in this file) 588*91f16700Schasinglulu################################################################################ 589*91f16700Schasingluluinclude ${PLAT_MAKEFILE_FULL} 590*91f16700Schasinglulu 591*91f16700Schasinglulu################################################################################ 592*91f16700Schasinglulu# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from 593*91f16700Schasinglulu# platform. 594*91f16700Schasinglulu################################################################################ 595*91f16700Schasingluluinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 596*91f16700Schasinglulu 597*91f16700Schasinglulu#################################################### 598*91f16700Schasinglulu# Enable required options for Memory Stack Tagging. 599*91f16700Schasinglulu#################################################### 600*91f16700Schasinglulu 601*91f16700Schasinglulu# Currently, these options are enabled only for clang and armclang compiler. 602*91f16700Schasingluluifeq (${SUPPORT_STACK_MEMTAG},yes) 603*91f16700Schasinglulu ifdef mem_tag_arch_support 604*91f16700Schasinglulu # Check for armclang and clang compilers 605*91f16700Schasinglulu ifneq ( ,$(filter $(notdir $(CC)),armclang clang)) 606*91f16700Schasinglulu # Add "memtag" architecture feature modifier if not specified 607*91f16700Schasinglulu ifeq ( ,$(findstring memtag,$(arch-features))) 608*91f16700Schasinglulu arch-features := $(arch-features)+memtag 609*91f16700Schasinglulu endif # memtag 610*91f16700Schasinglulu ifeq ($(notdir $(CC)),armclang) 611*91f16700Schasinglulu TF_CFLAGS += -mmemtag-stack 612*91f16700Schasinglulu else ifeq ($(notdir $(CC)),clang) 613*91f16700Schasinglulu TF_CFLAGS += -fsanitize=memtag 614*91f16700Schasinglulu endif # armclang 615*91f16700Schasinglulu endif 616*91f16700Schasinglulu else 617*91f16700Schasinglulu $(error "Error: stack memory tagging is not supported for \ 618*91f16700Schasinglulu architecture ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a") 619*91f16700Schasinglulu endif #(mem_tag_arch_support) 620*91f16700Schasingluluendif #(SUPPORT_STACK_MEMTAG) 621*91f16700Schasinglulu 622*91f16700Schasinglulu################################################################################ 623*91f16700Schasinglulu# RME dependent flags configuration, Enable optional features for RME. 624*91f16700Schasinglulu################################################################################ 625*91f16700Schasinglulu# FEAT_RME 626*91f16700Schasingluluifeq (${ENABLE_RME},1) 627*91f16700Schasinglulu # RME doesn't support BRBE 628*91f16700Schasinglulu ENABLE_BRBE_FOR_NS := 0 629*91f16700Schasinglulu 630*91f16700Schasinglulu # RME doesn't support PIE 631*91f16700Schasinglulu ifneq (${ENABLE_PIE},0) 632*91f16700Schasinglulu $(error ENABLE_RME does not support PIE) 633*91f16700Schasinglulu endif 634*91f16700Schasinglulu 635*91f16700Schasinglulu # RME doesn't support BRBE 636*91f16700Schasinglulu ifneq (${ENABLE_BRBE_FOR_NS},0) 637*91f16700Schasinglulu $(error ENABLE_RME does not support BRBE.) 638*91f16700Schasinglulu endif 639*91f16700Schasinglulu 640*91f16700Schasinglulu # RME requires AARCH64 641*91f16700Schasinglulu ifneq (${ARCH},aarch64) 642*91f16700Schasinglulu $(error ENABLE_RME requires AArch64) 643*91f16700Schasinglulu endif 644*91f16700Schasinglulu 645*91f16700Schasinglulu # RME requires el2 context to be saved for now. 646*91f16700Schasinglulu CTX_INCLUDE_EL2_REGS := 1 647*91f16700Schasinglulu CTX_INCLUDE_AARCH32_REGS := 0 648*91f16700Schasinglulu CTX_INCLUDE_PAUTH_REGS := 1 649*91f16700Schasinglulu 650*91f16700Schasinglulu # RME enables CSV2_2 extension by default. 651*91f16700Schasinglulu ENABLE_FEAT_CSV2_2 = 1 652*91f16700Schasingluluendif #(FEAT_RME) 653*91f16700Schasinglulu 654*91f16700Schasinglulu################################################################################ 655*91f16700Schasinglulu# Include rmmd Makefile if RME is enabled 656*91f16700Schasinglulu################################################################################ 657*91f16700Schasingluluifneq (${ENABLE_RME},0) 658*91f16700Schasinglulu ifneq (${ARCH},aarch64) 659*91f16700Schasinglulu $(error ENABLE_RME requires AArch64) 660*91f16700Schasinglulu endif 661*91f16700Schasinglulu ifeq ($(SPMC_AT_EL3),1) 662*91f16700Schasinglulu $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) 663*91f16700Schasinglulu endif 664*91f16700Schasinglulu 665*91f16700Schasinglulu ifneq (${SPD}, none) 666*91f16700Schasinglulu ifneq (${SPD}, spmd) 667*91f16700Schasinglulu $(error ENABLE_RME is incompatible with SPD=${SPD}. Use SPD=spmd) 668*91f16700Schasinglulu endif 669*91f16700Schasinglulu endif 670*91f16700Schasingluluinclude services/std_svc/rmmd/rmmd.mk 671*91f16700Schasinglulu$(warning "RME is an experimental feature") 672*91f16700Schasingluluendif 673*91f16700Schasinglulu 674*91f16700Schasingluluifeq (${CTX_INCLUDE_EL2_REGS}, 1) 675*91f16700Schasinglulu ifeq (${SPD},none) 676*91f16700Schasinglulu ifeq (${ENABLE_RME},0) 677*91f16700Schasinglulu $(error CTX_INCLUDE_EL2_REGS is available only when SPD \ 678*91f16700Schasinglulu or RME is enabled) 679*91f16700Schasinglulu endif 680*91f16700Schasinglulu endif 681*91f16700Schasingluluendif 682*91f16700Schasinglulu 683*91f16700Schasinglulu################################################################################ 684*91f16700Schasinglulu# Platform specific Makefile might provide us ARCH_MAJOR/MINOR use that to come 685*91f16700Schasinglulu# up with appropriate march values for compiler. 686*91f16700Schasinglulu################################################################################ 687*91f16700Schasingluluinclude ${MAKE_HELPERS_DIRECTORY}march.mk 688*91f16700Schasinglulu 689*91f16700SchasingluluTF_CFLAGS += $(march-directive) 690*91f16700Schasinglulu 691*91f16700Schasinglulu# This internal flag is common option which is set to 1 for scenarios 692*91f16700Schasinglulu# when the BL2 is running in EL3 level. This occurs in two scenarios - 693*91f16700Schasinglulu# 4 world system running BL2 at EL3 and two world system without BL1 running 694*91f16700Schasinglulu# BL2 in EL3 695*91f16700Schasinglulu 696*91f16700Schasingluluifeq (${RESET_TO_BL2},1) 697*91f16700Schasinglulu BL2_RUNS_AT_EL3 := 1 698*91f16700Schasinglulu ifeq (${ENABLE_RME},1) 699*91f16700Schasinglulu $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not \ 700*91f16700Schasinglulu supported at the moment.) 701*91f16700Schasinglulu endif 702*91f16700Schasingluluelse ifeq (${ENABLE_RME},1) 703*91f16700Schasinglulu BL2_RUNS_AT_EL3 := 1 704*91f16700Schasingluluelse 705*91f16700Schasinglulu BL2_RUNS_AT_EL3 := 0 706*91f16700Schasingluluendif 707*91f16700Schasinglulu 708*91f16700Schasinglulu# This internal flag is set to 1 when Firmware First handling of External aborts 709*91f16700Schasinglulu# is required by lowe ELs. Currently only NS requires this support. 710*91f16700Schasingluluifeq ($(HANDLE_EA_EL3_FIRST_NS),1) 711*91f16700Schasinglulu FFH_SUPPORT := 1 712*91f16700Schasingluluelse 713*91f16700Schasinglulu FFH_SUPPORT := 0 714*91f16700Schasingluluendif 715*91f16700Schasinglulu 716*91f16700Schasinglulu$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) 717*91f16700Schasinglulu 718*91f16700Schasingluluifeq (${ARM_ARCH_MAJOR},7) 719*91f16700Schasingluluinclude make_helpers/armv7-a-cpus.mk 720*91f16700Schasingluluendif 721*91f16700Schasinglulu 722*91f16700SchasingluluPIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) 723*91f16700Schasingluluifneq ($(PIE_FOUND),) 724*91f16700Schasinglulu TF_CFLAGS += -fno-PIE 725*91f16700Schasingluluifneq ($(findstring gcc,$(notdir $(LD))),) 726*91f16700Schasinglulu TF_LDFLAGS += -no-pie 727*91f16700Schasingluluendif 728*91f16700Schasingluluendif #(PIE_FOUND) 729*91f16700Schasinglulu 730*91f16700Schasingluluifneq ($(findstring gcc,$(notdir $(LD))),) 731*91f16700Schasinglulu PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker 732*91f16700Schasingluluelse 733*91f16700Schasinglulu PIE_LDFLAGS += -pie --no-dynamic-linker 734*91f16700Schasingluluendif 735*91f16700Schasinglulu 736*91f16700Schasingluluifeq ($(ENABLE_PIE),1) 737*91f16700Schasinglulu ifeq ($(RESET_TO_BL2),1) 738*91f16700Schasinglulu ifneq ($(BL2_IN_XIP_MEM),1) 739*91f16700Schasinglulu BL2_CPPFLAGS += -fpie 740*91f16700Schasinglulu BL2_CFLAGS += -fpie 741*91f16700Schasinglulu BL2_LDFLAGS += $(PIE_LDFLAGS) 742*91f16700Schasinglulu endif #(BL2_IN_XIP_MEM) 743*91f16700Schasinglulu endif #(RESET_TO_BL2) 744*91f16700Schasinglulu BL31_CPPFLAGS += -fpie 745*91f16700Schasinglulu BL31_CFLAGS += -fpie 746*91f16700Schasinglulu BL31_LDFLAGS += $(PIE_LDFLAGS) 747*91f16700Schasinglulu 748*91f16700Schasinglulu BL32_CPPFLAGS += -fpie 749*91f16700Schasinglulu BL32_CFLAGS += -fpie 750*91f16700Schasinglulu BL32_LDFLAGS += $(PIE_LDFLAGS) 751*91f16700Schasingluluendif #(ENABLE_PIE) 752*91f16700Schasinglulu 753*91f16700SchasingluluBL1_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} 754*91f16700SchasingluluBL31_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} 755*91f16700SchasingluluBL32_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} 756*91f16700Schasinglulu 757*91f16700SchasingluluBL1_CPPFLAGS += -DIMAGE_AT_EL3 758*91f16700Schasingluluifeq ($(RESET_TO_BL2),1) 759*91f16700Schasinglulu BL2_CPPFLAGS += -DIMAGE_AT_EL3 760*91f16700Schasingluluelse 761*91f16700Schasinglulu BL2_CPPFLAGS += -DIMAGE_AT_EL1 762*91f16700Schasingluluendif #(RESET_TO_BL2) 763*91f16700Schasinglulu 764*91f16700Schasingluluifeq (${ARCH},aarch64) 765*91f16700Schasinglulu BL2U_CPPFLAGS += -DIMAGE_AT_EL1 766*91f16700Schasinglulu BL31_CPPFLAGS += -DIMAGE_AT_EL3 767*91f16700Schasinglulu BL32_CPPFLAGS += -DIMAGE_AT_EL1 768*91f16700Schasingluluelse 769*91f16700Schasinglulu BL32_CPPFLAGS += -DIMAGE_AT_EL3 770*91f16700Schasingluluendif 771*91f16700Schasinglulu 772*91f16700Schasinglulu# Include the CPU specific operations makefile, which provides default 773*91f16700Schasinglulu# values for all CPU errata workarounds and CPU specific optimisations. 774*91f16700Schasinglulu# This can be overridden by the platform. 775*91f16700Schasingluluinclude lib/cpus/cpu-ops.mk 776*91f16700Schasinglulu 777*91f16700Schasinglulu################################################################################ 778*91f16700Schasinglulu# Build `AARCH32_SP` as BL32 image for AArch32 779*91f16700Schasinglulu################################################################################ 780*91f16700Schasingluluifeq (${ARCH},aarch32) 781*91f16700Schasinglulu NEED_BL32 := yes 782*91f16700Schasinglulu 783*91f16700Schasinglulu ifneq (${AARCH32_SP},none) 784*91f16700Schasinglulu # We expect to locate an sp.mk under the specified AARCH32_SP directory 785*91f16700Schasinglulu AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 786*91f16700Schasinglulu 787*91f16700Schasinglulu ifeq (${AARCH32_SP_MAKE},) 788*91f16700Schasinglulu $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 789*91f16700Schasinglulu endif 790*91f16700Schasinglulu $(info Including ${AARCH32_SP_MAKE}) 791*91f16700Schasinglulu include ${AARCH32_SP_MAKE} 792*91f16700Schasinglulu endif 793*91f16700Schasingluluendif #(ARCH=aarch32) 794*91f16700Schasinglulu 795*91f16700Schasinglulu################################################################################ 796*91f16700Schasinglulu# Include libc if not overridden 797*91f16700Schasinglulu################################################################################ 798*91f16700Schasingluluifeq (${OVERRIDE_LIBC},0) 799*91f16700Schasingluluinclude lib/libc/libc.mk 800*91f16700Schasingluluendif 801*91f16700Schasinglulu 802*91f16700Schasinglulu################################################################################ 803*91f16700Schasinglulu# Check incompatible options and dependencies 804*91f16700Schasinglulu################################################################################ 805*91f16700Schasinglulu 806*91f16700Schasinglulu# USE_DEBUGFS experimental feature recommended only in debug builds 807*91f16700Schasingluluifeq (${USE_DEBUGFS},1) 808*91f16700Schasinglulu ifeq (${DEBUG},1) 809*91f16700Schasinglulu $(warning DEBUGFS experimental feature is enabled.) 810*91f16700Schasinglulu else 811*91f16700Schasinglulu $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY) 812*91f16700Schasinglulu endif 813*91f16700Schasingluluendif #(USE_DEBUGFS) 814*91f16700Schasinglulu 815*91f16700Schasinglulu# USE_SPINLOCK_CAS requires AArch64 build 816*91f16700Schasingluluifeq (${USE_SPINLOCK_CAS},1) 817*91f16700Schasinglulu ifneq (${ARCH},aarch64) 818*91f16700Schasinglulu $(error USE_SPINLOCK_CAS requires AArch64) 819*91f16700Schasinglulu endif 820*91f16700Schasingluluendif #(USE_SPINLOCK_CAS) 821*91f16700Schasinglulu 822*91f16700Schasinglulu# The cert_create tool cannot generate certificates individually, so we use the 823*91f16700Schasinglulu# target 'certificates' to create them all 824*91f16700Schasingluluifneq (${GENERATE_COT},0) 825*91f16700Schasinglulu FIP_DEPS += certificates 826*91f16700Schasinglulu FWU_FIP_DEPS += fwu_certificates 827*91f16700Schasingluluendif 828*91f16700Schasinglulu 829*91f16700Schasingluluifneq (${DECRYPTION_SUPPORT},none) 830*91f16700Schasinglulu ENC_ARGS += -f ${FW_ENC_STATUS} 831*91f16700Schasinglulu ENC_ARGS += -k ${ENC_KEY} 832*91f16700Schasinglulu ENC_ARGS += -n ${ENC_NONCE} 833*91f16700Schasinglulu FIP_DEPS += enctool 834*91f16700Schasinglulu FWU_FIP_DEPS += enctool 835*91f16700Schasingluluendif #(DECRYPTION_SUPPORT) 836*91f16700Schasinglulu 837*91f16700Schasingluluifdef EL3_PAYLOAD_BASE 838*91f16700Schasinglulu ifdef PRELOADED_BL33_BASE 839*91f16700Schasinglulu $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 840*91f16700Schasinglulu incompatible build options. EL3_PAYLOAD_BASE has priority.") 841*91f16700Schasinglulu endif 842*91f16700Schasinglulu ifneq (${GENERATE_COT},0) 843*91f16700Schasinglulu $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible \ 844*91f16700Schasinglulu build options.") 845*91f16700Schasinglulu endif 846*91f16700Schasinglulu ifneq (${TRUSTED_BOARD_BOOT},0) 847*91f16700Schasinglulu $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are \ 848*91f16700Schasinglulu incompatible \ build options.") 849*91f16700Schasinglulu endif 850*91f16700Schasingluluendif #(EL3_PAYLOAD_BASE) 851*91f16700Schasinglulu 852*91f16700Schasingluluifeq (${NEED_BL33},yes) 853*91f16700Schasinglulu ifdef EL3_PAYLOAD_BASE 854*91f16700Schasinglulu $(warning "BL33 image is not needed when option \ 855*91f16700Schasinglulu BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 856*91f16700Schasinglulu endif 857*91f16700Schasinglulu ifdef PRELOADED_BL33_BASE 858*91f16700Schasinglulu $(warning "BL33 image is not needed when option \ 859*91f16700Schasinglulu PRELOADED_BL33_BASE is used and won't be added to the FIP file.") 860*91f16700Schasinglulu endif 861*91f16700Schasingluluendif #(NEED_BL33) 862*91f16700Schasinglulu 863*91f16700Schasinglulu# When building for systems with hardware-assisted coherency, there's no need to 864*91f16700Schasinglulu# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 865*91f16700Schasingluluifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 866*91f16700Schasinglulu $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 867*91f16700Schasingluluendif 868*91f16700Schasinglulu 869*91f16700Schasinglulu#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1. 870*91f16700Schasingluluifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1) 871*91f16700Schasinglulu $(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled") 872*91f16700Schasingluluendif 873*91f16700Schasinglulu 874*91f16700Schasinglulu# RAS_EXTENSION is deprecated, provide alternate build options 875*91f16700Schasingluluifeq ($(RAS_EXTENSION),1) 876*91f16700Schasinglulu $(error "RAS_EXTENSION is now deprecated, please use ENABLE_FEAT_RAS \ 877*91f16700Schasinglulu and HANDLE_EA_EL3_FIRST_NS instead") 878*91f16700Schasingluluendif 879*91f16700Schasinglulu 880*91f16700Schasinglulu 881*91f16700Schasinglulu# When FAULT_INJECTION_SUPPORT is used, require that FEAT_RAS is enabled 882*91f16700Schasingluluifeq ($(FAULT_INJECTION_SUPPORT),1) 883*91f16700Schasinglulu ifeq ($(ENABLE_FEAT_RAS),0) 884*91f16700Schasinglulu $(error For FAULT_INJECTION_SUPPORT, ENABLE_FEAT_RAS must not be 0) 885*91f16700Schasinglulu endif 886*91f16700Schasingluluendif #(FAULT_INJECTION_SUPPORT) 887*91f16700Schasinglulu 888*91f16700Schasinglulu# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 889*91f16700Schasingluluifeq ($(DYN_DISABLE_AUTH), 1) 890*91f16700Schasinglulu ifeq (${TRUSTED_BOARD_BOOT}, 0) 891*91f16700Schasinglulu $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH \ 892*91f16700Schasinglulu to be set.") 893*91f16700Schasinglulu endif 894*91f16700Schasingluluendif #(DYN_DISABLE_AUTH) 895*91f16700Schasinglulu 896*91f16700Schasingluluifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) 897*91f16700Schasinglulu# Support authentication verification and hash calculation 898*91f16700Schasinglulu CRYPTO_SUPPORT := 3 899*91f16700Schasingluluelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) 900*91f16700Schasinglulu# Support authentication verification and hash calculation 901*91f16700Schasinglulu CRYPTO_SUPPORT := 3 902*91f16700Schasingluluelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) 903*91f16700Schasinglulu# Support hash calculation only 904*91f16700Schasinglulu CRYPTO_SUPPORT := 2 905*91f16700Schasingluluelse ifeq (${TRUSTED_BOARD_BOOT},1) 906*91f16700Schasinglulu# Support authentication verification only 907*91f16700Schasinglulu CRYPTO_SUPPORT := 1 908*91f16700Schasingluluelse 909*91f16700Schasinglulu CRYPTO_SUPPORT := 0 910*91f16700Schasingluluendif #($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT)) 911*91f16700Schasinglulu 912*91f16700Schasinglulu# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. 913*91f16700Schasingluluifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) 914*91f16700Schasinglulu $(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") 915*91f16700Schasingluluendif 916*91f16700Schasinglulu 917*91f16700Schasinglulu# If pointer authentication is used in the firmware, make sure that all the 918*91f16700Schasinglulu# registers associated to it are also saved and restored. 919*91f16700Schasinglulu# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. 920*91f16700Schasingluluifeq ($(ENABLE_PAUTH),1) 921*91f16700Schasinglulu ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) 922*91f16700Schasinglulu $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) 923*91f16700Schasinglulu endif 924*91f16700Schasingluluendif #(ENABLE_PAUTH) 925*91f16700Schasinglulu 926*91f16700Schasingluluifeq ($(CTX_INCLUDE_PAUTH_REGS),1) 927*91f16700Schasinglulu ifneq (${ARCH},aarch64) 928*91f16700Schasinglulu $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) 929*91f16700Schasinglulu endif 930*91f16700Schasingluluendif #(CTX_INCLUDE_PAUTH_REGS) 931*91f16700Schasinglulu 932*91f16700Schasingluluifeq ($(CTX_INCLUDE_MTE_REGS),1) 933*91f16700Schasinglulu ifneq (${ARCH},aarch64) 934*91f16700Schasinglulu $(error CTX_INCLUDE_MTE_REGS requires AArch64) 935*91f16700Schasinglulu endif 936*91f16700Schasingluluendif #(CTX_INCLUDE_MTE_REGS) 937*91f16700Schasinglulu 938*91f16700Schasingluluifeq ($(PSA_FWU_SUPPORT),1) 939*91f16700Schasinglulu $(info PSA_FWU_SUPPORT is an experimental feature) 940*91f16700Schasingluluendif #(PSA_FWU_SUPPORT) 941*91f16700Schasinglulu 942*91f16700Schasingluluifeq ($(FEATURE_DETECTION),1) 943*91f16700Schasinglulu $(info FEATURE_DETECTION is an experimental feature) 944*91f16700Schasingluluendif #(FEATURE_DETECTION) 945*91f16700Schasinglulu 946*91f16700Schasingluluifneq ($(ENABLE_SME2_FOR_NS), 0) 947*91f16700Schasinglulu ifeq (${ENABLE_SME_FOR_NS}, 0) 948*91f16700Schasinglulu $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also \ 949*91f16700Schasinglulu to be set") 950*91f16700Schasinglulu $(warning "Forced ENABLE_SME_FOR_NS=1") 951*91f16700Schasinglulu override ENABLE_SME_FOR_NS := 1 952*91f16700Schasinglulu endif 953*91f16700Schasingluluendif #(ENABLE_SME2_FOR_NS) 954*91f16700Schasinglulu 955*91f16700Schasingluluifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 956*91f16700Schasinglulu ifeq (${ALLOW_RO_XLAT_TABLES}, 1) 957*91f16700Schasinglulu $(error "ALLOW_RO_XLAT_TABLES requires translation tables \ 958*91f16700Schasinglulu library v2") 959*91f16700Schasinglulu endif 960*91f16700Schasingluluendif #(ARM_XLAT_TABLES_LIB_V1) 961*91f16700Schasinglulu 962*91f16700Schasingluluifneq (${DECRYPTION_SUPPORT},none) 963*91f16700Schasinglulu ifeq (${TRUSTED_BOARD_BOOT}, 0) 964*91f16700Schasinglulu $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT \ 965*91f16700Schasinglulu to be set) 966*91f16700Schasinglulu endif 967*91f16700Schasingluluendif #(DECRYPTION_SUPPORT) 968*91f16700Schasinglulu 969*91f16700Schasinglulu# Ensure that no Aarch64-only features are enabled in Aarch32 build 970*91f16700Schasingluluifeq (${ARCH},aarch32) 971*91f16700Schasinglulu 972*91f16700Schasinglulu # SME/SVE only supported on AArch64 973*91f16700Schasinglulu ifneq (${ENABLE_SME_FOR_NS},0) 974*91f16700Schasinglulu $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") 975*91f16700Schasinglulu endif 976*91f16700Schasinglulu 977*91f16700Schasinglulu ifeq (${ENABLE_SVE_FOR_NS},1) 978*91f16700Schasinglulu # Warning instead of error due to CI dependency on this 979*91f16700Schasinglulu $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") 980*91f16700Schasinglulu endif 981*91f16700Schasinglulu 982*91f16700Schasinglulu # BRBE is not supported in AArch32 983*91f16700Schasinglulu ifeq (${ENABLE_BRBE_FOR_NS},1) 984*91f16700Schasinglulu $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") 985*91f16700Schasinglulu endif 986*91f16700Schasinglulu 987*91f16700Schasinglulu # FEAT_RNG_TRAP is not supported in AArch32 988*91f16700Schasinglulu ifeq (${ENABLE_FEAT_RNG_TRAP},1) 989*91f16700Schasinglulu $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") 990*91f16700Schasinglulu endif 991*91f16700Schasingluluendif #(ARCH=aarch32) 992*91f16700Schasinglulu 993*91f16700Schasingluluifneq (${ENABLE_SME_FOR_NS},0) 994*91f16700Schasinglulu ifeq (${ENABLE_SVE_FOR_NS},0) 995*91f16700Schasinglulu $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS") 996*91f16700Schasinglulu endif 997*91f16700Schasingluluendif #(ENABLE_SME_FOR_NS) 998*91f16700Schasinglulu 999*91f16700Schasinglulu# Secure SME/SVE requires the non-secure component as well 1000*91f16700Schasingluluifeq (${ENABLE_SME_FOR_SWD},1) 1001*91f16700Schasinglulu ifeq (${ENABLE_SME_FOR_NS},0) 1002*91f16700Schasinglulu $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") 1003*91f16700Schasinglulu endif 1004*91f16700Schasinglulu ifeq (${ENABLE_SVE_FOR_SWD},0) 1005*91f16700Schasinglulu $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD") 1006*91f16700Schasinglulu endif 1007*91f16700Schasingluluendif #(ENABLE_SME_FOR_SWD) 1008*91f16700Schasinglulu 1009*91f16700Schasingluluifeq (${ENABLE_SVE_FOR_SWD},1) 1010*91f16700Schasinglulu ifeq (${ENABLE_SVE_FOR_NS},0) 1011*91f16700Schasinglulu $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") 1012*91f16700Schasinglulu endif 1013*91f16700Schasingluluendif #(ENABLE_SVE_FOR_SWD) 1014*91f16700Schasinglulu 1015*91f16700Schasinglulu# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does 1016*91f16700Schasinglulu# its own context management including FPU registers. 1017*91f16700Schasingluluifeq (${CTX_INCLUDE_FPREGS},1) 1018*91f16700Schasinglulu ifneq (${ENABLE_SME_FOR_NS},0) 1019*91f16700Schasinglulu $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 1020*91f16700Schasinglulu endif 1021*91f16700Schasinglulu 1022*91f16700Schasinglulu ifeq (${ENABLE_SVE_FOR_NS},1) 1023*91f16700Schasinglulu # Warning instead of error due to CI dependency on this 1024*91f16700Schasinglulu $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 1025*91f16700Schasinglulu $(warning "Forced ENABLE_SVE_FOR_NS=0") 1026*91f16700Schasinglulu override ENABLE_SVE_FOR_NS := 0 1027*91f16700Schasinglulu endif 1028*91f16700Schasingluluendif #(CTX_INCLUDE_FPREGS) 1029*91f16700Schasinglulu 1030*91f16700Schasingluluifeq ($(DRTM_SUPPORT),1) 1031*91f16700Schasinglulu $(info DRTM_SUPPORT is an experimental feature) 1032*91f16700Schasingluluendif 1033*91f16700Schasinglulu 1034*91f16700Schasingluluifeq (${TRANSFER_LIST},1) 1035*91f16700Schasinglulu $(info TRANSFER_LIST is an experimental feature) 1036*91f16700Schasingluluendif 1037*91f16700Schasinglulu 1038*91f16700Schasingluluifeq (${ENABLE_RME},1) 1039*91f16700Schasinglulu ifneq (${SEPARATE_CODE_AND_RODATA},1) 1040*91f16700Schasinglulu $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) 1041*91f16700Schasinglulu endif 1042*91f16700Schasingluluendif 1043*91f16700Schasinglulu 1044*91f16700Schasinglulu# Determine if FEAT_RNG is supported 1045*91f16700SchasingluluENABLE_FEAT_RNG = $(if $(findstring rng,${arch-features}),1,0) 1046*91f16700Schasinglulu 1047*91f16700Schasinglulu# Determine if FEAT_SB is supported 1048*91f16700SchasingluluENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0) 1049*91f16700Schasinglulu 1050*91f16700Schasingluluifeq ($(PSA_CRYPTO),1) 1051*91f16700Schasinglulu $(info PSA_CRYPTO is an experimental feature) 1052*91f16700Schasingluluendif 1053*91f16700Schasinglulu 1054*91f16700Schasinglulu################################################################################ 1055*91f16700Schasinglulu# Process platform overrideable behaviour 1056*91f16700Schasinglulu################################################################################ 1057*91f16700Schasinglulu 1058*91f16700Schasingluluifdef BL1_SOURCES 1059*91f16700Schasinglulu NEED_BL1 := yes 1060*91f16700Schasingluluendif #(BL1_SOURCES) 1061*91f16700Schasinglulu 1062*91f16700Schasingluluifdef BL2_SOURCES 1063*91f16700Schasinglulu NEED_BL2 := yes 1064*91f16700Schasinglulu 1065*91f16700Schasinglulu # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 1066*91f16700Schasinglulu # Certificate generation tools. This flag can be overridden by the platform. 1067*91f16700Schasinglulu ifdef EL3_PAYLOAD_BASE 1068*91f16700Schasinglulu # If booting an EL3 payload there is no need for a BL33 image 1069*91f16700Schasinglulu # in the FIP file. 1070*91f16700Schasinglulu NEED_BL33 := no 1071*91f16700Schasinglulu else 1072*91f16700Schasinglulu ifdef PRELOADED_BL33_BASE 1073*91f16700Schasinglulu # If booting a BL33 preloaded image there is no need of 1074*91f16700Schasinglulu # another one in the FIP file. 1075*91f16700Schasinglulu NEED_BL33 := no 1076*91f16700Schasinglulu else 1077*91f16700Schasinglulu NEED_BL33 ?= yes 1078*91f16700Schasinglulu endif 1079*91f16700Schasinglulu endif 1080*91f16700Schasingluluendif #(BL2_SOURCES) 1081*91f16700Schasinglulu 1082*91f16700Schasingluluifdef BL2U_SOURCES 1083*91f16700Schasinglulu NEED_BL2U := yes 1084*91f16700Schasingluluendif #(BL2U_SOURCES) 1085*91f16700Schasinglulu 1086*91f16700Schasinglulu# If SCP_BL2 is given, we always want FIP to include it. 1087*91f16700Schasingluluifdef SCP_BL2 1088*91f16700Schasinglulu NEED_SCP_BL2 := yes 1089*91f16700Schasingluluendif #(SCP_BL2) 1090*91f16700Schasinglulu 1091*91f16700Schasinglulu# For AArch32, BL31 is not currently supported. 1092*91f16700Schasingluluifneq (${ARCH},aarch32) 1093*91f16700Schasinglulu ifdef BL31_SOURCES 1094*91f16700Schasinglulu # When booting an EL3 payload, there is no need to compile the BL31 1095*91f16700Schasinglulu # image nor put it in the FIP. 1096*91f16700Schasinglulu ifndef EL3_PAYLOAD_BASE 1097*91f16700Schasinglulu NEED_BL31 := yes 1098*91f16700Schasinglulu endif 1099*91f16700Schasinglulu endif 1100*91f16700Schasingluluendif #(ARCH=aarch64) 1101*91f16700Schasinglulu 1102*91f16700Schasinglulu# Process TBB related flags 1103*91f16700Schasingluluifneq (${GENERATE_COT},0) 1104*91f16700Schasinglulu # Common cert_create options 1105*91f16700Schasinglulu ifneq (${CREATE_KEYS},0) 1106*91f16700Schasinglulu $(eval CRT_ARGS += -n) 1107*91f16700Schasinglulu $(eval FWU_CRT_ARGS += -n) 1108*91f16700Schasinglulu ifneq (${SAVE_KEYS},0) 1109*91f16700Schasinglulu $(eval CRT_ARGS += -k) 1110*91f16700Schasinglulu $(eval FWU_CRT_ARGS += -k) 1111*91f16700Schasinglulu endif 1112*91f16700Schasinglulu endif 1113*91f16700Schasinglulu # Include TBBR makefile (unless the platform indicates otherwise) 1114*91f16700Schasinglulu ifeq (${INCLUDE_TBBR_MK},1) 1115*91f16700Schasinglulu include make_helpers/tbbr/tbbr_tools.mk 1116*91f16700Schasinglulu endif 1117*91f16700Schasingluluendif #(GENERATE_COT) 1118*91f16700Schasinglulu 1119*91f16700Schasingluluifneq (${FIP_ALIGN},0) 1120*91f16700Schasinglulu FIP_ARGS += --align ${FIP_ALIGN} 1121*91f16700Schasingluluendif #(FIP_ALIGN) 1122*91f16700Schasinglulu 1123*91f16700Schasingluluifdef FDT_SOURCES 1124*91f16700Schasinglulu NEED_FDT := yes 1125*91f16700Schasingluluendif #(FDT_SOURCES) 1126*91f16700Schasinglulu 1127*91f16700Schasinglulu################################################################################ 1128*91f16700Schasinglulu# Include libraries' Makefile that are used in all BL 1129*91f16700Schasinglulu################################################################################ 1130*91f16700Schasinglulu 1131*91f16700Schasingluluinclude lib/stack_protector/stack_protector.mk 1132*91f16700Schasinglulu 1133*91f16700Schasinglulu################################################################################ 1134*91f16700Schasinglulu# Include BL specific makefiles 1135*91f16700Schasinglulu################################################################################ 1136*91f16700Schasinglulu 1137*91f16700Schasingluluifeq (${NEED_BL1},yes) 1138*91f16700Schasingluluinclude bl1/bl1.mk 1139*91f16700Schasingluluendif 1140*91f16700Schasinglulu 1141*91f16700Schasingluluifeq (${NEED_BL2},yes) 1142*91f16700Schasingluluinclude bl2/bl2.mk 1143*91f16700Schasingluluendif 1144*91f16700Schasinglulu 1145*91f16700Schasingluluifeq (${NEED_BL2U},yes) 1146*91f16700Schasingluluinclude bl2u/bl2u.mk 1147*91f16700Schasingluluendif 1148*91f16700Schasinglulu 1149*91f16700Schasingluluifeq (${NEED_BL31},yes) 1150*91f16700Schasingluluinclude bl31/bl31.mk 1151*91f16700Schasingluluendif 1152*91f16700Schasinglulu 1153*91f16700Schasinglulu################################################################################ 1154*91f16700Schasinglulu# Build options checks 1155*91f16700Schasinglulu################################################################################ 1156*91f16700Schasinglulu 1157*91f16700Schasinglulu# Boolean_Flags 1158*91f16700Schasinglulu$(eval $(call assert_booleans,\ 1159*91f16700Schasinglulu $(sort \ 1160*91f16700Schasinglulu ALLOW_RO_XLAT_TABLES \ 1161*91f16700Schasinglulu BL2_ENABLE_SP_LOAD \ 1162*91f16700Schasinglulu COLD_BOOT_SINGLE_CPU \ 1163*91f16700Schasinglulu CREATE_KEYS \ 1164*91f16700Schasinglulu CTX_INCLUDE_AARCH32_REGS \ 1165*91f16700Schasinglulu CTX_INCLUDE_FPREGS \ 1166*91f16700Schasinglulu CTX_INCLUDE_EL2_REGS \ 1167*91f16700Schasinglulu DEBUG \ 1168*91f16700Schasinglulu DYN_DISABLE_AUTH \ 1169*91f16700Schasinglulu EL3_EXCEPTION_HANDLING \ 1170*91f16700Schasinglulu ENABLE_AMU_AUXILIARY_COUNTERS \ 1171*91f16700Schasinglulu ENABLE_AMU_FCONF \ 1172*91f16700Schasinglulu AMU_RESTRICT_COUNTERS \ 1173*91f16700Schasinglulu ENABLE_ASSERTIONS \ 1174*91f16700Schasinglulu ENABLE_FEAT_SB \ 1175*91f16700Schasinglulu ENABLE_PIE \ 1176*91f16700Schasinglulu ENABLE_PMF \ 1177*91f16700Schasinglulu ENABLE_PSCI_STAT \ 1178*91f16700Schasinglulu ENABLE_RUNTIME_INSTRUMENTATION \ 1179*91f16700Schasinglulu ENABLE_SME_FOR_SWD \ 1180*91f16700Schasinglulu ENABLE_SVE_FOR_SWD \ 1181*91f16700Schasinglulu ENABLE_FEAT_RAS \ 1182*91f16700Schasinglulu FFH_SUPPORT \ 1183*91f16700Schasinglulu ERROR_DEPRECATED \ 1184*91f16700Schasinglulu FAULT_INJECTION_SUPPORT \ 1185*91f16700Schasinglulu GENERATE_COT \ 1186*91f16700Schasinglulu GICV2_G0_FOR_EL3 \ 1187*91f16700Schasinglulu HANDLE_EA_EL3_FIRST_NS \ 1188*91f16700Schasinglulu HW_ASSISTED_COHERENCY \ 1189*91f16700Schasinglulu MEASURED_BOOT \ 1190*91f16700Schasinglulu DRTM_SUPPORT \ 1191*91f16700Schasinglulu NS_TIMER_SWITCH \ 1192*91f16700Schasinglulu OVERRIDE_LIBC \ 1193*91f16700Schasinglulu PL011_GENERIC_UART \ 1194*91f16700Schasinglulu PLAT_RSS_NOT_SUPPORTED \ 1195*91f16700Schasinglulu PROGRAMMABLE_RESET_ADDRESS \ 1196*91f16700Schasinglulu PSCI_EXTENDED_STATE_ID \ 1197*91f16700Schasinglulu PSCI_OS_INIT_MODE \ 1198*91f16700Schasinglulu RESET_TO_BL31 \ 1199*91f16700Schasinglulu SAVE_KEYS \ 1200*91f16700Schasinglulu SEPARATE_CODE_AND_RODATA \ 1201*91f16700Schasinglulu SEPARATE_BL2_NOLOAD_REGION \ 1202*91f16700Schasinglulu SEPARATE_NOBITS_REGION \ 1203*91f16700Schasinglulu SPIN_ON_BL1_EXIT \ 1204*91f16700Schasinglulu SPM_MM \ 1205*91f16700Schasinglulu SPMC_AT_EL3 \ 1206*91f16700Schasinglulu SPMC_AT_EL3_SEL0_SP \ 1207*91f16700Schasinglulu SPMD_SPM_AT_SEL2 \ 1208*91f16700Schasinglulu ENABLE_SPMD_LP \ 1209*91f16700Schasinglulu TRANSFER_LIST \ 1210*91f16700Schasinglulu TRUSTED_BOARD_BOOT \ 1211*91f16700Schasinglulu USE_COHERENT_MEM \ 1212*91f16700Schasinglulu USE_DEBUGFS \ 1213*91f16700Schasinglulu ARM_IO_IN_DTB \ 1214*91f16700Schasinglulu SDEI_IN_FCONF \ 1215*91f16700Schasinglulu SEC_INT_DESC_IN_FCONF \ 1216*91f16700Schasinglulu USE_ROMLIB \ 1217*91f16700Schasinglulu USE_TBBR_DEFS \ 1218*91f16700Schasinglulu WARMBOOT_ENABLE_DCACHE_EARLY \ 1219*91f16700Schasinglulu RESET_TO_BL2 \ 1220*91f16700Schasinglulu BL2_IN_XIP_MEM \ 1221*91f16700Schasinglulu BL2_INV_DCACHE \ 1222*91f16700Schasinglulu USE_SPINLOCK_CAS \ 1223*91f16700Schasinglulu ENCRYPT_BL31 \ 1224*91f16700Schasinglulu ENCRYPT_BL32 \ 1225*91f16700Schasinglulu ERRATA_SPECULATIVE_AT \ 1226*91f16700Schasinglulu RAS_TRAP_NS_ERR_REC_ACCESS \ 1227*91f16700Schasinglulu COT_DESC_IN_DTB \ 1228*91f16700Schasinglulu USE_SP804_TIMER \ 1229*91f16700Schasinglulu PSA_FWU_SUPPORT \ 1230*91f16700Schasinglulu ENABLE_MPMM \ 1231*91f16700Schasinglulu ENABLE_MPMM_FCONF \ 1232*91f16700Schasinglulu FEATURE_DETECTION \ 1233*91f16700Schasinglulu TRNG_SUPPORT \ 1234*91f16700Schasinglulu ERRATA_ABI_SUPPORT \ 1235*91f16700Schasinglulu ERRATA_NON_ARM_INTERCONNECT \ 1236*91f16700Schasinglulu CONDITIONAL_CMO \ 1237*91f16700Schasinglulu PSA_CRYPTO \ 1238*91f16700Schasinglulu ENABLE_CONSOLE_GETC \ 1239*91f16700Schasinglulu INIT_UNUSED_NS_EL2 \ 1240*91f16700Schasinglulu ENABLE_SEC_UART \ 1241*91f16700Schasinglulu))) 1242*91f16700Schasinglulu 1243*91f16700Schasinglulu# Numeric_Flags 1244*91f16700Schasinglulu$(eval $(call assert_numerics,\ 1245*91f16700Schasinglulu $(sort \ 1246*91f16700Schasinglulu ARM_ARCH_MAJOR \ 1247*91f16700Schasinglulu ARM_ARCH_MINOR \ 1248*91f16700Schasinglulu BRANCH_PROTECTION \ 1249*91f16700Schasinglulu CTX_INCLUDE_PAUTH_REGS \ 1250*91f16700Schasinglulu CTX_INCLUDE_MTE_REGS \ 1251*91f16700Schasinglulu CTX_INCLUDE_NEVE_REGS \ 1252*91f16700Schasinglulu CRYPTO_SUPPORT \ 1253*91f16700Schasinglulu DISABLE_MTPMU \ 1254*91f16700Schasinglulu ENABLE_BRBE_FOR_NS \ 1255*91f16700Schasinglulu ENABLE_TRBE_FOR_NS \ 1256*91f16700Schasinglulu ENABLE_BTI \ 1257*91f16700Schasinglulu ENABLE_PAUTH \ 1258*91f16700Schasinglulu ENABLE_FEAT_AMU \ 1259*91f16700Schasinglulu ENABLE_FEAT_AMUv1p1 \ 1260*91f16700Schasinglulu ENABLE_FEAT_CSV2_2 \ 1261*91f16700Schasinglulu ENABLE_FEAT_DIT \ 1262*91f16700Schasinglulu ENABLE_FEAT_ECV \ 1263*91f16700Schasinglulu ENABLE_FEAT_FGT \ 1264*91f16700Schasinglulu ENABLE_FEAT_HCX \ 1265*91f16700Schasinglulu ENABLE_FEAT_PAN \ 1266*91f16700Schasinglulu ENABLE_FEAT_RNG \ 1267*91f16700Schasinglulu ENABLE_FEAT_RNG_TRAP \ 1268*91f16700Schasinglulu ENABLE_FEAT_SEL2 \ 1269*91f16700Schasinglulu ENABLE_FEAT_TCR2 \ 1270*91f16700Schasinglulu ENABLE_FEAT_S2PIE \ 1271*91f16700Schasinglulu ENABLE_FEAT_S1PIE \ 1272*91f16700Schasinglulu ENABLE_FEAT_S2POE \ 1273*91f16700Schasinglulu ENABLE_FEAT_S1POE \ 1274*91f16700Schasinglulu ENABLE_FEAT_GCS \ 1275*91f16700Schasinglulu ENABLE_FEAT_VHE \ 1276*91f16700Schasinglulu ENABLE_FEAT_MTE_PERM \ 1277*91f16700Schasinglulu ENABLE_FEAT_MPAM \ 1278*91f16700Schasinglulu ENABLE_RME \ 1279*91f16700Schasinglulu ENABLE_SPE_FOR_NS \ 1280*91f16700Schasinglulu ENABLE_SYS_REG_TRACE_FOR_NS \ 1281*91f16700Schasinglulu ENABLE_SME_FOR_NS \ 1282*91f16700Schasinglulu ENABLE_SME2_FOR_NS \ 1283*91f16700Schasinglulu ENABLE_SVE_FOR_NS \ 1284*91f16700Schasinglulu ENABLE_TRF_FOR_NS \ 1285*91f16700Schasinglulu FW_ENC_STATUS \ 1286*91f16700Schasinglulu NR_OF_FW_BANKS \ 1287*91f16700Schasinglulu NR_OF_IMAGES_IN_FW_BANK \ 1288*91f16700Schasinglulu TWED_DELAY \ 1289*91f16700Schasinglulu ENABLE_FEAT_TWED \ 1290*91f16700Schasinglulu SVE_VECTOR_LEN \ 1291*91f16700Schasinglulu IMPDEF_SYSREG_TRAP \ 1292*91f16700Schasinglulu))) 1293*91f16700Schasinglulu 1294*91f16700Schasingluluifdef KEY_SIZE 1295*91f16700Schasinglulu $(eval $(call assert_numeric,KEY_SIZE)) 1296*91f16700Schasingluluendif 1297*91f16700Schasinglulu 1298*91f16700Schasingluluifeq ($(filter $(SANITIZE_UB), on off trap),) 1299*91f16700Schasinglulu $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 1300*91f16700Schasingluluendif 1301*91f16700Schasinglulu 1302*91f16700Schasinglulu################################################################################ 1303*91f16700Schasinglulu# Add definitions to the cpp preprocessor based on the current build options. 1304*91f16700Schasinglulu# This is done after including the platform specific makefile to allow the 1305*91f16700Schasinglulu# platform to overwrite the default options 1306*91f16700Schasinglulu################################################################################ 1307*91f16700Schasinglulu 1308*91f16700Schasinglulu$(eval $(call add_defines,\ 1309*91f16700Schasinglulu $(sort \ 1310*91f16700Schasinglulu ALLOW_RO_XLAT_TABLES \ 1311*91f16700Schasinglulu ARM_ARCH_MAJOR \ 1312*91f16700Schasinglulu ARM_ARCH_MINOR \ 1313*91f16700Schasinglulu BL2_ENABLE_SP_LOAD \ 1314*91f16700Schasinglulu COLD_BOOT_SINGLE_CPU \ 1315*91f16700Schasinglulu CTX_INCLUDE_AARCH32_REGS \ 1316*91f16700Schasinglulu CTX_INCLUDE_FPREGS \ 1317*91f16700Schasinglulu CTX_INCLUDE_PAUTH_REGS \ 1318*91f16700Schasinglulu EL3_EXCEPTION_HANDLING \ 1319*91f16700Schasinglulu CTX_INCLUDE_MTE_REGS \ 1320*91f16700Schasinglulu CTX_INCLUDE_EL2_REGS \ 1321*91f16700Schasinglulu CTX_INCLUDE_NEVE_REGS \ 1322*91f16700Schasinglulu DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 1323*91f16700Schasinglulu DISABLE_MTPMU \ 1324*91f16700Schasinglulu ENABLE_FEAT_AMU \ 1325*91f16700Schasinglulu ENABLE_AMU_AUXILIARY_COUNTERS \ 1326*91f16700Schasinglulu ENABLE_AMU_FCONF \ 1327*91f16700Schasinglulu AMU_RESTRICT_COUNTERS \ 1328*91f16700Schasinglulu ENABLE_ASSERTIONS \ 1329*91f16700Schasinglulu ENABLE_BTI \ 1330*91f16700Schasinglulu ENABLE_FEAT_MPAM \ 1331*91f16700Schasinglulu ENABLE_PAUTH \ 1332*91f16700Schasinglulu ENABLE_PIE \ 1333*91f16700Schasinglulu ENABLE_PMF \ 1334*91f16700Schasinglulu ENABLE_PSCI_STAT \ 1335*91f16700Schasinglulu ENABLE_RME \ 1336*91f16700Schasinglulu ENABLE_RUNTIME_INSTRUMENTATION \ 1337*91f16700Schasinglulu ENABLE_SME_FOR_NS \ 1338*91f16700Schasinglulu ENABLE_SME2_FOR_NS \ 1339*91f16700Schasinglulu ENABLE_SME_FOR_SWD \ 1340*91f16700Schasinglulu ENABLE_SPE_FOR_NS \ 1341*91f16700Schasinglulu ENABLE_SVE_FOR_NS \ 1342*91f16700Schasinglulu ENABLE_SVE_FOR_SWD \ 1343*91f16700Schasinglulu ENABLE_FEAT_RAS \ 1344*91f16700Schasinglulu FFH_SUPPORT \ 1345*91f16700Schasinglulu ENCRYPT_BL31 \ 1346*91f16700Schasinglulu ENCRYPT_BL32 \ 1347*91f16700Schasinglulu ERROR_DEPRECATED \ 1348*91f16700Schasinglulu FAULT_INJECTION_SUPPORT \ 1349*91f16700Schasinglulu GICV2_G0_FOR_EL3 \ 1350*91f16700Schasinglulu HANDLE_EA_EL3_FIRST_NS \ 1351*91f16700Schasinglulu HW_ASSISTED_COHERENCY \ 1352*91f16700Schasinglulu LOG_LEVEL \ 1353*91f16700Schasinglulu MEASURED_BOOT \ 1354*91f16700Schasinglulu DRTM_SUPPORT \ 1355*91f16700Schasinglulu NS_TIMER_SWITCH \ 1356*91f16700Schasinglulu PL011_GENERIC_UART \ 1357*91f16700Schasinglulu PLAT_${PLAT} \ 1358*91f16700Schasinglulu PLAT_RSS_NOT_SUPPORTED \ 1359*91f16700Schasinglulu PROGRAMMABLE_RESET_ADDRESS \ 1360*91f16700Schasinglulu PSCI_EXTENDED_STATE_ID \ 1361*91f16700Schasinglulu PSCI_OS_INIT_MODE \ 1362*91f16700Schasinglulu RESET_TO_BL31 \ 1363*91f16700Schasinglulu SEPARATE_CODE_AND_RODATA \ 1364*91f16700Schasinglulu SEPARATE_BL2_NOLOAD_REGION \ 1365*91f16700Schasinglulu SEPARATE_NOBITS_REGION \ 1366*91f16700Schasinglulu RECLAIM_INIT_CODE \ 1367*91f16700Schasinglulu SPD_${SPD} \ 1368*91f16700Schasinglulu SPIN_ON_BL1_EXIT \ 1369*91f16700Schasinglulu SPM_MM \ 1370*91f16700Schasinglulu SPMC_AT_EL3 \ 1371*91f16700Schasinglulu SPMC_AT_EL3_SEL0_SP \ 1372*91f16700Schasinglulu SPMD_SPM_AT_SEL2 \ 1373*91f16700Schasinglulu TRANSFER_LIST \ 1374*91f16700Schasinglulu TRUSTED_BOARD_BOOT \ 1375*91f16700Schasinglulu CRYPTO_SUPPORT \ 1376*91f16700Schasinglulu TRNG_SUPPORT \ 1377*91f16700Schasinglulu ERRATA_ABI_SUPPORT \ 1378*91f16700Schasinglulu ERRATA_NON_ARM_INTERCONNECT \ 1379*91f16700Schasinglulu USE_COHERENT_MEM \ 1380*91f16700Schasinglulu USE_DEBUGFS \ 1381*91f16700Schasinglulu ARM_IO_IN_DTB \ 1382*91f16700Schasinglulu SDEI_IN_FCONF \ 1383*91f16700Schasinglulu SEC_INT_DESC_IN_FCONF \ 1384*91f16700Schasinglulu USE_ROMLIB \ 1385*91f16700Schasinglulu USE_TBBR_DEFS \ 1386*91f16700Schasinglulu WARMBOOT_ENABLE_DCACHE_EARLY \ 1387*91f16700Schasinglulu RESET_TO_BL2 \ 1388*91f16700Schasinglulu BL2_RUNS_AT_EL3 \ 1389*91f16700Schasinglulu BL2_IN_XIP_MEM \ 1390*91f16700Schasinglulu BL2_INV_DCACHE \ 1391*91f16700Schasinglulu USE_SPINLOCK_CAS \ 1392*91f16700Schasinglulu ERRATA_SPECULATIVE_AT \ 1393*91f16700Schasinglulu RAS_TRAP_NS_ERR_REC_ACCESS \ 1394*91f16700Schasinglulu COT_DESC_IN_DTB \ 1395*91f16700Schasinglulu USE_SP804_TIMER \ 1396*91f16700Schasinglulu ENABLE_FEAT_RNG \ 1397*91f16700Schasinglulu ENABLE_FEAT_RNG_TRAP \ 1398*91f16700Schasinglulu ENABLE_FEAT_SB \ 1399*91f16700Schasinglulu ENABLE_FEAT_DIT \ 1400*91f16700Schasinglulu NR_OF_FW_BANKS \ 1401*91f16700Schasinglulu NR_OF_IMAGES_IN_FW_BANK \ 1402*91f16700Schasinglulu PSA_FWU_SUPPORT \ 1403*91f16700Schasinglulu ENABLE_BRBE_FOR_NS \ 1404*91f16700Schasinglulu ENABLE_TRBE_FOR_NS \ 1405*91f16700Schasinglulu ENABLE_SYS_REG_TRACE_FOR_NS \ 1406*91f16700Schasinglulu ENABLE_TRF_FOR_NS \ 1407*91f16700Schasinglulu ENABLE_FEAT_HCX \ 1408*91f16700Schasinglulu ENABLE_MPMM \ 1409*91f16700Schasinglulu ENABLE_MPMM_FCONF \ 1410*91f16700Schasinglulu ENABLE_FEAT_FGT \ 1411*91f16700Schasinglulu ENABLE_FEAT_ECV \ 1412*91f16700Schasinglulu ENABLE_FEAT_AMUv1p1 \ 1413*91f16700Schasinglulu ENABLE_FEAT_SEL2 \ 1414*91f16700Schasinglulu ENABLE_FEAT_VHE \ 1415*91f16700Schasinglulu ENABLE_FEAT_CSV2_2 \ 1416*91f16700Schasinglulu ENABLE_FEAT_PAN \ 1417*91f16700Schasinglulu ENABLE_FEAT_TCR2 \ 1418*91f16700Schasinglulu ENABLE_FEAT_S2PIE \ 1419*91f16700Schasinglulu ENABLE_FEAT_S1PIE \ 1420*91f16700Schasinglulu ENABLE_FEAT_S2POE \ 1421*91f16700Schasinglulu ENABLE_FEAT_S1POE \ 1422*91f16700Schasinglulu ENABLE_FEAT_GCS \ 1423*91f16700Schasinglulu ENABLE_FEAT_MTE_PERM \ 1424*91f16700Schasinglulu FEATURE_DETECTION \ 1425*91f16700Schasinglulu TWED_DELAY \ 1426*91f16700Schasinglulu ENABLE_FEAT_TWED \ 1427*91f16700Schasinglulu CONDITIONAL_CMO \ 1428*91f16700Schasinglulu IMPDEF_SYSREG_TRAP \ 1429*91f16700Schasinglulu SVE_VECTOR_LEN \ 1430*91f16700Schasinglulu ENABLE_SPMD_LP \ 1431*91f16700Schasinglulu PSA_CRYPTO \ 1432*91f16700Schasinglulu ENABLE_CONSOLE_GETC \ 1433*91f16700Schasinglulu INIT_UNUSED_NS_EL2 \ 1434*91f16700Schasinglulu))) 1435*91f16700Schasinglulu 1436*91f16700Schasingluluifeq (${SANITIZE_UB},trap) 1437*91f16700Schasinglulu $(eval $(call add_define,MONITOR_TRAPS)) 1438*91f16700Schasingluluendif #(SANITIZE_UB) 1439*91f16700Schasinglulu 1440*91f16700Schasinglulu# Define the EL3_PAYLOAD_BASE flag only if it is provided. 1441*91f16700Schasingluluifdef EL3_PAYLOAD_BASE 1442*91f16700Schasinglulu $(eval $(call add_define,EL3_PAYLOAD_BASE)) 1443*91f16700Schasingluluelse 1444*91f16700Schasinglulu# Define the PRELOADED_BL33_BASE flag only if it is provided and 1445*91f16700Schasinglulu# EL3_PAYLOAD_BASE is not defined, as it has priority. 1446*91f16700Schasinglulu ifdef PRELOADED_BL33_BASE 1447*91f16700Schasinglulu $(eval $(call add_define,PRELOADED_BL33_BASE)) 1448*91f16700Schasinglulu endif 1449*91f16700Schasingluluendif #(EL3_PAYLOAD_BASE) 1450*91f16700Schasinglulu 1451*91f16700Schasinglulu# Define the DYN_DISABLE_AUTH flag only if set. 1452*91f16700Schasingluluifeq (${DYN_DISABLE_AUTH},1) 1453*91f16700Schasinglulu $(eval $(call add_define,DYN_DISABLE_AUTH)) 1454*91f16700Schasingluluendif 1455*91f16700Schasinglulu 1456*91f16700Schasingluluifneq ($(findstring armlink,$(notdir $(LD))),) 1457*91f16700Schasinglulu $(eval $(call add_define,USE_ARM_LINK)) 1458*91f16700Schasingluluendif 1459*91f16700Schasinglulu 1460*91f16700Schasingluluifeq (${ENABLE_SEC_UART},1) 1461*91f16700Schasinglulu $(eval $(call add_define,LUA_UART0_CONSOLE)) 1462*91f16700Schasinglulu $(eval $(call add_define,LUA_SEC_UART1_IRQ)) 1463*91f16700Schasingluluendif 1464*91f16700Schasinglulu 1465*91f16700Schasingluluifeq (${FPGA},1) 1466*91f16700Schasinglulu $(eval $(call add_define,LUA_FPGA)) 1467*91f16700Schasingluluendif 1468*91f16700Schasinglulu 1469*91f16700Schasinglulu# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1470*91f16700Schasingluluifeq (${SPD},spmd) 1471*91f16700Schasingluluifdef SP_LAYOUT_FILE 1472*91f16700Schasinglulu -include $(BUILD_PLAT)/sp_gen.mk 1473*91f16700Schasinglulu FIP_DEPS += sp 1474*91f16700Schasinglulu CRT_DEPS += sp 1475*91f16700Schasinglulu NEED_SP_PKG := yes 1476*91f16700Schasingluluelse 1477*91f16700Schasinglulu ifeq (${SPMD_SPM_AT_SEL2},1) 1478*91f16700Schasinglulu $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1479*91f16700Schasinglulu endif 1480*91f16700Schasingluluendif #(SP_LAYOUT_FILE) 1481*91f16700Schasingluluendif #(SPD) 1482*91f16700Schasinglulu 1483*91f16700Schasinglulu################################################################################ 1484*91f16700Schasinglulu# Build targets 1485*91f16700Schasinglulu################################################################################ 1486*91f16700Schasinglulu 1487*91f16700Schasinglulu.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 1488*91f16700Schasinglulu.SUFFIXES: 1489*91f16700Schasinglulu 1490*91f16700Schasingluluall: msg_start 1491*91f16700Schasinglulu 1492*91f16700Schasinglulumsg_start: 1493*91f16700Schasinglulu @echo "Building ${PLAT}" 1494*91f16700Schasinglulu 1495*91f16700Schasingluluifeq (${ERROR_DEPRECATED},0) 1496*91f16700Schasinglulu# Check if deprecated declarations and cpp warnings should be treated as error or not. 1497*91f16700Schasingluluifneq ($(findstring clang,$(notdir $(CC))),) 1498*91f16700Schasinglulu CPPFLAGS += -Wno-error=deprecated-declarations 1499*91f16700Schasingluluelse 1500*91f16700Schasinglulu CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 1501*91f16700Schasingluluendif 1502*91f16700Schasingluluendif #(!ERROR_DEPRECATED) 1503*91f16700Schasinglulu 1504*91f16700Schasinglulu$(eval $(call MAKE_LIB_DIRS)) 1505*91f16700Schasinglulu$(eval $(call MAKE_LIB,c)) 1506*91f16700Schasinglulu 1507*91f16700Schasinglulu# Expand build macros for the different images 1508*91f16700Schasingluluifeq (${NEED_BL1},yes) 1509*91f16700SchasingluluBL1_SOURCES := $(sort ${BL1_SOURCES}) 1510*91f16700Schasinglulu$(eval $(call MAKE_BL,bl1)) 1511*91f16700Schasingluluendif #(NEED_BL1) 1512*91f16700Schasinglulu 1513*91f16700Schasingluluifeq (${NEED_BL2},yes) 1514*91f16700Schasinglulu 1515*91f16700Schasingluluifeq (${RESET_TO_BL2}, 0) 1516*91f16700SchasingluluFIP_BL2_ARGS := tb-fw 1517*91f16700Schasingluluendif 1518*91f16700Schasinglulu 1519*91f16700SchasingluluBL2_SOURCES := $(sort ${BL2_SOURCES}) 1520*91f16700Schasinglulu 1521*91f16700Schasinglulu$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1522*91f16700Schasinglulu $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 1523*91f16700Schasinglulu 1524*91f16700Schasingluluendif #(NEED_BL2) 1525*91f16700Schasinglulu 1526*91f16700Schasingluluifeq (${NEED_SCP_BL2},yes) 1527*91f16700Schasinglulu$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 1528*91f16700Schasingluluendif #(NEED_SCP_BL2) 1529*91f16700Schasinglulu 1530*91f16700Schasingluluifeq (${NEED_BL31},yes) 1531*91f16700SchasingluluBL31_SOURCES += ${SPD_SOURCES} 1532*91f16700Schasinglulu# Sort BL31 source files to remove duplicates 1533*91f16700SchasingluluBL31_SOURCES := $(sort ${BL31_SOURCES}) 1534*91f16700Schasingluluifneq (${DECRYPTION_SUPPORT},none) 1535*91f16700Schasinglulu$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1536*91f16700Schasinglulu $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1537*91f16700Schasingluluelse 1538*91f16700Schasinglulu$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1539*91f16700Schasinglulu $(eval $(call MAKE_BL,bl31,soc-fw))) 1540*91f16700Schasingluluendif #(DECRYPTION_SUPPORT) 1541*91f16700Schasingluluendif #(NEED_BL31) 1542*91f16700Schasinglulu 1543*91f16700Schasinglulu# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1544*91f16700Schasinglulu# build system will call TOOL_ADD_IMG to print a warning message and abort the 1545*91f16700Schasinglulu# process. Note that the dependency on BL32 applies to the FIP only. 1546*91f16700Schasingluluifeq (${NEED_BL32},yes) 1547*91f16700Schasinglulu# Sort BL32 source files to remove duplicates 1548*91f16700SchasingluluBL32_SOURCES := $(sort ${BL32_SOURCES}) 1549*91f16700SchasingluluBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 1550*91f16700Schasinglulu 1551*91f16700Schasingluluifneq (${DECRYPTION_SUPPORT},none) 1552*91f16700Schasinglulu$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1553*91f16700Schasinglulu $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1554*91f16700Schasingluluelse 1555*91f16700Schasinglulu$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 1556*91f16700Schasinglulu $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 1557*91f16700Schasingluluendif #(DECRYPTION_SUPPORT) 1558*91f16700Schasingluluendif #(NEED_BL32) 1559*91f16700Schasinglulu 1560*91f16700Schasinglulu# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 1561*91f16700Schasinglulu# needs to be built from RMM_SOURCES. 1562*91f16700Schasingluluifeq (${NEED_RMM},yes) 1563*91f16700Schasinglulu# Sort RMM source files to remove duplicates 1564*91f16700SchasingluluRMM_SOURCES := $(sort ${RMM_SOURCES}) 1565*91f16700SchasingluluBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 1566*91f16700Schasinglulu 1567*91f16700Schasinglulu$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 1568*91f16700Schasinglulu $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 1569*91f16700Schasingluluendif #(NEED_RMM) 1570*91f16700Schasinglulu 1571*91f16700Schasinglulu# Add the BL33 image if required by the platform 1572*91f16700Schasingluluifeq (${NEED_BL33},yes) 1573*91f16700Schasinglulu$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1574*91f16700Schasingluluendif #(NEED_BL33) 1575*91f16700Schasinglulu 1576*91f16700Schasingluluifeq (${NEED_BL2U},yes) 1577*91f16700Schasinglulu$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1578*91f16700Schasinglulu $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 1579*91f16700Schasingluluendif #(NEED_BL2U) 1580*91f16700Schasinglulu 1581*91f16700Schasinglulu# Expand build macros for the different images 1582*91f16700Schasingluluifeq (${NEED_FDT},yes) 1583*91f16700Schasinglulu $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 1584*91f16700Schasingluluendif #(NEED_FDT) 1585*91f16700Schasinglulu 1586*91f16700Schasinglulu# Add Secure Partition packages 1587*91f16700Schasingluluifeq (${NEED_SP_PKG},yes) 1588*91f16700Schasinglulu$(BUILD_PLAT)/sp_gen.mk : ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 1589*91f16700Schasinglulu ${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} 1590*91f16700Schasinglulusp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1591*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1592*91f16700Schasinglulu @echo "Built SP Images successfully" 1593*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1594*91f16700Schasingluluendif #(NEED_SP_PKG) 1595*91f16700Schasinglulu 1596*91f16700Schasinglululocate-checkpatch: 1597*91f16700Schasingluluifndef CHECKPATCH 1598*91f16700Schasinglulu $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1599*91f16700Schasingluluelse 1600*91f16700Schasingluluifeq (,$(wildcard ${CHECKPATCH})) 1601*91f16700Schasinglulu $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1602*91f16700Schasingluluendif 1603*91f16700Schasingluluendif #(CHECKPATCH) 1604*91f16700Schasinglulu 1605*91f16700Schasingluluclean: 1606*91f16700Schasinglulu @echo " CLEAN" 1607*91f16700Schasinglulu $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 1608*91f16700Schasingluluifdef UNIX_MK 1609*91f16700Schasinglulu ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 1610*91f16700Schasingluluelse 1611*91f16700Schasinglulu# Clear the MAKEFLAGS as we do not want 1612*91f16700Schasinglulu# to pass the gnumake flags to nmake. 1613*91f16700Schasinglulu ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean 1614*91f16700Schasingluluendif #(UNIX_MK) 1615*91f16700Schasinglulu ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1616*91f16700Schasinglulu ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 1617*91f16700Schasinglulu ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1618*91f16700Schasinglulu 1619*91f16700Schasinglulurealclean distclean: 1620*91f16700Schasinglulu @echo " REALCLEAN" 1621*91f16700Schasinglulu $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1622*91f16700Schasinglulu $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 1623*91f16700Schasingluluifdef UNIX_MK 1624*91f16700Schasinglulu ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 1625*91f16700Schasingluluelse 1626*91f16700Schasinglulu# Clear the MAKEFLAGS as we do not want 1627*91f16700Schasinglulu# to pass the gnumake flags to nmake. 1628*91f16700Schasinglulu ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean 1629*91f16700Schasingluluendif #(UNIX_MK) 1630*91f16700Schasinglulu ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean 1631*91f16700Schasinglulu ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 1632*91f16700Schasinglulu ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1633*91f16700Schasinglulu 1634*91f16700Schasinglulucheckcodebase: locate-checkpatch 1635*91f16700Schasinglulu @echo " CHECKING STYLE" 1636*91f16700Schasinglulu @if test -d .git ; then \ 1637*91f16700Schasinglulu git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 1638*91f16700Schasinglulu while read GIT_FILE ; \ 1639*91f16700Schasinglulu do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 1640*91f16700Schasinglulu done ; \ 1641*91f16700Schasinglulu else \ 1642*91f16700Schasinglulu find . -type f -not -iwholename "*.git*" \ 1643*91f16700Schasinglulu -not -iwholename "*build*" \ 1644*91f16700Schasinglulu -not -iwholename "*libfdt*" \ 1645*91f16700Schasinglulu -not -iwholename "*libc*" \ 1646*91f16700Schasinglulu -not -iwholename "*docs*" \ 1647*91f16700Schasinglulu -not -iwholename "*.rst" \ 1648*91f16700Schasinglulu -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 1649*91f16700Schasinglulu fi 1650*91f16700Schasinglulu 1651*91f16700Schasinglulucheckpatch: locate-checkpatch 1652*91f16700Schasinglulu @echo " CHECKING STYLE" 1653*91f16700Schasinglulu @if test -n "${CHECKPATCH_OPTS}"; then \ 1654*91f16700Schasinglulu echo " with ${CHECKPATCH_OPTS} option(s)"; \ 1655*91f16700Schasinglulu fi 1656*91f16700Schasinglulu ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 1657*91f16700Schasinglulu for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 1658*91f16700Schasinglulu do \ 1659*91f16700Schasinglulu printf "\n[*] Checking style of '$$commit'\n\n"; \ 1660*91f16700Schasinglulu git log --format=email "$$commit~..$$commit" \ 1661*91f16700Schasinglulu -- ${CHECK_PATHS} | \ 1662*91f16700Schasinglulu ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 1663*91f16700Schasinglulu git diff --format=email "$$commit~..$$commit" \ 1664*91f16700Schasinglulu -- ${CHECK_PATHS} | \ 1665*91f16700Schasinglulu ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 1666*91f16700Schasinglulu done 1667*91f16700Schasinglulu 1668*91f16700Schasinglulucerttool: ${CRTTOOL} 1669*91f16700Schasinglulu 1670*91f16700Schasinglulu${CRTTOOL}: FORCE 1671*91f16700Schasinglulu ${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 1672*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1673*91f16700Schasinglulu @echo "Built $@ successfully" 1674*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1675*91f16700Schasinglulu 1676*91f16700Schasingluluifneq (${GENERATE_COT},0) 1677*91f16700Schasinglulucertificates: ${CRT_DEPS} ${CRTTOOL} 1678*91f16700Schasinglulu ${Q}${CRTTOOL} ${CRT_ARGS} 1679*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1680*91f16700Schasinglulu @echo "Built $@ successfully" 1681*91f16700Schasinglulu @echo "Certificates can be found in ${BUILD_PLAT}" 1682*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1683*91f16700Schasingluluendif #(GENERATE_COT) 1684*91f16700Schasinglulu 1685*91f16700Schasinglulu${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 1686*91f16700Schasinglulu $(eval ${CHECK_FIP_CMD}) 1687*91f16700Schasinglulu ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1688*91f16700Schasinglulu ${Q}${FIPTOOL} info $@ 1689*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1690*91f16700Schasinglulu @echo "Built $@ successfully" 1691*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1692*91f16700Schasinglulu 1693*91f16700Schasingluluifneq (${GENERATE_COT},0) 1694*91f16700Schasinglulufwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 1695*91f16700Schasinglulu ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1696*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1697*91f16700Schasinglulu @echo "Built $@ successfully" 1698*91f16700Schasinglulu @echo "FWU certificates can be found in ${BUILD_PLAT}" 1699*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1700*91f16700Schasingluluendif #(GENERATE_COT) 1701*91f16700Schasinglulu 1702*91f16700Schasinglulu${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 1703*91f16700Schasinglulu $(eval ${CHECK_FWU_FIP_CMD}) 1704*91f16700Schasinglulu ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1705*91f16700Schasinglulu ${Q}${FIPTOOL} info $@ 1706*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1707*91f16700Schasinglulu @echo "Built $@ successfully" 1708*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1709*91f16700Schasinglulu 1710*91f16700Schasinglulufiptool: ${FIPTOOL} 1711*91f16700Schasinglulufip: ${BUILD_PLAT}/${FIP_NAME} 1712*91f16700Schasinglulufwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 1713*91f16700Schasinglulu 1714*91f16700Schasinglulu${FIPTOOL}: FORCE 1715*91f16700Schasingluluifdef UNIX_MK 1716*91f16700Schasinglulu ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all 1717*91f16700Schasingluluelse 1718*91f16700Schasinglulu# Clear the MAKEFLAGS as we do not want 1719*91f16700Schasinglulu# to pass the gnumake flags to nmake. 1720*91f16700Schasinglulu ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) 1721*91f16700Schasingluluendif #(UNIX_MK) 1722*91f16700Schasinglulu 1723*91f16700Schasingluluromlib.bin: libraries FORCE 1724*91f16700Schasinglulu ${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 1725*91f16700Schasinglulu 1726*91f16700Schasinglulumemmap: all 1727*91f16700Schasingluluifdef UNIX_MK 1728*91f16700Schasinglulu ${Q}PYTHONPATH=${CURDIR}/tools/memory \ 1729*91f16700Schasinglulu ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} 1730*91f16700Schasingluluelse 1731*91f16700Schasinglulu ${Q}set PYTHONPATH=${CURDIR}/tools/memory && \ 1732*91f16700Schasinglulu ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} 1733*91f16700Schasingluluendif 1734*91f16700Schasinglulu 1735*91f16700Schasingluludoc: 1736*91f16700Schasinglulu @echo " BUILD DOCUMENTATION" 1737*91f16700Schasinglulu ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 1738*91f16700Schasinglulu 1739*91f16700Schasingluluenctool: ${ENCTOOL} 1740*91f16700Schasinglulu 1741*91f16700Schasinglulu${ENCTOOL}: FORCE 1742*91f16700Schasinglulu ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all 1743*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1744*91f16700Schasinglulu @echo "Built $@ successfully" 1745*91f16700Schasinglulu @${ECHO_BLANK_LINE} 1746*91f16700Schasinglulu 1747*91f16700Schasinglulucscope: 1748*91f16700Schasinglulu @echo " CSCOPE" 1749*91f16700Schasinglulu ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 1750*91f16700Schasinglulu ${Q}cscope -b -q -k 1751*91f16700Schasinglulu 1752*91f16700Schasingluluhelp: 1753*91f16700Schasinglulu @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 1754*91f16700Schasinglulu @echo "" 1755*91f16700Schasinglulu @echo "PLAT is used to specify which platform you wish to build." 1756*91f16700Schasinglulu @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 1757*91f16700Schasinglulu @echo "" 1758*91f16700Schasinglulu @echo "platform = ${PLATFORM_LIST}" 1759*91f16700Schasinglulu @echo "" 1760*91f16700Schasinglulu @echo "Please refer to the User Guide for a list of all supported options." 1761*91f16700Schasinglulu @echo "Note that the build system doesn't track dependencies for build " 1762*91f16700Schasinglulu @echo "options. Therefore, if any of the build options are changed " 1763*91f16700Schasinglulu @echo "from a previous build, a clean build must be performed." 1764*91f16700Schasinglulu @echo "" 1765*91f16700Schasinglulu @echo "Supported Targets:" 1766*91f16700Schasinglulu @echo " all Build all individual bootloader binaries" 1767*91f16700Schasinglulu @echo " bl1 Build the BL1 binary" 1768*91f16700Schasinglulu @echo " bl2 Build the BL2 binary" 1769*91f16700Schasinglulu @echo " bl2u Build the BL2U binary" 1770*91f16700Schasinglulu @echo " bl31 Build the BL31 binary" 1771*91f16700Schasinglulu @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 1772*91f16700Schasinglulu @echo " this builds secure payload specified by AARCH32_SP" 1773*91f16700Schasinglulu @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 1774*91f16700Schasinglulu @echo " fip Build the Firmware Image Package (FIP)" 1775*91f16700Schasinglulu @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 1776*91f16700Schasinglulu @echo " checkcodebase Check the coding style of the entire source tree" 1777*91f16700Schasinglulu @echo " checkpatch Check the coding style on changes in the current" 1778*91f16700Schasinglulu @echo " branch against BASE_COMMIT (default origin/master)" 1779*91f16700Schasinglulu @echo " clean Clean the build for the selected platform" 1780*91f16700Schasinglulu @echo " cscope Generate cscope index" 1781*91f16700Schasinglulu @echo " distclean Remove all build artifacts for all platforms" 1782*91f16700Schasinglulu @echo " certtool Build the Certificate generation tool" 1783*91f16700Schasinglulu @echo " enctool Build the Firmware encryption tool" 1784*91f16700Schasinglulu @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1785*91f16700Schasinglulu @echo " sp Build the Secure Partition Packages" 1786*91f16700Schasinglulu @echo " sptool Build the Secure Partition Package creation tool" 1787*91f16700Schasinglulu @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1788*91f16700Schasinglulu @echo " memmap Print the memory map of the built binaries" 1789*91f16700Schasinglulu @echo " doc Build html based documentation using Sphinx tool" 1790*91f16700Schasinglulu @echo "" 1791*91f16700Schasinglulu @echo "Note: most build targets require PLAT to be set to a specific platform." 1792*91f16700Schasinglulu @echo "" 1793*91f16700Schasinglulu @echo "example: build all targets for the FVP platform:" 1794*91f16700Schasinglulu @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1795*91f16700Schasinglulu 1796*91f16700Schasinglulu.PHONY: FORCE 1797*91f16700SchasingluluFORCE:; 1798