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