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