1# 2# Copyright (c) 2013-2026, 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 := 14 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-rules.mk 27include ${MAKE_HELPERS_DIRECTORY}common.mk 28 29MBEDTLS_DIR := contrib/mbed-tls 30 31################################################################################ 32# Default values for build configurations, and their dependencies 33################################################################################ 34 35include ${MAKE_HELPERS_DIRECTORY}defaults.mk 36# Include the CPU specific operations makefile, which provides default 37# values for all CPU errata workarounds and CPU specific optimisations. 38# This can be overridden by the platform. 39include lib/cpus/cpu-ops.mk 40 41PLAT := ${DEFAULT_PLAT} 42include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 43 44# To be able to set platform specific defaults 45ifneq ($(PLAT_DEFAULTS_MAKEFILE_FULL),) 46include ${PLAT_DEFAULTS_MAKEFILE_FULL} 47endif 48 49################################################################################ 50# Configure the toolchains used to build TF-A and its tools 51################################################################################ 52 53include ${MAKE_HELPERS_DIRECTORY}toolchain.mk 54 55# Assertions enabled for DEBUG builds by default 56ENABLE_ASSERTIONS := ${DEBUG} 57ENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 58 59################################################################################ 60# Checkpatch script options 61################################################################################ 62 63CHECKCODE_ARGS := --no-patch 64# Do not check the coding style on imported library files or documentation files 65INC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 66 include/drivers/arm, \ 67 $(wildcard include/drivers/*))) 68INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 69 lib/libfdt \ 70 include/lib/libc, \ 71 $(wildcard include/lib/*))) 72INC_DIRS_TO_CHECK := $(sort $(filter-out \ 73 include/lib \ 74 include/drivers, \ 75 $(wildcard include/*))) 76LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 77 lib/compiler-rt \ 78 lib/libfdt% \ 79 lib/libc, \ 80 lib/zlib \ 81 $(wildcard lib/*))) 82ROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 83 lib \ 84 include \ 85 docs \ 86 %.rst, \ 87 $(wildcard *))) 88CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 89 ${INC_DIRS_TO_CHECK} \ 90 ${INC_LIB_DIRS_TO_CHECK} \ 91 ${LIB_DIRS_TO_CHECK} \ 92 ${INC_DRV_DIRS_TO_CHECK} \ 93 ${INC_ARM_DIRS_TO_CHECK} 94 95################################################################################ 96# Process build options 97################################################################################ 98 99ifeq ($(verbose),) 100 CHECKCODE_ARGS += --no-summary --terse 101endif 102 103################################################################################ 104# Auxiliary tools (fiptool, cert_create, etc) 105################################################################################ 106 107# Variables for use with Certificate Generation Tool 108CRTTOOLPATH ?= tools/cert_create 109CRTTOOL ?= ${BUILD_PLAT}/${CRTTOOLPATH}/cert_create$(.exe) 110 111# Variables for use with Firmware Encryption Tool 112ENCTOOLPATH ?= tools/encrypt_fw 113ENCTOOL ?= ${BUILD_PLAT}/${ENCTOOLPATH}/encrypt_fw$(.exe) 114 115# Variables for use with Firmware Image Package 116FIPTOOLPATH ?= tools/fiptool 117FIPTOOL ?= ${BUILD_PLAT}/${FIPTOOLPATH}/fiptool$(.exe) 118 119# Variables for use with sptool 120SPTOOLPATH ?= tools/sptool 121SPTOOL ?= ${SPTOOLPATH}/sptool.py 122SP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 123SP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts 124 125# Variables for use with sptool 126TLCTOOL ?= $(host-poetry) run tlc 127 128# Variables for use with ROMLIB 129ROMLIBPATH ?= lib/romlib 130 131# Variable for use with Python 132PYTHON ?= python3 133 134# Variables for use with documentation build using Sphinx tool 135DOCS_PATH ?= docs 136 137# Process Debug flag 138ifneq (${DEBUG}, 0) 139 BUILD_TYPE := debug 140 # Use LOG_LEVEL_INFO by default for debug builds 141 LOG_LEVEL := 40 142else 143 BUILD_TYPE := release 144 # Use LOG_LEVEL_NOTICE by default for release builds 145 LOG_LEVEL := 20 146 # Enable link-time optimization (AKA "inter-procedural optimization") 147 ifeq (${ARCH},aarch64) 148 ifeq ($($(ARCH)-ld-id),$($(ARCH)-cc-id)) 149 ENABLE_LTO := 1 150 endif 151 endif 152endif #(Debug) 153 154# Default build string (git branch and commit) 155ifeq (${BUILD_STRING},) 156 BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 157endif 158VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} 159 160# Setting W is quite verbose and most warnings will be pre-existing issues 161# outside of the contributor's control. Don't fail the build on them so warnings 162# can be seen and hopefully addressed 163ifdef W 164 ifneq (${W},0) 165 E ?= 0 166 endif 167endif 168 169################################################################################ 170# Common sources and include directories 171################################################################################ 172include lib/compiler-rt/compiler-rt.mk 173 174# Allow overriding the timestamp, for example for reproducible builds, or to 175# synchronize timestamps across multiple projects. 176# This must be set to a C string (including quotes where applicable). 177BUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__ 178 179DEFINES += -DBUILD_MESSAGE_TIMESTAMP='$(BUILD_MESSAGE_TIMESTAMP)' 180DEFINES += -DBUILD_MESSAGE_VERSION_STRING='"$(VERSION_STRING)"' 181DEFINES += -DBUILD_MESSAGE_VERSION='"$(VERSION)"' 182 183BL_COMMON_SOURCES += common/bl_common.c \ 184 common/tf_log.c \ 185 common/${ARCH}/debug.S \ 186 drivers/console/multi_console.c \ 187 lib/${ARCH}/cache_helpers.S \ 188 lib/${ARCH}/misc_helpers.S \ 189 lib/extensions/pmuv3/${ARCH}/pmuv3.c \ 190 lib/locks/exclusive/${ARCH}/spinlock.c \ 191 plat/common/plat_bl_common.c \ 192 plat/common/plat_log_common.c \ 193 plat/common/${ARCH}/plat_common.c \ 194 plat/common/${ARCH}/platform_helpers.S \ 195 ${COMPILER_RT_SRCS} 196 197ifeq ($($(ARCH)-cc-id),arm-clang) 198 BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 199endif 200 201ifeq (${SANITIZE_UB},on) 202 BL_COMMON_SOURCES += plat/common/ubsan.c 203endif 204 205INCLUDES += -Iinclude \ 206 -Iinclude/arch/${ARCH} \ 207 -Iinclude/lib/cpus/${ARCH} \ 208 -Iinclude/lib/el3_runtime/${ARCH} \ 209 ${PLAT_INCLUDES} \ 210 ${SPD_INCLUDES} 211 212include common/backtrace/backtrace.mk 213 214################################################################################ 215# Generic definitions 216################################################################################ 217 218ifeq (${BUILD_BASE},) 219 BUILD_BASE := ./build 220endif 221BUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 222 223SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 224 225# Platforms providing their own TBB makefile may override this value 226INCLUDE_TBBR_MK := 1 227 228################################################################################ 229# Include SPD Makefile if one has been specified 230################################################################################ 231 232ifneq (${SPD},none) 233 ifeq (${SPD},spmd) 234 # SPMD is located in std_svc directory 235 SPD_DIR := std_svc 236 237 ifeq ($(SPMD_SPM_AT_SEL2),1) 238 CTX_INCLUDE_EL2_REGS := 1 239 endif 240 241 ifneq ($(SP_LAYOUT_FILE),) 242 BL2_ENABLE_SP_LOAD := 1 243 endif 244 else 245 # All other SPDs in spd directory 246 SPD_DIR := spd 247 endif #(SPD) 248 249 # We expect to locate an spd.mk under the specified SPD directory 250 SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 251 252 ifeq (${SPD_MAKE},) 253 $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 254 endif 255 $(info Including ${SPD_MAKE}) 256 include ${SPD_MAKE} 257 258 # If there's BL32 companion for the chosen SPD, we expect that the SPD's 259 # Makefile would set NEED_BL32 to "yes". In this case, the build system 260 # supports two mutually exclusive options: 261 # * BL32 is built from source: then BL32_SOURCES must contain the list 262 # of source files to build BL32 263 # * BL32 is a prebuilt binary: then BL32 must point to the image file 264 # that will be included in the FIP 265 # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 266 # over the sources. 267endif #(SPD=none) 268 269################################################################################ 270# Include the platform specific Makefile after the SPD Makefile (the platform 271# makefile may use all previous definitions in this file) 272################################################################################ 273include ${PLAT_MAKEFILE_FULL} 274 275################################################################################ 276# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from 277# platform. 278################################################################################ 279 280include ${MAKE_HELPERS_DIRECTORY}arch_features.mk 281################################################################################ 282# Process BRANCH_PROTECTION value and set 283# Pointer Authentication and Branch Target Identification flags 284################################################################################ 285ifeq (${BRANCH_PROTECTION},0) 286 # Default value turns off all types of branch protection 287 BP_OPTION := none 288else ifneq (${ARCH},aarch64) 289 $(error BRANCH_PROTECTION requires AArch64) 290else ifeq (${BRANCH_PROTECTION},1) 291 # Enables all types of branch protection features 292 BP_OPTION := standard 293 ENABLE_BTI := 1 294 ENABLE_PAUTH := 1 295else ifeq (${BRANCH_PROTECTION},2) 296 # Return address signing to its standard level 297 BP_OPTION := pac-ret 298 ENABLE_PAUTH := 1 299else ifeq (${BRANCH_PROTECTION},3) 300 # Extend the signing to include leaf functions 301 BP_OPTION := pac-ret+leaf 302 ENABLE_PAUTH := 1 303else ifeq (${BRANCH_PROTECTION},4) 304 # Turn on branch target identification mechanism 305 BP_OPTION := bti 306 ENABLE_BTI := 1 307else ifeq (${BRANCH_PROTECTION},5) 308 # Turn on branch target identification mechanism 309 BP_OPTION := standard 310 ENABLE_BTI := 2 311 ENABLE_PAUTH := 2 312else 313 $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 314endif #(BRANCH_PROTECTION) 315 316ifneq ($(ENABLE_PAUTH),0) 317 CTX_INCLUDE_PAUTH_REGS := ${ENABLE_PAUTH} 318endif 319 320# Pointer Authentication sources 321ifneq (${ENABLE_PAUTH},0) 322# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 323# Pauth support. As it's not secure, it must be reimplemented for real platforms 324 BL_COMMON_SOURCES += lib/extensions/pauth/pauth.c 325endif 326 327################################################################################ 328# RME dependent flags configuration, Enable optional features for RME. 329################################################################################ 330# FEAT_RME 331ifeq (${ENABLE_RME},1) 332 # RMM relies on SMCCC_ARCH_FEATURE_AVAILABILITY to discover EL3 enablement 333 ARCH_FEATURE_AVAILABILITY := 1 334 335 # RME requires el2 context to be saved for now. 336 CTX_INCLUDE_EL2_REGS := 1 337 CTX_INCLUDE_AARCH32_REGS := 0 338 CTX_INCLUDE_PAUTH_REGS := 1 339 340 ifneq ($(ENABLE_FEAT_MPAM), 0) 341 CTX_INCLUDE_MPAM_REGS := 1 342 endif 343 # bitlocks are only useful with atomics 344 ifneq ($(RME_GPT_BITLOCK_BLOCK), 0) 345 USE_SPINLOCK_CAS := 1 346 endif 347 348 # RME enables CSV2_2 extension by default. 349 ENABLE_FEAT_CSV2_2 = 1 350endif #(FEAT_RME) 351 352################################################################################ 353# Include rmmd Makefile if RME is enabled 354################################################################################ 355ifneq (${ENABLE_RME},0) 356include services/std_svc/rmmd/rmmd.mk 357$(warning "RME is an experimental feature") 358endif 359 360################################################################################ 361# Make 128-Bit sysreg read/writes availabe when FEAT_D128 is enabled. 362################################################################################ 363ifneq (${ENABLE_FEAT_D128}, 0) 364 BL_COMMON_SOURCES += lib/extensions/sysreg128/sysreg128.S 365endif 366 367# This internal flag is common option which is set to 1 for scenarios 368# when the BL2 is running in EL3 level. This occurs in two scenarios - 369# 4 world system running BL2 at EL3 and two world system without BL1 running 370# BL2 in EL3 371 372ifneq ($(filter 1,${RESET_TO_BL2} ${ENABLE_RME}),) 373 BL2_RUNS_AT_EL3 := 1 374else 375 BL2_RUNS_AT_EL3 := 0 376endif 377 378# This internal flag is set to 1 when Firmware First handling of External aborts 379# is required by lowe ELs. Currently only NS requires this support. 380ifeq ($(HANDLE_EA_EL3_FIRST_NS),1) 381 FFH_SUPPORT := 1 382else 383 FFH_SUPPORT := 0 384endif 385 386ifneq ($(filter 1,${ERRATA_A53_1530924} ${ERRATA_A55_1530923} \ 387 ${ERRATA_A57_1319537} ${ERRATA_A65_1541130} ${ERRATA_A65AE_1638571} \ 388 ${ERRATA_A72_1319367} ${ERRATA_A76_1165522}),) 389ERRATA_SPECULATIVE_AT := 1 390else 391ERRATA_SPECULATIVE_AT := 0 392endif 393 394################################################################################ 395# Build `AARCH32_SP` as BL32 image for AArch32 396################################################################################ 397ifeq (${ARCH},aarch32) 398 NEED_BL32 := yes 399 400 ifneq (${AARCH32_SP},none) 401 # We expect to locate an sp.mk under the specified AARCH32_SP directory 402 AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 403 404 ifeq (${AARCH32_SP_MAKE},) 405 $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 406 endif 407 $(info Including ${AARCH32_SP_MAKE}) 408 include ${AARCH32_SP_MAKE} 409 endif 410endif #(ARCH=aarch32) 411 412################################################################################ 413# Include libc if not overridden 414################################################################################ 415ifeq (${OVERRIDE_LIBC},0) 416include lib/libc/libc.mk 417endif 418 419ifneq (${USE_GIC_DRIVER},0) 420include drivers/arm/gic/gic.mk 421endif 422 423################################################################################ 424# Check incompatible options and dependencies 425################################################################################ 426include ${MAKE_HELPERS_DIRECTORY}constraints.mk 427 428# The cert_create tool cannot generate certificates individually, so we use the 429# target 'certificates' to create them all 430ifneq (${GENERATE_COT},0) 431 FIP_DEPS += certificates 432 FWU_FIP_DEPS += fwu_certificates 433 BL2_FIP_DEPS += bl2_certificates 434endif 435 436ifneq (${DECRYPTION_SUPPORT},none) 437 ENC_ARGS += -f ${FW_ENC_STATUS} 438 ENC_ARGS += -k ${ENC_KEY} 439 ENC_ARGS += -n ${ENC_NONCE} 440 FIP_DEPS += enctool 441 FWU_FIP_DEPS += enctool 442 BL2_FIP_DEPS += enctool 443endif #(DECRYPTION_SUPPORT) 444 445################################################################################ 446# Process platform overrideable behaviour 447################################################################################ 448 449ifdef BL1_SOURCES 450 NEED_BL1 := yes 451endif #(BL1_SOURCES) 452 453ifdef BL2_SOURCES 454 NEED_BL2 := yes 455 456 # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 457 # Certificate generation tools. This flag can be overridden by the platform. 458 ifdef EL3_PAYLOAD_BASE 459 # If booting an EL3 payload there is no need for a BL33 image 460 # in the FIP file. 461 NEED_BL33 := no 462 else 463 ifdef PRELOADED_BL33_BASE 464 # If booting a BL33 preloaded image there is no need of 465 # another one in the FIP file. 466 NEED_BL33 := no 467 else 468 NEED_BL33 ?= yes 469 endif 470 endif 471endif #(BL2_SOURCES) 472 473ifdef BL2U_SOURCES 474 NEED_BL2U := yes 475endif #(BL2U_SOURCES) 476 477# If SCP_BL2 is given, we always want FIP to include it. 478ifdef SCP_BL2 479 NEED_SCP_BL2 := yes 480endif #(SCP_BL2) 481 482# For AArch32, BL31 is not currently supported. 483ifneq (${ARCH},aarch32) 484 ifdef BL31_SOURCES 485 # When booting an EL3 payload, there is no need to compile the BL31 486 # image nor put it in the FIP. 487 ifndef EL3_PAYLOAD_BASE 488 NEED_BL31 := yes 489 endif 490 endif 491endif #(ARCH=aarch64) 492 493# Process TBB related flags 494ifneq (${GENERATE_COT},0) 495 # Common cert_create options 496 ifneq (${CREATE_KEYS},0) 497 $(eval CRT_ARGS += -n) 498 $(eval FWU_CRT_ARGS += -n) 499 $(eval BL2_CRT_ARGS += -n) 500 ifneq (${SAVE_KEYS},0) 501 $(eval CRT_ARGS += -k) 502 $(eval FWU_CRT_ARGS += -k) 503 $(eval BL2_CRT_ARGS += -k) 504 endif 505 endif 506 # Include TBBR makefile (unless the platform indicates otherwise) 507 ifeq (${INCLUDE_TBBR_MK},1) 508 include make_helpers/tbbr/tbbr_tools.mk 509 endif 510endif #(GENERATE_COT) 511 512ifneq (${FIP_ALIGN},0) 513 FIP_ARGS += --align ${FIP_ALIGN} 514endif #(FIP_ALIGN) 515 516ifdef FDT_SOURCES 517 NEED_FDT := yes 518endif #(FDT_SOURCES) 519 520################################################################################ 521# Include libraries' Makefile that are used in all BL 522################################################################################ 523 524include lib/stack_protector/stack_protector.mk 525 526################################################################################ 527# Include BL specific makefiles 528################################################################################ 529 530ifeq (${NEED_BL1},yes) 531include bl1/bl1.mk 532endif 533 534ifeq (${NEED_BL2},yes) 535include bl2/bl2.mk 536endif 537 538ifeq (${NEED_BL2U},yes) 539include bl2u/bl2u.mk 540endif 541 542ifeq (${NEED_BL31},yes) 543include bl31/bl31.mk 544endif 545 546################################################################################ 547# Build options checks 548################################################################################ 549 550# Boolean_Flags 551$(eval $(call assert_booleans,\ 552 $(sort \ 553 ALLOW_RO_XLAT_TABLES \ 554 BL2_ENABLE_SP_LOAD \ 555 COLD_BOOT_SINGLE_CPU \ 556 $(CPU_FLAG_LIST) \ 557 CREATE_KEYS \ 558 CTX_INCLUDE_AARCH32_REGS \ 559 CTX_INCLUDE_FPREGS \ 560 CTX_INCLUDE_SVE_REGS \ 561 CTX_INCLUDE_EL2_REGS \ 562 CTX_INCLUDE_MPAM_REGS \ 563 DEBUG \ 564 DYN_DISABLE_AUTH \ 565 EL3_EXCEPTION_HANDLING \ 566 ENABLE_AMU_AUXILIARY_COUNTERS \ 567 AMU_RESTRICT_COUNTERS \ 568 ENABLE_ASSERTIONS \ 569 ENABLE_PIE \ 570 ENABLE_PMF \ 571 ENABLE_PSCI_STAT \ 572 ENABLE_RUNTIME_INSTRUMENTATION \ 573 ENABLE_SME_FOR_SWD \ 574 ENABLE_SVE_FOR_SWD \ 575 ENABLE_FEAT_GCIE \ 576 FFH_SUPPORT \ 577 ERROR_DEPRECATED \ 578 FAULT_INJECTION_SUPPORT \ 579 GENERATE_COT \ 580 GICV2_G0_FOR_EL3 \ 581 HANDLE_EA_EL3_FIRST_NS \ 582 HARDEN_SLS \ 583 HW_ASSISTED_COHERENCY \ 584 MEASURED_BOOT \ 585 DISCRETE_TPM \ 586 DICE_PROTECTION_ENVIRONMENT \ 587 RMMD_ENABLE_EL3_TOKEN_SIGN \ 588 RMMD_ENABLE_IDE_KEY_PROG \ 589 RMM_V1_COMPAT \ 590 DRTM_SUPPORT \ 591 NS_TIMER_SWITCH \ 592 OVERRIDE_LIBC \ 593 PL011_GENERIC_UART \ 594 PLAT_EXTRA_LD_SCRIPT \ 595 PROGRAMMABLE_RESET_ADDRESS \ 596 PSCI_EXTENDED_STATE_ID \ 597 PSCI_OS_INIT_MODE \ 598 ARCH_FEATURE_AVAILABILITY \ 599 RESET_TO_BL31 \ 600 SAVE_KEYS \ 601 SEPARATE_CODE_AND_RODATA \ 602 SEPARATE_BL2_NOLOAD_REGION \ 603 SEPARATE_NOBITS_REGION \ 604 SEPARATE_RWDATA_REGION \ 605 SEPARATE_SIMD_SECTION \ 606 SPIN_ON_BL1_EXIT \ 607 SPM_MM \ 608 SPMC_AT_EL3 \ 609 SPMC_AT_EL3_SEL0_SP \ 610 SPMD_SPM_AT_SEL2 \ 611 ENABLE_SPMD_LP \ 612 TRANSFER_LIST \ 613 TRUSTED_BOARD_BOOT \ 614 USE_COHERENT_MEM \ 615 USE_DEBUGFS \ 616 USE_KERNEL_DT_CONVENTION \ 617 ARM_IO_IN_DTB \ 618 SDEI_IN_FCONF \ 619 SEC_INT_DESC_IN_FCONF \ 620 USE_ROMLIB \ 621 USE_TBBR_DEFS \ 622 WARMBOOT_ENABLE_DCACHE_EARLY \ 623 RESET_TO_BL2 \ 624 BL2_IN_XIP_MEM \ 625 BL2_INV_DCACHE \ 626 ENCRYPT_BL31 \ 627 ENCRYPT_BL32 \ 628 ERRATA_SPECULATIVE_AT \ 629 ERRATA_SME_POWER_DOWN \ 630 RAS_TRAP_NS_ERR_REC_ACCESS \ 631 COT_DESC_IN_DTB \ 632 USE_SP804_TIMER \ 633 PSA_FWU_SUPPORT \ 634 PSA_FWU_METADATA_FW_STORE_DESC \ 635 ENABLE_MPMM \ 636 FEATURE_DETECTION \ 637 TRNG_SUPPORT \ 638 ENABLE_ERRATA_ALL \ 639 ERRATA_ABI_SUPPORT \ 640 ERRATA_NON_ARM_INTERCONNECT \ 641 CONDITIONAL_CMO \ 642 PSA_CRYPTO \ 643 ENABLE_CONSOLE_GETC \ 644 INIT_UNUSED_NS_EL2 \ 645 PLATFORM_REPORT_CTX_MEM_USE \ 646 EARLY_CONSOLE \ 647 PRESERVE_DSU_PMU_REGS \ 648 HOB_LIST \ 649 LFA_SUPPORT \ 650 SUPPORT_SP_LIVE_ACTIVATION \ 651))) 652 653# Numeric_Flags 654$(eval $(call assert_numerics,\ 655 $(sort \ 656 ARM_ARCH_MAJOR \ 657 ARM_ARCH_MINOR \ 658 BRANCH_PROTECTION \ 659 CTX_INCLUDE_PAUTH_REGS \ 660 CTX_INCLUDE_NEVE_REGS \ 661 DISABLE_MTPMU \ 662 ENABLE_BRBE_FOR_NS \ 663 ENABLE_TRBE_FOR_NS \ 664 ENABLE_BTI \ 665 ENABLE_PAUTH \ 666 ENABLE_FEAT_PAUTH_LR \ 667 ENABLE_FEAT_AIE \ 668 ENABLE_FEAT_AMU \ 669 ENABLE_FEAT_AMUv1p1 \ 670 ENABLE_FEAT_CLRBHB \ 671 ENABLE_FEAT_CPA2 \ 672 ENABLE_FEAT_CSV2_2 \ 673 ENABLE_FEAT_CSV2_3 \ 674 ENABLE_FEAT_CRYPTO \ 675 ENABLE_FEAT_CRYPTO_SHA3 \ 676 ENABLE_FEAT_DEBUGV8P9 \ 677 ENABLE_FEAT_DIT \ 678 ENABLE_FEAT_ECV \ 679 ENABLE_FEAT_EBEP \ 680 ENABLE_FEAT_FGT \ 681 ENABLE_FEAT_FGT2 \ 682 ENABLE_FEAT_HDBSS \ 683 ENABLE_FEAT_HACDBS \ 684 ENABLE_FEAT_STEP2 \ 685 ENABLE_FEAT_UINJ \ 686 ENABLE_FEAT_FGWTE3 \ 687 ENABLE_FEAT_FPMR \ 688 ENABLE_FEAT_HCX \ 689 ENABLE_FEAT_IDTE3 \ 690 ENABLE_FEAT_LS64_ACCDATA \ 691 ENABLE_FEAT_MEC \ 692 ENABLE_FEAT_MOPS \ 693 ENABLE_FEAT_MORELLO \ 694 ENABLE_FEAT_MTE2 \ 695 ENABLE_FEAT_PAN \ 696 ENABLE_FEAT_PFAR \ 697 ENABLE_FEAT_RNG \ 698 ENABLE_FEAT_RNG_TRAP \ 699 ENABLE_FEAT_SEL2 \ 700 ENABLE_FEAT_TCR2 \ 701 ENABLE_FEAT_THE \ 702 ENABLE_FEAT_SB \ 703 ENABLE_FEAT_S2PIE \ 704 ENABLE_FEAT_S1PIE \ 705 ENABLE_FEAT_S2POE \ 706 ENABLE_FEAT_S1POE \ 707 ENABLE_FEAT_SCTLR2 \ 708 ENABLE_FEAT_D128 \ 709 ENABLE_FEAT_RME_GDI \ 710 ENABLE_FEAT_GCS \ 711 ENABLE_FEAT_VHE \ 712 ENABLE_FEAT_MPAM \ 713 ENABLE_FEAT_MPAM_PE_BW_CTRL \ 714 ENABLE_FEAT_RAS \ 715 ENABLE_RME \ 716 ENABLE_SPE_FOR_NS \ 717 ENABLE_SYS_REG_TRACE_FOR_NS \ 718 ENABLE_SME_FOR_NS \ 719 ENABLE_SME2_FOR_NS \ 720 ENABLE_SVE_FOR_NS \ 721 ENABLE_TRF_FOR_NS \ 722 FW_ENC_STATUS \ 723 NR_OF_FW_BANKS \ 724 NR_OF_IMAGES_IN_FW_BANK \ 725 SPMC_AT_EL3_PARTITION_MAX_UUIDS \ 726 TWED_DELAY \ 727 ENABLE_FEAT_TWED \ 728 SVE_VECTOR_LEN \ 729 USE_SPINLOCK_CAS \ 730 IMPDEF_SYSREG_TRAP \ 731 W \ 732))) 733 734ifdef KEY_SIZE 735 $(eval $(call assert_numeric,KEY_SIZE)) 736endif 737 738ifeq ($(filter $(SANITIZE_UB), on off trap),) 739 $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 740endif 741 742################################################################################ 743# Add definitions to the cpp preprocessor based on the current build options. 744# This is done after including the platform specific makefile to allow the 745# platform to overwrite the default options 746################################################################################ 747 748$(eval $(call add_defines,\ 749 $(sort \ 750 ALLOW_RO_XLAT_TABLES \ 751 ARM_ARCH_MAJOR \ 752 ARM_ARCH_MINOR \ 753 BL2_ENABLE_SP_LOAD \ 754 COLD_BOOT_SINGLE_CPU \ 755 $(CPU_FLAG_LIST) \ 756 CTX_INCLUDE_AARCH32_REGS \ 757 CTX_INCLUDE_FPREGS \ 758 CTX_INCLUDE_SVE_REGS \ 759 CTX_INCLUDE_PAUTH_REGS \ 760 CTX_INCLUDE_MPAM_REGS \ 761 EL3_EXCEPTION_HANDLING \ 762 CTX_INCLUDE_EL2_REGS \ 763 CTX_INCLUDE_NEVE_REGS \ 764 DEBUG \ 765 DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 766 DISABLE_MTPMU \ 767 ENABLE_FEAT_AMU \ 768 ENABLE_AMU_AUXILIARY_COUNTERS \ 769 AMU_RESTRICT_COUNTERS \ 770 ENABLE_ASSERTIONS \ 771 ENABLE_BTI \ 772 ENABLE_FEAT_CRYPTO \ 773 ENABLE_FEAT_CRYPTO_SHA3 \ 774 ENABLE_FEAT_DEBUGV8P9 \ 775 ENABLE_FEAT_IDTE3 \ 776 ENABLE_FEAT_MPAM \ 777 ENABLE_FEAT_MPAM_PE_BW_CTRL \ 778 ENABLE_PAUTH \ 779 ENABLE_FEAT_PAUTH_LR \ 780 ENABLE_PIE \ 781 ENABLE_PMF \ 782 ENABLE_PSCI_STAT \ 783 ENABLE_RME \ 784 RMM_V1_COMPAT \ 785 RMMD_ENABLE_EL3_TOKEN_SIGN \ 786 RMMD_ENABLE_IDE_KEY_PROG \ 787 ENABLE_RUNTIME_INSTRUMENTATION \ 788 ENABLE_SME_FOR_NS \ 789 ENABLE_SME2_FOR_NS \ 790 ENABLE_SME_FOR_SWD \ 791 ENABLE_SPE_FOR_NS \ 792 ENABLE_SVE_FOR_NS \ 793 ENABLE_SVE_FOR_SWD \ 794 ENABLE_FEAT_RAS \ 795 FFH_SUPPORT \ 796 ENCRYPT_BL31 \ 797 ENCRYPT_BL32 \ 798 ERROR_DEPRECATED \ 799 FAULT_INJECTION_SUPPORT \ 800 GICV2_G0_FOR_EL3 \ 801 HANDLE_EA_EL3_FIRST_NS \ 802 HW_ASSISTED_COHERENCY \ 803 LOG_LEVEL \ 804 MEASURED_BOOT \ 805 DISCRETE_TPM \ 806 DICE_PROTECTION_ENVIRONMENT \ 807 DRTM_SUPPORT \ 808 NS_TIMER_SWITCH \ 809 PLATFORM_NODE_COUNT \ 810 PL011_GENERIC_UART \ 811 PLAT_EXTRA_LD_SCRIPT \ 812 PLAT_${PLAT} \ 813 PROGRAMMABLE_RESET_ADDRESS \ 814 PSCI_EXTENDED_STATE_ID \ 815 PSCI_OS_INIT_MODE \ 816 ARCH_FEATURE_AVAILABILITY \ 817 RESET_TO_BL31 \ 818 RME_GPT_BITLOCK_BLOCK \ 819 RME_GPT_MAX_BLOCK \ 820 SEPARATE_CODE_AND_RODATA \ 821 SEPARATE_BL2_FIP \ 822 SEPARATE_BL2_NOLOAD_REGION \ 823 SEPARATE_NOBITS_REGION \ 824 SEPARATE_RWDATA_REGION \ 825 SEPARATE_SIMD_SECTION \ 826 RECLAIM_INIT_CODE \ 827 SPD_${SPD} \ 828 SPIN_ON_BL1_EXIT \ 829 SPM_MM \ 830 SPMC_AT_EL3 \ 831 SPMC_AT_EL3_PARTITION_MAX_UUIDS \ 832 SPMC_AT_EL3_SEL0_SP \ 833 SPMD_SPM_AT_SEL2 \ 834 TRANSFER_LIST \ 835 TRUSTED_BOARD_BOOT \ 836 TRNG_SUPPORT \ 837 ERRATA_ABI_SUPPORT \ 838 ERRATA_NON_ARM_INTERCONNECT \ 839 USE_COHERENT_MEM \ 840 USE_DEBUGFS \ 841 ARM_IO_IN_DTB \ 842 SDEI_IN_FCONF \ 843 SEC_INT_DESC_IN_FCONF \ 844 USE_ROMLIB \ 845 USE_TBBR_DEFS \ 846 USE_KERNEL_DT_CONVENTION \ 847 WARMBOOT_ENABLE_DCACHE_EARLY \ 848 RESET_TO_BL2 \ 849 BL2_RUNS_AT_EL3 \ 850 BL2_IN_XIP_MEM \ 851 BL2_INV_DCACHE \ 852 USE_SPINLOCK_CAS \ 853 ERRATA_SPECULATIVE_AT \ 854 ERRATA_SME_POWER_DOWN \ 855 RAS_TRAP_NS_ERR_REC_ACCESS \ 856 COT_DESC_IN_DTB \ 857 USE_SP804_TIMER \ 858 ENABLE_FEAT_RNG \ 859 ENABLE_FEAT_RNG_TRAP \ 860 ENABLE_FEAT_SB \ 861 ENABLE_FEAT_DIT \ 862 NR_OF_FW_BANKS \ 863 NR_OF_IMAGES_IN_FW_BANK \ 864 PSA_FWU_SUPPORT \ 865 PSA_FWU_METADATA_FW_STORE_DESC \ 866 ENABLE_BRBE_FOR_NS \ 867 ENABLE_TRBE_FOR_NS \ 868 ENABLE_SYS_REG_TRACE_FOR_NS \ 869 ENABLE_TRF_FOR_NS \ 870 ENABLE_FEAT_AIE \ 871 ENABLE_FEAT_HCX \ 872 ENABLE_MPMM \ 873 ENABLE_FEAT_FGT \ 874 ENABLE_FEAT_FGT2 \ 875 ENABLE_FEAT_UINJ \ 876 ENABLE_FEAT_FGWTE3 \ 877 ENABLE_FEAT_FPMR \ 878 ENABLE_FEAT_ECV \ 879 ENABLE_FEAT_EBEP \ 880 ENABLE_FEAT_AMUv1p1 \ 881 ENABLE_FEAT_SEL2 \ 882 ENABLE_FEAT_VHE \ 883 ENABLE_FEAT_CLRBHB \ 884 ENABLE_FEAT_CPA2 \ 885 ENABLE_FEAT_CSV2_2 \ 886 ENABLE_FEAT_CSV2_3 \ 887 ENABLE_FEAT_LS64_ACCDATA \ 888 ENABLE_FEAT_MEC \ 889 ENABLE_FEAT_MORELLO \ 890 ENABLE_FEAT_PAN \ 891 ENABLE_FEAT_TCR2 \ 892 ENABLE_FEAT_THE \ 893 ENABLE_FEAT_S2PIE \ 894 ENABLE_FEAT_S1PIE \ 895 ENABLE_FEAT_S2POE \ 896 ENABLE_FEAT_S1POE \ 897 ENABLE_FEAT_SCTLR2 \ 898 ENABLE_FEAT_STEP2 \ 899 ENABLE_FEAT_D128 \ 900 ENABLE_FEAT_RME_GDI \ 901 ENABLE_FEAT_GCS \ 902 ENABLE_FEAT_HDBSS \ 903 ENABLE_FEAT_HACDBS \ 904 ENABLE_FEAT_MOPS \ 905 ENABLE_FEAT_GCIE \ 906 ENABLE_FEAT_MTE2 \ 907 ENABLE_FEAT_PFAR \ 908 FEATURE_DETECTION \ 909 TWED_DELAY \ 910 ENABLE_FEAT_TWED \ 911 CONDITIONAL_CMO \ 912 IMPDEF_SYSREG_TRAP \ 913 SVE_VECTOR_LEN \ 914 ENABLE_SPMD_LP \ 915 PSA_CRYPTO \ 916 ENABLE_CONSOLE_GETC \ 917 INIT_UNUSED_NS_EL2 \ 918 PLATFORM_REPORT_CTX_MEM_USE \ 919 EARLY_CONSOLE \ 920 PRESERVE_DSU_PMU_REGS \ 921 HOB_LIST \ 922 HW_CONFIG_BASE \ 923 LFA_SUPPORT \ 924 SUPPORT_SP_LIVE_ACTIVATION \ 925))) 926 927ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) 928ifeq (${DEBUG}, 0) 929 $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only") 930 override PLATFORM_REPORT_CTX_MEM_USE := 0 931endif 932endif 933 934ifeq (${SANITIZE_UB},trap) 935 $(eval $(call add_define,MONITOR_TRAPS)) 936endif #(SANITIZE_UB) 937 938# Define the EL3_PAYLOAD_BASE flag only if it is provided. 939ifdef EL3_PAYLOAD_BASE 940 $(eval $(call add_define,EL3_PAYLOAD_BASE)) 941else 942# Define the PRELOADED_BL33_BASE flag only if it is provided and 943# EL3_PAYLOAD_BASE is not defined, as it has priority. 944 ifdef PRELOADED_BL33_BASE 945 $(eval $(call add_define,PRELOADED_BL33_BASE)) 946 endif 947endif #(EL3_PAYLOAD_BASE) 948 949# Define the DYN_DISABLE_AUTH flag only if set. 950ifeq (${DYN_DISABLE_AUTH},1) 951 $(eval $(call add_define,DYN_DISABLE_AUTH)) 952endif 953 954ifeq ($($(ARCH)-ld-id),arm-link) 955 $(eval $(call add_define,USE_ARM_LINK)) 956endif 957 958# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 959ifeq (${SPD},spmd) 960ifdef SP_LAYOUT_FILE 961 -include $(BUILD_PLAT)/sp_gen.mk 962 FIP_DEPS += sp 963 CRT_DEPS += sp 964 NEED_SP_PKG := yes 965else 966 ifeq (${SPMD_SPM_AT_SEL2},1) 967 $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 968 endif 969endif #(SP_LAYOUT_FILE) 970endif #(SPD) 971 972################################################################################ 973# Configure the flags for the specified compiler and linker 974################################################################################ 975include ${MAKE_HELPERS_DIRECTORY}cflags.mk 976 977################################################################################ 978# Build targets 979################################################################################ 980 981.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp tl fwu_fip certtool dtbs memmap doc enctool 982 983all: msg_start 984 985msg_start: 986 $(s)echo "Building ${PLAT}" 987 988$(eval $(call MAKE_LIB,c)) 989 990# Expand build macros for the different images 991ifeq (${NEED_BL1},yes) 992BL1_SOURCES := $(sort ${BL1_SOURCES}) 993$(eval $(call MAKE_BL,bl1)) 994endif #(NEED_BL1) 995 996ifeq (${NEED_BL2},yes) 997 998ifeq (${RESET_TO_BL2}, 0) 999FIP_BL2_ARGS := tb-fw 1000endif 1001 1002BL2_SOURCES := $(sort ${BL2_SOURCES}) 1003 1004ifeq (${SEPARATE_BL2_FIP},1) 1005$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS},BL2_)), \ 1006 $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS},BL2_))) 1007else 1008$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})), \ 1009 $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 1010endif #(SEPARATE_BL2_FIP) 1011 1012endif #(NEED_BL2) 1013 1014ifeq (${NEED_SCP_BL2},yes) 1015$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 1016endif #(NEED_SCP_BL2) 1017 1018ifeq (${NEED_BL31},yes) 1019BL31_SOURCES += ${SPD_SOURCES} 1020# Sort BL31 source files to remove duplicates 1021BL31_SOURCES := $(sort ${BL31_SOURCES}) 1022ifneq (${DECRYPTION_SUPPORT},none) 1023$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1024 $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1025else 1026$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1027 $(eval $(call MAKE_BL,bl31,soc-fw))) 1028endif #(DECRYPTION_SUPPORT) 1029endif #(NEED_BL31) 1030 1031# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1032# build system will call TOOL_ADD_IMG to print a warning message and abort the 1033# process. Note that the dependency on BL32 applies to the FIP only. 1034ifeq (${NEED_BL32},yes) 1035# Sort BL32 source files to remove duplicates 1036BL32_SOURCES := $(sort ${BL32_SOURCES}) 1037BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 1038 1039ifneq (${DECRYPTION_SUPPORT},none) 1040$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1041 $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1042else 1043$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 1044 $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 1045endif #(DECRYPTION_SUPPORT) 1046endif #(NEED_BL32) 1047 1048# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 1049# needs to be built from RMM_SOURCES. 1050ifeq (${NEED_RMM},yes) 1051# Sort RMM source files to remove duplicates 1052RMM_SOURCES := $(sort ${RMM_SOURCES}) 1053BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 1054 1055$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 1056 $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 1057endif #(NEED_RMM) 1058 1059# Add the BL33 image if required by the platform 1060ifeq (${NEED_BL33},yes) 1061$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1062endif #(NEED_BL33) 1063 1064ifeq (${NEED_BL2U},yes) 1065$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1066 $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 1067endif #(NEED_BL2U) 1068 1069# Expand build macros for the different images 1070ifeq (${NEED_FDT},yes) 1071 $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 1072 1073 ifneq (${INITRD_SIZE}${INITRD_PATH},) 1074 ifndef INITRD_BASE 1075 $(error INITRD_BASE must be set when inserting initrd properties to the DTB.) 1076 endif 1077 1078 INITRD_SIZE ?= $(shell printf "0x%x\n" $$(stat -Lc %s $(INITRD_PATH))) 1079 initrd_end = $(shell printf "0x%x\n" $$(expr $$(($(INITRD_BASE) + $(INITRD_SIZE))))) 1080 1081 define $(HW_CONFIG)-after += 1082 $(s)echo " INITRD $(HW_CONFIG)" 1083 $(q)fdtput -t x $@ /chosen linux,initrd-start $(INITRD_BASE) 1084 $(q)fdtput -t x $@ /chosen linux,initrd-end $(initrd_end) 1085 endef 1086 endif 1087endif #(NEED_FDT) 1088 1089# Add Secure Partition packages 1090ifeq (${NEED_SP_PKG},yes) 1091$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | $$(@D)/ 1092 $(if $(host-poetry),$(q)$(host-poetry) -q install --no-root) 1093 $(q)$(if $(host-poetry),$(host-poetry) run )${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} 1094sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1095 $(s)echo 1096 $(s)echo "Built SP Images successfully" 1097 $(s)echo 1098endif #(NEED_SP_PKG) 1099 1100locate-checkpatch: 1101ifndef CHECKPATCH 1102 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1103else 1104ifeq (,$(wildcard ${CHECKPATCH})) 1105 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1106endif 1107endif #(CHECKPATCH) 1108 1109clean: 1110 $(s)echo " CLEAN" 1111 $(q)rm -rf $(BUILD_PLAT) 1112 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${FIPTOOLPATH} clean 1113 $(q)rm -rf ${FIPTOOLPATH}/fiptool 1114 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1115 $(q)rm -rf ${CRTTOOLPATH}/cert_create 1116 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 1117 $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1118 1119realclean distclean: 1120 $(s)echo " REALCLEAN" 1121 $(q)rm -rf $(BUILD_BASE) 1122 $(q)rm -rf $(CURDIR)/cscope.* 1123 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${FIPTOOLPATH} clean 1124 $(q)rm -rf ${FIPTOOLPATH}/fiptool 1125 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1126 $(q)rm -rf ${CRTTOOLPATH}/cert_create 1127 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 1128 $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1129 1130checkcodebase: locate-checkpatch 1131 $(s)echo " CHECKING STYLE" 1132 $(q)if test -d .git ; then \ 1133 git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 1134 while read GIT_FILE ; \ 1135 do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 1136 done ; \ 1137 else \ 1138 find . -type f -not -iwholename "*.git*" \ 1139 -not -iwholename "*build*" \ 1140 -not -iwholename "*libfdt*" \ 1141 -not -iwholename "*libc*" \ 1142 -not -iwholename "*docs*" \ 1143 -not -iwholename "*.rst" \ 1144 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 1145 fi 1146 1147checkpatch: locate-checkpatch 1148 $(s)echo " CHECKING STYLE" 1149 $(q)if test -n "${CHECKPATCH_OPTS}"; then \ 1150 echo " with ${CHECKPATCH_OPTS} option(s)"; \ 1151 fi 1152 $(q)COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 1153 for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 1154 do \ 1155 printf "\n[*] Checking style of '$$commit'\n\n"; \ 1156 ( git log --format=email "$$commit~..$$commit" \ 1157 -- ${CHECK_PATHS} ; \ 1158 git diff --format=email "$$commit~..$$commit" \ 1159 -- ${CHECK_PATHS}; ) | \ 1160 ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 1161 done 1162 1163certtool: ${CRTTOOL} 1164 1165${CRTTOOL}: FORCE | $$(@D)/ 1166 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${CRTTOOLPATH} all 1167 $(q)ln -sf ${CRTTOOL} ${CRTTOOLPATH}/cert_create 1168 $(s)echo 1169 $(s)echo "Built $@ successfully" 1170 $(s)echo 1171 1172ifneq (${GENERATE_COT},0) 1173certificates: ${CRT_DEPS} ${CRTTOOL} ${DTBS} 1174 $(q)${CRTTOOL} ${CRT_ARGS} 1175 $(s)echo 1176 $(s)echo "Built $@ successfully" 1177 $(s)echo "Certificates can be found in ${BUILD_PLAT}" 1178 $(s)echo 1179endif #(GENERATE_COT) 1180 1181ifeq (${SEPARATE_BL2_FIP},1) 1182${BUILD_PLAT}/${BL2_FIP_NAME}: ${BL2_FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1183 $(eval ${CHECK_BL2_FIP_CMD}) 1184 $(q)${FIPTOOL} create ${BL2_FIP_ARGS} $@ 1185 $(q)${FIPTOOL} info $@ 1186 $(s)echo 1187 $(s)echo "Built $@ successfully" 1188 $(s)echo 1189endif #(SEPARATE_BL2_FIP) 1190 1191${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1192 $(eval ${CHECK_FIP_CMD}) 1193 $(q)${FIPTOOL} create ${FIP_ARGS} $@ 1194 $(q)${FIPTOOL} info $@ 1195 $(s)echo 1196 $(s)echo "Built $@ successfully" 1197 $(s)echo 1198 1199ifneq (${GENERATE_COT},0) 1200fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 1201 $(q)${CRTTOOL} ${FWU_CRT_ARGS} 1202 $(s)echo 1203 $(s)echo "Built $@ successfully" 1204 $(s)echo "FWU certificates can be found in ${BUILD_PLAT}" 1205 $(s)echo 1206endif #(GENERATE_COT) 1207 1208ifneq (${GENERATE_COT},0) 1209bl2_certificates: ${BUILD_PLAT}/${FIP_NAME} ${BL2_CRT_DEPS} ${CRTTOOL} | ${BUILD_PLAT}/ 1210 $(q)${CRTTOOL} ${BL2_CRT_ARGS} 1211 $(s)echo 1212 $(s)echo "Built $@ successfully" 1213 $(s)echo "BL2 certificates can be found in ${BUILD_PLAT}" 1214 $(s)echo 1215endif #(GENERATE_COT) 1216 1217${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1218 $(eval ${CHECK_FWU_FIP_CMD}) 1219 $(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1220 $(q)${FIPTOOL} info $@ 1221 $(s)echo 1222 $(s)echo "Built $@ successfully" 1223 $(s)echo 1224 1225fiptool: ${FIPTOOL} 1226ifeq (${SEPARATE_BL2_FIP},1) 1227bl2_fip: ${BUILD_PLAT}/${BL2_FIP_NAME} 1228fip: bl2_fip 1229else 1230fip: ${BUILD_PLAT}/${FIP_NAME} 1231endif #(SEPARATE_BL2_FIP) 1232fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 1233 1234# symlink for compatibility before tools were in the build directory 1235${FIPTOOL}: FORCE | $$(@D)/ 1236 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${FIPTOOLPATH} all 1237 $(q)ln -sf ${FIPTOOL} ${FIPTOOLPATH}/fiptool 1238 1239$(BUILD_PLAT)/romlib/romlib.bin $(BUILD_PLAT)/lib/libwrappers.a $&: $(BUILD_PLAT)/lib/libfdt.a $(BUILD_PLAT)/lib/libc.a $(CRYPTO_LIB) | $$(@D)/ 1240 $(q)${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} CRYPTO_LIB=$(CRYPTO_LIB) ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES=$(call escape-shell,$(INCLUDES)) DEFINES=$(call escape-shell,$(DEFINES)) --no-print-directory -C ${ROMLIBPATH} all 1241 1242memmap: all 1243 $(if $(host-poetry),$(q)$(host-poetry) -q install --no-root) 1244 $(q)$(if $(host-poetry),$(host-poetry) run )memory --root ${BUILD_PLAT} symbols 1245 1246tl: ${BUILD_PLAT}/tl.bin 1247${BUILD_PLAT}/tl.bin: ${HW_CONFIG} | $$(@D)/ 1248 $(if $(host-poetry),$(q)$(host-poetry) -q install --no-root) 1249 $(q)$(if $(host-poetry),$(host-poetry) run )tlc create --fdt $< -s ${FW_HANDOFF_SIZE} $@ 1250 1251doc: 1252 $(s)echo " BUILD DOCUMENTATION" 1253 $(if $(host-poetry),$(q)$(host-poetry) -q install --with docs --no-root) 1254 $(q)$(if $(host-poetry),$(host-poetry) run )${MAKE} --no-print-directory -C ${DOCS_PATH} BUILDDIR=$(abspath ${BUILD_BASE}/docs) html 1255 1256enctool: ${ENCTOOL} 1257 1258${ENCTOOL}: FORCE | $$(@D)/ 1259 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${ENCTOOLPATH} all 1260 $(s)echo 1261 $(s)echo "Built $@ successfully" 1262 $(s)echo 1263 1264cscope: 1265 $(s)echo " CSCOPE" 1266 $(q)find ${CURDIR} -name "*.[chsS]" > cscope.files 1267 $(q)cscope -b -q -k 1268 1269help: 1270 $(s)echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 1271 $(s)echo "" 1272 $(s)echo "PLAT is used to specify which platform you wish to build." 1273 $(s)echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 1274 $(s)echo "" 1275 $(s)echo "platform = ${PLATFORM_LIST}" 1276 $(s)echo "" 1277 $(s)echo "Please refer to the User Guide for a list of all supported options." 1278 $(s)echo "Note that the build system doesn't track dependencies for build " 1279 $(s)echo "options. Therefore, if any of the build options are changed " 1280 $(s)echo "from a previous build, a clean build must be performed." 1281 $(s)echo "" 1282 $(s)echo "Supported Targets:" 1283 $(s)echo " all Build all individual bootloader binaries" 1284 $(s)echo " bl1 Build the BL1 binary" 1285 $(s)echo " bl2 Build the BL2 binary" 1286 $(s)echo " bl2u Build the BL2U binary" 1287 $(s)echo " bl31 Build the BL31 binary" 1288 $(s)echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 1289 $(s)echo " this builds secure payload specified by AARCH32_SP" 1290 $(s)echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 1291 $(s)echo " fip Build the Firmware Image Package (FIP)" 1292 $(s)echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 1293 $(s)echo " checkcodebase Check the coding style of the entire source tree" 1294 $(s)echo " checkpatch Check the coding style on changes in the current" 1295 $(s)echo " branch against BASE_COMMIT (default origin/master)" 1296 $(s)echo " clean Clean the build for the selected platform" 1297 $(s)echo " cscope Generate cscope index" 1298 $(s)echo " distclean Remove all build artifacts for all platforms" 1299 $(s)echo " certtool Build the Certificate generation tool" 1300 $(s)echo " enctool Build the Firmware encryption tool" 1301 $(s)echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1302 $(s)echo " sp Build the Secure Partition Packages" 1303 $(s)echo " sptool Build the Secure Partition Package creation tool" 1304 $(s)echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1305 $(s)echo " memmap Print the memory map of the built binaries" 1306 $(s)echo " doc Build html based documentation using Sphinx tool" 1307 $(s)echo "" 1308 $(s)echo "Note: most build targets require PLAT to be set to a specific platform." 1309 $(s)echo "" 1310 $(s)echo "example: build all targets for the FVP platform:" 1311 $(s)echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1312 1313.PHONY: FORCE 1314FORCE:; 1315