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 DICE_PROTECTION_ENVIRONMENT \ 1149 DRTM_SUPPORT \ 1150 NS_TIMER_SWITCH \ 1151 OVERRIDE_LIBC \ 1152 PL011_GENERIC_UART \ 1153 PROGRAMMABLE_RESET_ADDRESS \ 1154 PSCI_EXTENDED_STATE_ID \ 1155 PSCI_OS_INIT_MODE \ 1156 RESET_TO_BL31 \ 1157 SAVE_KEYS \ 1158 SEPARATE_CODE_AND_RODATA \ 1159 SEPARATE_BL2_NOLOAD_REGION \ 1160 SEPARATE_NOBITS_REGION \ 1161 SPIN_ON_BL1_EXIT \ 1162 SPM_MM \ 1163 SPMC_AT_EL3 \ 1164 SPMC_AT_EL3_SEL0_SP \ 1165 SPMD_SPM_AT_SEL2 \ 1166 ENABLE_SPMD_LP \ 1167 TRANSFER_LIST \ 1168 TRUSTED_BOARD_BOOT \ 1169 USE_COHERENT_MEM \ 1170 USE_DEBUGFS \ 1171 ARM_IO_IN_DTB \ 1172 SDEI_IN_FCONF \ 1173 SEC_INT_DESC_IN_FCONF \ 1174 USE_ROMLIB \ 1175 USE_TBBR_DEFS \ 1176 WARMBOOT_ENABLE_DCACHE_EARLY \ 1177 RESET_TO_BL2 \ 1178 BL2_IN_XIP_MEM \ 1179 BL2_INV_DCACHE \ 1180 USE_SPINLOCK_CAS \ 1181 ENCRYPT_BL31 \ 1182 ENCRYPT_BL32 \ 1183 ERRATA_SPECULATIVE_AT \ 1184 RAS_TRAP_NS_ERR_REC_ACCESS \ 1185 COT_DESC_IN_DTB \ 1186 USE_SP804_TIMER \ 1187 PSA_FWU_SUPPORT \ 1188 PSA_FWU_METADATA_FW_STORE_DESC \ 1189 ENABLE_MPMM \ 1190 ENABLE_MPMM_FCONF \ 1191 FEATURE_DETECTION \ 1192 TRNG_SUPPORT \ 1193 ERRATA_ABI_SUPPORT \ 1194 ERRATA_NON_ARM_INTERCONNECT \ 1195 CONDITIONAL_CMO \ 1196 PSA_CRYPTO \ 1197 ENABLE_CONSOLE_GETC \ 1198 INIT_UNUSED_NS_EL2 \ 1199 PLATFORM_REPORT_CTX_MEM_USE \ 1200))) 1201 1202# Numeric_Flags 1203$(eval $(call assert_numerics,\ 1204 $(sort \ 1205 ARM_ARCH_MAJOR \ 1206 ARM_ARCH_MINOR \ 1207 BRANCH_PROTECTION \ 1208 CTX_INCLUDE_PAUTH_REGS \ 1209 CTX_INCLUDE_NEVE_REGS \ 1210 CRYPTO_SUPPORT \ 1211 DISABLE_MTPMU \ 1212 ENABLE_BRBE_FOR_NS \ 1213 ENABLE_TRBE_FOR_NS \ 1214 ENABLE_BTI \ 1215 ENABLE_PAUTH \ 1216 ENABLE_FEAT_AMU \ 1217 ENABLE_FEAT_AMUv1p1 \ 1218 ENABLE_FEAT_CSV2_2 \ 1219 ENABLE_FEAT_CSV2_3 \ 1220 ENABLE_FEAT_DIT \ 1221 ENABLE_FEAT_ECV \ 1222 ENABLE_FEAT_FGT \ 1223 ENABLE_FEAT_HCX \ 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_MPAM \ 1238 ENABLE_RME \ 1239 ENABLE_SPE_FOR_NS \ 1240 ENABLE_SYS_REG_TRACE_FOR_NS \ 1241 ENABLE_SME_FOR_NS \ 1242 ENABLE_SME2_FOR_NS \ 1243 ENABLE_SVE_FOR_NS \ 1244 ENABLE_TRF_FOR_NS \ 1245 FW_ENC_STATUS \ 1246 NR_OF_FW_BANKS \ 1247 NR_OF_IMAGES_IN_FW_BANK \ 1248 TWED_DELAY \ 1249 ENABLE_FEAT_TWED \ 1250 SVE_VECTOR_LEN \ 1251 IMPDEF_SYSREG_TRAP \ 1252))) 1253 1254ifdef KEY_SIZE 1255 $(eval $(call assert_numeric,KEY_SIZE)) 1256endif 1257 1258ifeq ($(filter $(SANITIZE_UB), on off trap),) 1259 $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 1260endif 1261 1262################################################################################ 1263# Add definitions to the cpp preprocessor based on the current build options. 1264# This is done after including the platform specific makefile to allow the 1265# platform to overwrite the default options 1266################################################################################ 1267 1268$(eval $(call add_defines,\ 1269 $(sort \ 1270 ALLOW_RO_XLAT_TABLES \ 1271 ARM_ARCH_MAJOR \ 1272 ARM_ARCH_MINOR \ 1273 BL2_ENABLE_SP_LOAD \ 1274 COLD_BOOT_SINGLE_CPU \ 1275 CTX_INCLUDE_AARCH32_REGS \ 1276 CTX_INCLUDE_FPREGS \ 1277 CTX_INCLUDE_PAUTH_REGS \ 1278 CTX_INCLUDE_MPAM_REGS \ 1279 EL3_EXCEPTION_HANDLING \ 1280 CTX_INCLUDE_EL2_REGS \ 1281 CTX_INCLUDE_NEVE_REGS \ 1282 DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 1283 DISABLE_MTPMU \ 1284 ENABLE_FEAT_AMU \ 1285 ENABLE_AMU_AUXILIARY_COUNTERS \ 1286 ENABLE_AMU_FCONF \ 1287 AMU_RESTRICT_COUNTERS \ 1288 ENABLE_ASSERTIONS \ 1289 ENABLE_BTI \ 1290 ENABLE_FEAT_MPAM \ 1291 ENABLE_PAUTH \ 1292 ENABLE_PIE \ 1293 ENABLE_PMF \ 1294 ENABLE_PSCI_STAT \ 1295 ENABLE_RME \ 1296 ENABLE_RUNTIME_INSTRUMENTATION \ 1297 ENABLE_SME_FOR_NS \ 1298 ENABLE_SME2_FOR_NS \ 1299 ENABLE_SME_FOR_SWD \ 1300 ENABLE_SPE_FOR_NS \ 1301 ENABLE_SVE_FOR_NS \ 1302 ENABLE_SVE_FOR_SWD \ 1303 ENABLE_FEAT_RAS \ 1304 FFH_SUPPORT \ 1305 ENCRYPT_BL31 \ 1306 ENCRYPT_BL32 \ 1307 ERROR_DEPRECATED \ 1308 FAULT_INJECTION_SUPPORT \ 1309 GICV2_G0_FOR_EL3 \ 1310 HANDLE_EA_EL3_FIRST_NS \ 1311 HW_ASSISTED_COHERENCY \ 1312 LOG_LEVEL \ 1313 MEASURED_BOOT \ 1314 DICE_PROTECTION_ENVIRONMENT \ 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_MTE2 \ 1386 FEATURE_DETECTION \ 1387 TWED_DELAY \ 1388 ENABLE_FEAT_TWED \ 1389 CONDITIONAL_CMO \ 1390 IMPDEF_SYSREG_TRAP \ 1391 SVE_VECTOR_LEN \ 1392 ENABLE_SPMD_LP \ 1393 PSA_CRYPTO \ 1394 ENABLE_CONSOLE_GETC \ 1395 INIT_UNUSED_NS_EL2 \ 1396 PLATFORM_REPORT_CTX_MEM_USE \ 1397))) 1398 1399ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) 1400ifeq (${DEBUG}, 0) 1401 $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only") 1402 override PLATFORM_REPORT_CTX_MEM_USE := 0 1403endif 1404endif 1405 1406ifeq (${SANITIZE_UB},trap) 1407 $(eval $(call add_define,MONITOR_TRAPS)) 1408endif #(SANITIZE_UB) 1409 1410# Define the EL3_PAYLOAD_BASE flag only if it is provided. 1411ifdef EL3_PAYLOAD_BASE 1412 $(eval $(call add_define,EL3_PAYLOAD_BASE)) 1413else 1414# Define the PRELOADED_BL33_BASE flag only if it is provided and 1415# EL3_PAYLOAD_BASE is not defined, as it has priority. 1416 ifdef PRELOADED_BL33_BASE 1417 $(eval $(call add_define,PRELOADED_BL33_BASE)) 1418 endif 1419endif #(EL3_PAYLOAD_BASE) 1420 1421# Define the DYN_DISABLE_AUTH flag only if set. 1422ifeq (${DYN_DISABLE_AUTH},1) 1423 $(eval $(call add_define,DYN_DISABLE_AUTH)) 1424endif 1425 1426ifeq ($($(ARCH)-ld-id),arm-link) 1427 $(eval $(call add_define,USE_ARM_LINK)) 1428endif 1429 1430# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1431ifeq (${SPD},spmd) 1432ifdef SP_LAYOUT_FILE 1433 -include $(BUILD_PLAT)/sp_gen.mk 1434 FIP_DEPS += sp 1435 CRT_DEPS += sp 1436 NEED_SP_PKG := yes 1437else 1438 ifeq (${SPMD_SPM_AT_SEL2},1) 1439 $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1440 endif 1441endif #(SP_LAYOUT_FILE) 1442endif #(SPD) 1443 1444################################################################################ 1445# Build targets 1446################################################################################ 1447 1448.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 1449.SUFFIXES: 1450 1451all: msg_start 1452 1453msg_start: 1454 @echo "Building ${PLAT}" 1455 1456ifeq (${ERROR_DEPRECATED},0) 1457# Check if deprecated declarations and cpp warnings should be treated as error or not. 1458ifneq ($(filter %-clang,$($(ARCH)-cc-id)),) 1459 CPPFLAGS += -Wno-error=deprecated-declarations 1460else 1461 CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 1462endif 1463endif #(!ERROR_DEPRECATED) 1464 1465$(eval $(call MAKE_LIB_DIRS)) 1466$(eval $(call MAKE_LIB,c)) 1467 1468# Expand build macros for the different images 1469ifeq (${NEED_BL1},yes) 1470BL1_SOURCES := $(sort ${BL1_SOURCES}) 1471$(eval $(call MAKE_BL,bl1)) 1472endif #(NEED_BL1) 1473 1474ifeq (${NEED_BL2},yes) 1475 1476ifeq (${RESET_TO_BL2}, 0) 1477FIP_BL2_ARGS := tb-fw 1478endif 1479 1480BL2_SOURCES := $(sort ${BL2_SOURCES}) 1481 1482$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1483 $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 1484 1485endif #(NEED_BL2) 1486 1487ifeq (${NEED_SCP_BL2},yes) 1488$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 1489endif #(NEED_SCP_BL2) 1490 1491ifeq (${NEED_BL31},yes) 1492BL31_SOURCES += ${SPD_SOURCES} 1493# Sort BL31 source files to remove duplicates 1494BL31_SOURCES := $(sort ${BL31_SOURCES}) 1495ifneq (${DECRYPTION_SUPPORT},none) 1496$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1497 $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1498else 1499$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1500 $(eval $(call MAKE_BL,bl31,soc-fw))) 1501endif #(DECRYPTION_SUPPORT) 1502endif #(NEED_BL31) 1503 1504# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1505# build system will call TOOL_ADD_IMG to print a warning message and abort the 1506# process. Note that the dependency on BL32 applies to the FIP only. 1507ifeq (${NEED_BL32},yes) 1508# Sort BL32 source files to remove duplicates 1509BL32_SOURCES := $(sort ${BL32_SOURCES}) 1510BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 1511 1512ifneq (${DECRYPTION_SUPPORT},none) 1513$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1514 $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1515else 1516$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 1517 $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 1518endif #(DECRYPTION_SUPPORT) 1519endif #(NEED_BL32) 1520 1521# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 1522# needs to be built from RMM_SOURCES. 1523ifeq (${NEED_RMM},yes) 1524# Sort RMM source files to remove duplicates 1525RMM_SOURCES := $(sort ${RMM_SOURCES}) 1526BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 1527 1528$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 1529 $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 1530endif #(NEED_RMM) 1531 1532# Add the BL33 image if required by the platform 1533ifeq (${NEED_BL33},yes) 1534$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1535endif #(NEED_BL33) 1536 1537ifeq (${NEED_BL2U},yes) 1538$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1539 $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 1540endif #(NEED_BL2U) 1541 1542# Expand build macros for the different images 1543ifeq (${NEED_FDT},yes) 1544 $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 1545endif #(NEED_FDT) 1546 1547# Add Secure Partition packages 1548ifeq (${NEED_SP_PKG},yes) 1549$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 1550 @${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} 1551sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1552 @${ECHO_BLANK_LINE} 1553 @echo "Built SP Images successfully" 1554 @${ECHO_BLANK_LINE} 1555endif #(NEED_SP_PKG) 1556 1557locate-checkpatch: 1558ifndef CHECKPATCH 1559 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1560else 1561ifeq (,$(wildcard ${CHECKPATCH})) 1562 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1563endif 1564endif #(CHECKPATCH) 1565 1566clean: 1567 @echo " CLEAN" 1568 $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 1569ifdef UNIX_MK 1570 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 1571else 1572# Clear the MAKEFLAGS as we do not want 1573# to pass the gnumake flags to nmake. 1574 ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean 1575endif #(UNIX_MK) 1576 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1577 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 1578 ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1579 1580realclean distclean: 1581 @echo " REALCLEAN" 1582 $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1583 $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 1584ifdef UNIX_MK 1585 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 1586else 1587# Clear the MAKEFLAGS as we do not want 1588# to pass the gnumake flags to nmake. 1589 ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean 1590endif #(UNIX_MK) 1591 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean 1592 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 1593 ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1594 1595checkcodebase: locate-checkpatch 1596 @echo " CHECKING STYLE" 1597 @if test -d .git ; then \ 1598 git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 1599 while read GIT_FILE ; \ 1600 do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 1601 done ; \ 1602 else \ 1603 find . -type f -not -iwholename "*.git*" \ 1604 -not -iwholename "*build*" \ 1605 -not -iwholename "*libfdt*" \ 1606 -not -iwholename "*libc*" \ 1607 -not -iwholename "*docs*" \ 1608 -not -iwholename "*.rst" \ 1609 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 1610 fi 1611 1612checkpatch: locate-checkpatch 1613 @echo " CHECKING STYLE" 1614 @if test -n "${CHECKPATCH_OPTS}"; then \ 1615 echo " with ${CHECKPATCH_OPTS} option(s)"; \ 1616 fi 1617 ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 1618 for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 1619 do \ 1620 printf "\n[*] Checking style of '$$commit'\n\n"; \ 1621 git log --format=email "$$commit~..$$commit" \ 1622 -- ${CHECK_PATHS} | \ 1623 ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 1624 git diff --format=email "$$commit~..$$commit" \ 1625 -- ${CHECK_PATHS} | \ 1626 ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 1627 done 1628 1629certtool: ${CRTTOOL} 1630 1631${CRTTOOL}: FORCE 1632 ${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 1633 @${ECHO_BLANK_LINE} 1634 @echo "Built $@ successfully" 1635 @${ECHO_BLANK_LINE} 1636 1637ifneq (${GENERATE_COT},0) 1638certificates: ${CRT_DEPS} ${CRTTOOL} 1639 ${Q}${CRTTOOL} ${CRT_ARGS} 1640 @${ECHO_BLANK_LINE} 1641 @echo "Built $@ successfully" 1642 @echo "Certificates can be found in ${BUILD_PLAT}" 1643 @${ECHO_BLANK_LINE} 1644endif #(GENERATE_COT) 1645 1646${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 1647 $(eval ${CHECK_FIP_CMD}) 1648 ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1649 ${Q}${FIPTOOL} info $@ 1650 @${ECHO_BLANK_LINE} 1651 @echo "Built $@ successfully" 1652 @${ECHO_BLANK_LINE} 1653 1654ifneq (${GENERATE_COT},0) 1655fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 1656 ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1657 @${ECHO_BLANK_LINE} 1658 @echo "Built $@ successfully" 1659 @echo "FWU certificates can be found in ${BUILD_PLAT}" 1660 @${ECHO_BLANK_LINE} 1661endif #(GENERATE_COT) 1662 1663${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 1664 $(eval ${CHECK_FWU_FIP_CMD}) 1665 ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1666 ${Q}${FIPTOOL} info $@ 1667 @${ECHO_BLANK_LINE} 1668 @echo "Built $@ successfully" 1669 @${ECHO_BLANK_LINE} 1670 1671fiptool: ${FIPTOOL} 1672fip: ${BUILD_PLAT}/${FIP_NAME} 1673fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 1674 1675${FIPTOOL}: FORCE 1676ifdef UNIX_MK 1677 ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all 1678else 1679# Clear the MAKEFLAGS as we do not want 1680# to pass the gnumake flags to nmake. 1681 ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) 1682endif #(UNIX_MK) 1683 1684romlib.bin: libraries FORCE 1685 ${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 1686 1687memmap: all 1688ifdef UNIX_MK 1689 ${Q}PYTHONPATH=${CURDIR}/tools/memory \ 1690 ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} 1691else 1692 ${Q}set PYTHONPATH=${CURDIR}/tools/memory && \ 1693 ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} 1694endif 1695 1696doc: 1697 @echo " BUILD DOCUMENTATION" 1698 ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 1699 1700enctool: ${ENCTOOL} 1701 1702${ENCTOOL}: FORCE 1703 ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all 1704 @${ECHO_BLANK_LINE} 1705 @echo "Built $@ successfully" 1706 @${ECHO_BLANK_LINE} 1707 1708cscope: 1709 @echo " CSCOPE" 1710 ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 1711 ${Q}cscope -b -q -k 1712 1713help: 1714 @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 1715 @echo "" 1716 @echo "PLAT is used to specify which platform you wish to build." 1717 @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 1718 @echo "" 1719 @echo "platform = ${PLATFORM_LIST}" 1720 @echo "" 1721 @echo "Please refer to the User Guide for a list of all supported options." 1722 @echo "Note that the build system doesn't track dependencies for build " 1723 @echo "options. Therefore, if any of the build options are changed " 1724 @echo "from a previous build, a clean build must be performed." 1725 @echo "" 1726 @echo "Supported Targets:" 1727 @echo " all Build all individual bootloader binaries" 1728 @echo " bl1 Build the BL1 binary" 1729 @echo " bl2 Build the BL2 binary" 1730 @echo " bl2u Build the BL2U binary" 1731 @echo " bl31 Build the BL31 binary" 1732 @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 1733 @echo " this builds secure payload specified by AARCH32_SP" 1734 @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 1735 @echo " fip Build the Firmware Image Package (FIP)" 1736 @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 1737 @echo " checkcodebase Check the coding style of the entire source tree" 1738 @echo " checkpatch Check the coding style on changes in the current" 1739 @echo " branch against BASE_COMMIT (default origin/master)" 1740 @echo " clean Clean the build for the selected platform" 1741 @echo " cscope Generate cscope index" 1742 @echo " distclean Remove all build artifacts for all platforms" 1743 @echo " certtool Build the Certificate generation tool" 1744 @echo " enctool Build the Firmware encryption tool" 1745 @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1746 @echo " sp Build the Secure Partition Packages" 1747 @echo " sptool Build the Secure Partition Package creation tool" 1748 @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1749 @echo " memmap Print the memory map of the built binaries" 1750 @echo " doc Build html based documentation using Sphinx tool" 1751 @echo "" 1752 @echo "Note: most build targets require PLAT to be set to a specific platform." 1753 @echo "" 1754 @echo "example: build all targets for the FVP platform:" 1755 @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1756 1757.PHONY: FORCE 1758FORCE:; 1759