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