1# 2# Copyright (c) 2013-2025, 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 ?= 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 144endif #(Debug) 145 146# Default build string (git branch and commit) 147ifeq (${BUILD_STRING},) 148 BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 149endif 150VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} 151 152# Setting W is quite verbose and most warnings will be pre-existing issues 153# outside of the contributor's control. Don't fail the build on them so warnings 154# can be seen and hopefully addressed 155ifdef W 156 ifneq (${W},0) 157 E ?= 0 158 endif 159endif 160 161################################################################################ 162# Setup ARCH_MAJOR/MINOR before parsing arch_features. 163################################################################################ 164ifeq (${ENABLE_RME},1) 165 ARM_ARCH_MAJOR := 9 166 ARM_ARCH_MINOR := 2 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 plat/common/plat_bl_common.c \ 191 plat/common/plat_log_common.c \ 192 plat/common/${ARCH}/plat_common.c \ 193 plat/common/${ARCH}/platform_helpers.S \ 194 ${COMPILER_RT_SRCS} 195 196ifeq ($($(ARCH)-cc-id),arm-clang) 197 BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 198endif 199 200ifeq (${SANITIZE_UB},on) 201 BL_COMMON_SOURCES += plat/common/ubsan.c 202endif 203 204INCLUDES += -Iinclude \ 205 -Iinclude/arch/${ARCH} \ 206 -Iinclude/lib/cpus/${ARCH} \ 207 -Iinclude/lib/el3_runtime/${ARCH} \ 208 ${PLAT_INCLUDES} \ 209 ${SPD_INCLUDES} 210 211include common/backtrace/backtrace.mk 212 213################################################################################ 214# Generic definitions 215################################################################################ 216 217ifeq (${BUILD_BASE},) 218 BUILD_BASE := ./build 219endif 220BUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 221 222SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 223 224# Platforms providing their own TBB makefile may override this value 225INCLUDE_TBBR_MK := 1 226 227################################################################################ 228# Include SPD Makefile if one has been specified 229################################################################################ 230 231ifneq (${SPD},none) 232 ifeq (${SPD},spmd) 233 # SPMD is located in std_svc directory 234 SPD_DIR := std_svc 235 236 ifeq ($(SPMD_SPM_AT_SEL2),1) 237 CTX_INCLUDE_EL2_REGS := 1 238 endif 239 240 ifneq ($(SP_LAYOUT_FILE),) 241 BL2_ENABLE_SP_LOAD := 1 242 endif 243 else 244 # All other SPDs in spd directory 245 SPD_DIR := spd 246 endif #(SPD) 247 248 # We expect to locate an spd.mk under the specified SPD directory 249 SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 250 251 ifeq (${SPD_MAKE},) 252 $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 253 endif 254 $(info Including ${SPD_MAKE}) 255 include ${SPD_MAKE} 256 257 # If there's BL32 companion for the chosen SPD, we expect that the SPD's 258 # Makefile would set NEED_BL32 to "yes". In this case, the build system 259 # supports two mutually exclusive options: 260 # * BL32 is built from source: then BL32_SOURCES must contain the list 261 # of source files to build BL32 262 # * BL32 is a prebuilt binary: then BL32 must point to the image file 263 # that will be included in the FIP 264 # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 265 # over the sources. 266endif #(SPD=none) 267 268################################################################################ 269# Include the platform specific Makefile after the SPD Makefile (the platform 270# makefile may use all previous definitions in this file) 271################################################################################ 272include ${PLAT_MAKEFILE_FULL} 273 274################################################################################ 275# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from 276# platform. 277################################################################################ 278 279include ${MAKE_HELPERS_DIRECTORY}arch_features.mk 280################################################################################ 281# Process BRANCH_PROTECTION value and set 282# Pointer Authentication and Branch Target Identification flags 283################################################################################ 284ifeq (${BRANCH_PROTECTION},0) 285 # Default value turns off all types of branch protection 286 BP_OPTION := none 287else ifneq (${ARCH},aarch64) 288 $(error BRANCH_PROTECTION requires AArch64) 289else ifeq (${BRANCH_PROTECTION},1) 290 # Enables all types of branch protection features 291 BP_OPTION := standard 292 ENABLE_BTI := 1 293 ENABLE_PAUTH := 1 294else ifeq (${BRANCH_PROTECTION},2) 295 # Return address signing to its standard level 296 BP_OPTION := pac-ret 297 ENABLE_PAUTH := 1 298else ifeq (${BRANCH_PROTECTION},3) 299 # Extend the signing to include leaf functions 300 BP_OPTION := pac-ret+leaf 301 ENABLE_PAUTH := 1 302else ifeq (${BRANCH_PROTECTION},4) 303 # Turn on branch target identification mechanism 304 BP_OPTION := bti 305 ENABLE_BTI := 1 306else ifeq (${BRANCH_PROTECTION},5) 307 # Turn on branch target identification mechanism 308 BP_OPTION := standard 309 ENABLE_BTI := 2 310 ENABLE_PAUTH := 2 311else 312 $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 313endif #(BRANCH_PROTECTION) 314 315ifneq ($(ENABLE_PAUTH),0) 316 CTX_INCLUDE_PAUTH_REGS := ${ENABLE_PAUTH} 317endif 318 319# Pointer Authentication sources 320ifneq (${ENABLE_PAUTH},0) 321# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 322# Pauth support. As it's not secure, it must be reimplemented for real platforms 323 BL_COMMON_SOURCES += lib/extensions/pauth/pauth.c 324endif 325 326################################################################################ 327# RME dependent flags configuration, Enable optional features for RME. 328################################################################################ 329# FEAT_RME 330ifeq (${ENABLE_RME},1) 331 # RMM relies on SMCCC_ARCH_FEATURE_AVAILABILITY to discover EL3 enablement 332 ARCH_FEATURE_AVAILABILITY := 1 333 334 # RME requires el2 context to be saved for now. 335 CTX_INCLUDE_EL2_REGS := 1 336 CTX_INCLUDE_AARCH32_REGS := 0 337 CTX_INCLUDE_PAUTH_REGS := 1 338 339 ifneq ($(ENABLE_FEAT_MPAM), 0) 340 CTX_INCLUDE_MPAM_REGS := 1 341 endif 342 343 # RME enables CSV2_2 extension by default. 344 ENABLE_FEAT_CSV2_2 = 1 345endif #(FEAT_RME) 346 347################################################################################ 348# Include rmmd Makefile if RME is enabled 349################################################################################ 350ifneq (${ENABLE_RME},0) 351include services/std_svc/rmmd/rmmd.mk 352$(warning "RME is an experimental feature") 353endif 354 355################################################################################ 356# Make 128-Bit sysreg read/writes availabe when FEAT_D128 is enabled. 357################################################################################ 358ifneq (${ENABLE_FEAT_D128}, 0) 359 BL_COMMON_SOURCES += lib/extensions/sysreg128/sysreg128.S 360endif 361 362# This internal flag is common option which is set to 1 for scenarios 363# when the BL2 is running in EL3 level. This occurs in two scenarios - 364# 4 world system running BL2 at EL3 and two world system without BL1 running 365# BL2 in EL3 366 367ifeq (${RESET_TO_BL2},1) 368 BL2_RUNS_AT_EL3 := 1 369 ifeq (${ENABLE_RME},1) 370 $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not \ 371 supported at the moment.) 372 endif 373else ifeq (${ENABLE_RME},1) 374 BL2_RUNS_AT_EL3 := 1 375else 376 BL2_RUNS_AT_EL3 := 0 377endif 378 379# This internal flag is set to 1 when Firmware First handling of External aborts 380# is required by lowe ELs. Currently only NS requires this support. 381ifeq ($(HANDLE_EA_EL3_FIRST_NS),1) 382 FFH_SUPPORT := 1 383else 384 FFH_SUPPORT := 0 385endif 386 387ifneq ($(filter 1,${ERRATA_A53_1530924} ${ERRATA_A55_1530923} \ 388 ${ERRATA_A57_1319537} ${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 ENABLE_FEAT_RAS \ 577 FFH_SUPPORT \ 578 ERROR_DEPRECATED \ 579 FAULT_INJECTION_SUPPORT \ 580 GENERATE_COT \ 581 GICV2_G0_FOR_EL3 \ 582 HANDLE_EA_EL3_FIRST_NS \ 583 HARDEN_SLS \ 584 HW_ASSISTED_COHERENCY \ 585 MEASURED_BOOT \ 586 DISCRETE_TPM \ 587 DICE_PROTECTION_ENVIRONMENT \ 588 RMMD_ENABLE_EL3_TOKEN_SIGN \ 589 RMMD_ENABLE_IDE_KEY_PROG \ 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 USE_SPINLOCK_CAS \ 627 ENCRYPT_BL31 \ 628 ENCRYPT_BL32 \ 629 ERRATA_SPECULATIVE_AT \ 630 ERRATA_SME_POWER_DOWN \ 631 RAS_TRAP_NS_ERR_REC_ACCESS \ 632 COT_DESC_IN_DTB \ 633 USE_SP804_TIMER \ 634 PSA_FWU_SUPPORT \ 635 PSA_FWU_METADATA_FW_STORE_DESC \ 636 ENABLE_MPMM \ 637 FEATURE_DETECTION \ 638 TRNG_SUPPORT \ 639 ENABLE_ERRATA_ALL \ 640 ERRATA_ABI_SUPPORT \ 641 ERRATA_NON_ARM_INTERCONNECT \ 642 CONDITIONAL_CMO \ 643 PSA_CRYPTO \ 644 ENABLE_CONSOLE_GETC \ 645 INIT_UNUSED_NS_EL2 \ 646 PLATFORM_REPORT_CTX_MEM_USE \ 647 EARLY_CONSOLE \ 648 PRESERVE_DSU_PMU_REGS \ 649 HOB_LIST \ 650 LFA_SUPPORT \ 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_DEBUGV8P9 \ 675 ENABLE_FEAT_DIT \ 676 ENABLE_FEAT_ECV \ 677 ENABLE_FEAT_EBEP \ 678 ENABLE_FEAT_FGT \ 679 ENABLE_FEAT_FGT2 \ 680 ENABLE_FEAT_FGWTE3 \ 681 ENABLE_FEAT_FPMR \ 682 ENABLE_FEAT_HCX \ 683 ENABLE_FEAT_IDTE3 \ 684 ENABLE_FEAT_LS64_ACCDATA \ 685 ENABLE_FEAT_MEC \ 686 ENABLE_FEAT_MOPS \ 687 ENABLE_FEAT_MTE2 \ 688 ENABLE_FEAT_PAN \ 689 ENABLE_FEAT_PFAR \ 690 ENABLE_FEAT_RNG \ 691 ENABLE_FEAT_RNG_TRAP \ 692 ENABLE_FEAT_SEL2 \ 693 ENABLE_FEAT_TCR2 \ 694 ENABLE_FEAT_THE \ 695 ENABLE_FEAT_SB \ 696 ENABLE_FEAT_S2PIE \ 697 ENABLE_FEAT_S1PIE \ 698 ENABLE_FEAT_S2POE \ 699 ENABLE_FEAT_S1POE \ 700 ENABLE_FEAT_SCTLR2 \ 701 ENABLE_FEAT_D128 \ 702 ENABLE_FEAT_RME_GDI \ 703 ENABLE_FEAT_GCS \ 704 ENABLE_FEAT_VHE \ 705 ENABLE_FEAT_MPAM \ 706 ENABLE_FEAT_MPAM_PE_BW_CTRL \ 707 ENABLE_RME \ 708 ENABLE_SPE_FOR_NS \ 709 ENABLE_SYS_REG_TRACE_FOR_NS \ 710 ENABLE_SME_FOR_NS \ 711 ENABLE_SME2_FOR_NS \ 712 ENABLE_SVE_FOR_NS \ 713 ENABLE_TRF_FOR_NS \ 714 FW_ENC_STATUS \ 715 NR_OF_FW_BANKS \ 716 NR_OF_IMAGES_IN_FW_BANK \ 717 SPMC_AT_EL3_PARTITION_MAX_UUIDS \ 718 TWED_DELAY \ 719 ENABLE_FEAT_TWED \ 720 SVE_VECTOR_LEN \ 721 IMPDEF_SYSREG_TRAP \ 722 W \ 723))) 724 725ifdef KEY_SIZE 726 $(eval $(call assert_numeric,KEY_SIZE)) 727endif 728 729ifeq ($(filter $(SANITIZE_UB), on off trap),) 730 $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 731endif 732 733################################################################################ 734# Add definitions to the cpp preprocessor based on the current build options. 735# This is done after including the platform specific makefile to allow the 736# platform to overwrite the default options 737################################################################################ 738 739$(eval $(call add_defines,\ 740 $(sort \ 741 ALLOW_RO_XLAT_TABLES \ 742 ARM_ARCH_MAJOR \ 743 ARM_ARCH_MINOR \ 744 BL2_ENABLE_SP_LOAD \ 745 COLD_BOOT_SINGLE_CPU \ 746 $(CPU_FLAG_LIST) \ 747 CTX_INCLUDE_AARCH32_REGS \ 748 CTX_INCLUDE_FPREGS \ 749 CTX_INCLUDE_SVE_REGS \ 750 CTX_INCLUDE_PAUTH_REGS \ 751 CTX_INCLUDE_MPAM_REGS \ 752 EL3_EXCEPTION_HANDLING \ 753 CTX_INCLUDE_EL2_REGS \ 754 CTX_INCLUDE_NEVE_REGS \ 755 DEBUG \ 756 DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 757 DISABLE_MTPMU \ 758 ENABLE_FEAT_AMU \ 759 ENABLE_AMU_AUXILIARY_COUNTERS \ 760 AMU_RESTRICT_COUNTERS \ 761 ENABLE_ASSERTIONS \ 762 ENABLE_BTI \ 763 ENABLE_FEAT_DEBUGV8P9 \ 764 ENABLE_FEAT_IDTE3 \ 765 ENABLE_FEAT_MPAM \ 766 ENABLE_FEAT_MPAM_PE_BW_CTRL \ 767 ENABLE_PAUTH \ 768 ENABLE_FEAT_PAUTH_LR \ 769 ENABLE_PIE \ 770 ENABLE_PMF \ 771 ENABLE_PSCI_STAT \ 772 ENABLE_RME \ 773 RMMD_ENABLE_EL3_TOKEN_SIGN \ 774 RMMD_ENABLE_IDE_KEY_PROG \ 775 ENABLE_RUNTIME_INSTRUMENTATION \ 776 ENABLE_SME_FOR_NS \ 777 ENABLE_SME2_FOR_NS \ 778 ENABLE_SME_FOR_SWD \ 779 ENABLE_SPE_FOR_NS \ 780 ENABLE_SVE_FOR_NS \ 781 ENABLE_SVE_FOR_SWD \ 782 ENABLE_FEAT_RAS \ 783 FFH_SUPPORT \ 784 ENCRYPT_BL31 \ 785 ENCRYPT_BL32 \ 786 ERROR_DEPRECATED \ 787 FAULT_INJECTION_SUPPORT \ 788 GICV2_G0_FOR_EL3 \ 789 HANDLE_EA_EL3_FIRST_NS \ 790 HW_ASSISTED_COHERENCY \ 791 LOG_LEVEL \ 792 MEASURED_BOOT \ 793 DISCRETE_TPM \ 794 DICE_PROTECTION_ENVIRONMENT \ 795 DRTM_SUPPORT \ 796 NS_TIMER_SWITCH \ 797 PLATFORM_NODE_COUNT \ 798 PL011_GENERIC_UART \ 799 PLAT_EXTRA_LD_SCRIPT \ 800 PLAT_${PLAT} \ 801 PROGRAMMABLE_RESET_ADDRESS \ 802 PSCI_EXTENDED_STATE_ID \ 803 PSCI_OS_INIT_MODE \ 804 ARCH_FEATURE_AVAILABILITY \ 805 RESET_TO_BL31 \ 806 RME_GPT_BITLOCK_BLOCK \ 807 RME_GPT_MAX_BLOCK \ 808 SEPARATE_CODE_AND_RODATA \ 809 SEPARATE_BL2_FIP \ 810 SEPARATE_BL2_NOLOAD_REGION \ 811 SEPARATE_NOBITS_REGION \ 812 SEPARATE_RWDATA_REGION \ 813 SEPARATE_SIMD_SECTION \ 814 RECLAIM_INIT_CODE \ 815 SPD_${SPD} \ 816 SPIN_ON_BL1_EXIT \ 817 SPM_MM \ 818 SPMC_AT_EL3 \ 819 SPMC_AT_EL3_PARTITION_MAX_UUIDS \ 820 SPMC_AT_EL3_SEL0_SP \ 821 SPMD_SPM_AT_SEL2 \ 822 TRANSFER_LIST \ 823 TRUSTED_BOARD_BOOT \ 824 TRNG_SUPPORT \ 825 ERRATA_ABI_SUPPORT \ 826 ERRATA_NON_ARM_INTERCONNECT \ 827 USE_COHERENT_MEM \ 828 USE_DEBUGFS \ 829 ARM_IO_IN_DTB \ 830 SDEI_IN_FCONF \ 831 SEC_INT_DESC_IN_FCONF \ 832 USE_ROMLIB \ 833 USE_TBBR_DEFS \ 834 USE_KERNEL_DT_CONVENTION \ 835 WARMBOOT_ENABLE_DCACHE_EARLY \ 836 RESET_TO_BL2 \ 837 BL2_RUNS_AT_EL3 \ 838 BL2_IN_XIP_MEM \ 839 BL2_INV_DCACHE \ 840 USE_SPINLOCK_CAS \ 841 ERRATA_SPECULATIVE_AT \ 842 ERRATA_SME_POWER_DOWN \ 843 RAS_TRAP_NS_ERR_REC_ACCESS \ 844 COT_DESC_IN_DTB \ 845 USE_SP804_TIMER \ 846 ENABLE_FEAT_RNG \ 847 ENABLE_FEAT_RNG_TRAP \ 848 ENABLE_FEAT_SB \ 849 ENABLE_FEAT_DIT \ 850 NR_OF_FW_BANKS \ 851 NR_OF_IMAGES_IN_FW_BANK \ 852 PSA_FWU_SUPPORT \ 853 PSA_FWU_METADATA_FW_STORE_DESC \ 854 ENABLE_BRBE_FOR_NS \ 855 ENABLE_TRBE_FOR_NS \ 856 ENABLE_SYS_REG_TRACE_FOR_NS \ 857 ENABLE_TRF_FOR_NS \ 858 ENABLE_FEAT_AIE \ 859 ENABLE_FEAT_HCX \ 860 ENABLE_MPMM \ 861 ENABLE_FEAT_FGT \ 862 ENABLE_FEAT_FGT2 \ 863 ENABLE_FEAT_FGWTE3 \ 864 ENABLE_FEAT_FPMR \ 865 ENABLE_FEAT_ECV \ 866 ENABLE_FEAT_EBEP \ 867 ENABLE_FEAT_AMUv1p1 \ 868 ENABLE_FEAT_SEL2 \ 869 ENABLE_FEAT_VHE \ 870 ENABLE_FEAT_CLRBHB \ 871 ENABLE_FEAT_CPA2 \ 872 ENABLE_FEAT_CSV2_2 \ 873 ENABLE_FEAT_CSV2_3 \ 874 ENABLE_FEAT_LS64_ACCDATA \ 875 ENABLE_FEAT_MEC \ 876 ENABLE_FEAT_PAN \ 877 ENABLE_FEAT_TCR2 \ 878 ENABLE_FEAT_THE \ 879 ENABLE_FEAT_S2PIE \ 880 ENABLE_FEAT_S1PIE \ 881 ENABLE_FEAT_S2POE \ 882 ENABLE_FEAT_S1POE \ 883 ENABLE_FEAT_SCTLR2 \ 884 ENABLE_FEAT_D128 \ 885 ENABLE_FEAT_RME_GDI \ 886 ENABLE_FEAT_GCS \ 887 ENABLE_FEAT_MOPS \ 888 ENABLE_FEAT_GCIE \ 889 ENABLE_FEAT_MTE2 \ 890 ENABLE_FEAT_PFAR \ 891 FEATURE_DETECTION \ 892 TWED_DELAY \ 893 ENABLE_FEAT_TWED \ 894 CONDITIONAL_CMO \ 895 IMPDEF_SYSREG_TRAP \ 896 SVE_VECTOR_LEN \ 897 ENABLE_SPMD_LP \ 898 PSA_CRYPTO \ 899 ENABLE_CONSOLE_GETC \ 900 INIT_UNUSED_NS_EL2 \ 901 PLATFORM_REPORT_CTX_MEM_USE \ 902 EARLY_CONSOLE \ 903 PRESERVE_DSU_PMU_REGS \ 904 HOB_LIST \ 905 HW_CONFIG_BASE \ 906 LFA_SUPPORT \ 907))) 908 909ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) 910ifeq (${DEBUG}, 0) 911 $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only") 912 override PLATFORM_REPORT_CTX_MEM_USE := 0 913endif 914endif 915 916ifeq (${SANITIZE_UB},trap) 917 $(eval $(call add_define,MONITOR_TRAPS)) 918endif #(SANITIZE_UB) 919 920# Define the EL3_PAYLOAD_BASE flag only if it is provided. 921ifdef EL3_PAYLOAD_BASE 922 $(eval $(call add_define,EL3_PAYLOAD_BASE)) 923else 924# Define the PRELOADED_BL33_BASE flag only if it is provided and 925# EL3_PAYLOAD_BASE is not defined, as it has priority. 926 ifdef PRELOADED_BL33_BASE 927 $(eval $(call add_define,PRELOADED_BL33_BASE)) 928 endif 929endif #(EL3_PAYLOAD_BASE) 930 931# Define the DYN_DISABLE_AUTH flag only if set. 932ifeq (${DYN_DISABLE_AUTH},1) 933 $(eval $(call add_define,DYN_DISABLE_AUTH)) 934endif 935 936ifeq ($($(ARCH)-ld-id),arm-link) 937 $(eval $(call add_define,USE_ARM_LINK)) 938endif 939 940# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 941ifeq (${SPD},spmd) 942ifdef SP_LAYOUT_FILE 943 -include $(BUILD_PLAT)/sp_gen.mk 944 FIP_DEPS += sp 945 CRT_DEPS += sp 946 NEED_SP_PKG := yes 947else 948 ifeq (${SPMD_SPM_AT_SEL2},1) 949 $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 950 endif 951endif #(SP_LAYOUT_FILE) 952endif #(SPD) 953 954################################################################################ 955# Configure the flags for the specified compiler and linker 956################################################################################ 957include ${MAKE_HELPERS_DIRECTORY}cflags.mk 958 959################################################################################ 960# Build targets 961################################################################################ 962 963.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp tl fwu_fip certtool dtbs memmap doc enctool 964 965all: msg_start 966 967msg_start: 968 $(s)echo "Building ${PLAT}" 969 970$(eval $(call MAKE_LIB,c)) 971 972# Expand build macros for the different images 973ifeq (${NEED_BL1},yes) 974BL1_SOURCES := $(sort ${BL1_SOURCES}) 975$(eval $(call MAKE_BL,bl1)) 976endif #(NEED_BL1) 977 978ifeq (${NEED_BL2},yes) 979 980ifeq (${RESET_TO_BL2}, 0) 981FIP_BL2_ARGS := tb-fw 982endif 983 984BL2_SOURCES := $(sort ${BL2_SOURCES}) 985 986ifeq (${SEPARATE_BL2_FIP},1) 987$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS},BL2_)), \ 988 $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS},BL2_))) 989else 990$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})), \ 991 $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 992endif #(SEPARATE_BL2_FIP) 993 994endif #(NEED_BL2) 995 996ifeq (${NEED_SCP_BL2},yes) 997$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 998endif #(NEED_SCP_BL2) 999 1000ifeq (${NEED_BL31},yes) 1001BL31_SOURCES += ${SPD_SOURCES} 1002# Sort BL31 source files to remove duplicates 1003BL31_SOURCES := $(sort ${BL31_SOURCES}) 1004ifneq (${DECRYPTION_SUPPORT},none) 1005$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1006 $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1007else 1008$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1009 $(eval $(call MAKE_BL,bl31,soc-fw))) 1010endif #(DECRYPTION_SUPPORT) 1011endif #(NEED_BL31) 1012 1013# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1014# build system will call TOOL_ADD_IMG to print a warning message and abort the 1015# process. Note that the dependency on BL32 applies to the FIP only. 1016ifeq (${NEED_BL32},yes) 1017# Sort BL32 source files to remove duplicates 1018BL32_SOURCES := $(sort ${BL32_SOURCES}) 1019BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 1020 1021ifneq (${DECRYPTION_SUPPORT},none) 1022$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1023 $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1024else 1025$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 1026 $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 1027endif #(DECRYPTION_SUPPORT) 1028endif #(NEED_BL32) 1029 1030# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 1031# needs to be built from RMM_SOURCES. 1032ifeq (${NEED_RMM},yes) 1033# Sort RMM source files to remove duplicates 1034RMM_SOURCES := $(sort ${RMM_SOURCES}) 1035BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 1036 1037$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 1038 $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 1039endif #(NEED_RMM) 1040 1041# Add the BL33 image if required by the platform 1042ifeq (${NEED_BL33},yes) 1043$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1044endif #(NEED_BL33) 1045 1046ifeq (${NEED_BL2U},yes) 1047$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1048 $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 1049endif #(NEED_BL2U) 1050 1051# Expand build macros for the different images 1052ifeq (${NEED_FDT},yes) 1053 $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 1054 1055 ifneq (${INITRD_SIZE}${INITRD_PATH},) 1056 ifndef INITRD_BASE 1057 $(error INITRD_BASE must be set when inserting initrd properties to the DTB.) 1058 endif 1059 1060 INITRD_SIZE ?= $(shell printf "0x%x\n" $$(stat -Lc %s $(INITRD_PATH))) 1061 initrd_end = $(shell printf "0x%x\n" $$(expr $$(($(INITRD_BASE) + $(INITRD_SIZE))))) 1062 1063 define $(HW_CONFIG)-after += 1064 $(s)echo " INITRD $(HW_CONFIG)" 1065 $(q)fdtput -t x $@ /chosen linux,initrd-start $(INITRD_BASE) 1066 $(q)fdtput -t x $@ /chosen linux,initrd-end $(initrd_end) 1067 endef 1068 endif 1069endif #(NEED_FDT) 1070 1071# Add Secure Partition packages 1072ifeq (${NEED_SP_PKG},yes) 1073$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | $$(@D)/ 1074 $(if $(host-poetry),$(q)poetry -q install --no-root) 1075 $(q)$(if $(host-poetry),poetry run )${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} 1076sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1077 $(s)echo 1078 $(s)echo "Built SP Images successfully" 1079 $(s)echo 1080endif #(NEED_SP_PKG) 1081 1082locate-checkpatch: 1083ifndef CHECKPATCH 1084 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1085else 1086ifeq (,$(wildcard ${CHECKPATCH})) 1087 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 1088endif 1089endif #(CHECKPATCH) 1090 1091clean: 1092 $(s)echo " CLEAN" 1093 $(q)rm -rf $(BUILD_PLAT) 1094 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${FIPTOOLPATH} clean 1095 $(q)rm -rf ${FIPTOOLPATH}/fiptool 1096 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1097 $(q)rm -rf ${CRTTOOLPATH}/cert_create 1098 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 1099 $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1100 1101realclean distclean: 1102 $(s)echo " REALCLEAN" 1103 $(q)rm -rf $(BUILD_BASE) 1104 $(q)rm -rf $(CURDIR)/cscope.* 1105 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${FIPTOOLPATH} clean 1106 $(q)rm -rf ${FIPTOOLPATH}/fiptool 1107 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 1108 $(q)rm -rf ${CRTTOOLPATH}/cert_create 1109 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=${BUILD_PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 1110 $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 1111 1112checkcodebase: locate-checkpatch 1113 $(s)echo " CHECKING STYLE" 1114 $(q)if test -d .git ; then \ 1115 git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 1116 while read GIT_FILE ; \ 1117 do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 1118 done ; \ 1119 else \ 1120 find . -type f -not -iwholename "*.git*" \ 1121 -not -iwholename "*build*" \ 1122 -not -iwholename "*libfdt*" \ 1123 -not -iwholename "*libc*" \ 1124 -not -iwholename "*docs*" \ 1125 -not -iwholename "*.rst" \ 1126 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 1127 fi 1128 1129checkpatch: locate-checkpatch 1130 $(s)echo " CHECKING STYLE" 1131 $(q)if test -n "${CHECKPATCH_OPTS}"; then \ 1132 echo " with ${CHECKPATCH_OPTS} option(s)"; \ 1133 fi 1134 $(q)COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 1135 for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 1136 do \ 1137 printf "\n[*] Checking style of '$$commit'\n\n"; \ 1138 ( git log --format=email "$$commit~..$$commit" \ 1139 -- ${CHECK_PATHS} ; \ 1140 git diff --format=email "$$commit~..$$commit" \ 1141 -- ${CHECK_PATHS}; ) | \ 1142 ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 1143 done 1144 1145certtool: ${CRTTOOL} 1146 1147${CRTTOOL}: FORCE | $$(@D)/ 1148 $(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 1149 $(q)ln -sf ${CRTTOOL} ${CRTTOOLPATH}/cert_create 1150 $(s)echo 1151 $(s)echo "Built $@ successfully" 1152 $(s)echo 1153 1154ifneq (${GENERATE_COT},0) 1155certificates: ${CRT_DEPS} ${CRTTOOL} ${DTBS} 1156 $(q)${CRTTOOL} ${CRT_ARGS} 1157 $(s)echo 1158 $(s)echo "Built $@ successfully" 1159 $(s)echo "Certificates can be found in ${BUILD_PLAT}" 1160 $(s)echo 1161endif #(GENERATE_COT) 1162 1163ifeq (${SEPARATE_BL2_FIP},1) 1164${BUILD_PLAT}/${BL2_FIP_NAME}: ${BL2_FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1165 $(eval ${CHECK_BL2_FIP_CMD}) 1166 $(q)${FIPTOOL} create ${BL2_FIP_ARGS} $@ 1167 $(q)${FIPTOOL} info $@ 1168 $(s)echo 1169 $(s)echo "Built $@ successfully" 1170 $(s)echo 1171endif #(SEPARATE_BL2_FIP) 1172 1173${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1174 $(eval ${CHECK_FIP_CMD}) 1175 $(q)${FIPTOOL} create ${FIP_ARGS} $@ 1176 $(q)${FIPTOOL} info $@ 1177 $(s)echo 1178 $(s)echo "Built $@ successfully" 1179 $(s)echo 1180 1181ifneq (${GENERATE_COT},0) 1182fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 1183 $(q)${CRTTOOL} ${FWU_CRT_ARGS} 1184 $(s)echo 1185 $(s)echo "Built $@ successfully" 1186 $(s)echo "FWU certificates can be found in ${BUILD_PLAT}" 1187 $(s)echo 1188endif #(GENERATE_COT) 1189 1190ifneq (${GENERATE_COT},0) 1191bl2_certificates: ${BUILD_PLAT}/${FIP_NAME} ${BL2_CRT_DEPS} ${CRTTOOL} | ${BUILD_PLAT}/ 1192 $(q)${CRTTOOL} ${BL2_CRT_ARGS} 1193 $(s)echo 1194 $(s)echo "Built $@ successfully" 1195 $(s)echo "BL2 certificates can be found in ${BUILD_PLAT}" 1196 $(s)echo 1197endif #(GENERATE_COT) 1198 1199${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} | $$(@D)/ 1200 $(eval ${CHECK_FWU_FIP_CMD}) 1201 $(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1202 $(q)${FIPTOOL} info $@ 1203 $(s)echo 1204 $(s)echo "Built $@ successfully" 1205 $(s)echo 1206 1207fiptool: ${FIPTOOL} 1208ifeq (${SEPARATE_BL2_FIP},1) 1209bl2_fip: ${BUILD_PLAT}/${BL2_FIP_NAME} 1210fip: bl2_fip 1211else 1212fip: ${BUILD_PLAT}/${FIP_NAME} 1213endif #(SEPARATE_BL2_FIP) 1214fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 1215 1216# symlink for compatibility before tools were in the build directory 1217${FIPTOOL}: FORCE | $$(@D)/ 1218 $(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 1219 $(q)ln -sf ${FIPTOOL} ${FIPTOOLPATH}/fiptool 1220 1221$(BUILD_PLAT)/romlib/romlib.bin $(BUILD_PLAT)/lib/libwrappers.a $&: $(BUILD_PLAT)/lib/libfdt.a $(BUILD_PLAT)/lib/libc.a $(CRYPTO_LIB) | $$(@D)/ 1222 $(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 1223 1224memmap: all 1225 $(if $(host-poetry),$(q)poetry -q install --no-root) 1226 $(q)$(if $(host-poetry),poetry run )memory --root ${BUILD_PLAT} symbols 1227 1228tl: ${BUILD_PLAT}/tl.bin 1229${BUILD_PLAT}/tl.bin: ${HW_CONFIG} | $$(@D)/ 1230 $(if $(host-poetry),$(q)poetry -q install --no-root) 1231 $(q)$(if $(host-poetry),poetry run )tlc create --fdt $< -s ${FW_HANDOFF_SIZE} $@ 1232 1233doc: 1234 $(s)echo " BUILD DOCUMENTATION" 1235 $(if $(host-poetry),$(q)poetry -q install --with docs --no-root) 1236 $(q)$(if $(host-poetry),poetry run )${MAKE} --no-print-directory -C ${DOCS_PATH} BUILDDIR=$(abspath ${BUILD_BASE}/docs) html 1237 1238enctool: ${ENCTOOL} 1239 1240${ENCTOOL}: FORCE | $$(@D)/ 1241 $(q)${MAKE} PLAT=${PLAT} BUILD_PLAT=$(abspath ${BUILD_PLAT}) BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${ENCTOOLPATH} all 1242 $(s)echo 1243 $(s)echo "Built $@ successfully" 1244 $(s)echo 1245 1246cscope: 1247 $(s)echo " CSCOPE" 1248 $(q)find ${CURDIR} -name "*.[chsS]" > cscope.files 1249 $(q)cscope -b -q -k 1250 1251help: 1252 $(s)echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 1253 $(s)echo "" 1254 $(s)echo "PLAT is used to specify which platform you wish to build." 1255 $(s)echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 1256 $(s)echo "" 1257 $(s)echo "platform = ${PLATFORM_LIST}" 1258 $(s)echo "" 1259 $(s)echo "Please refer to the User Guide for a list of all supported options." 1260 $(s)echo "Note that the build system doesn't track dependencies for build " 1261 $(s)echo "options. Therefore, if any of the build options are changed " 1262 $(s)echo "from a previous build, a clean build must be performed." 1263 $(s)echo "" 1264 $(s)echo "Supported Targets:" 1265 $(s)echo " all Build all individual bootloader binaries" 1266 $(s)echo " bl1 Build the BL1 binary" 1267 $(s)echo " bl2 Build the BL2 binary" 1268 $(s)echo " bl2u Build the BL2U binary" 1269 $(s)echo " bl31 Build the BL31 binary" 1270 $(s)echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 1271 $(s)echo " this builds secure payload specified by AARCH32_SP" 1272 $(s)echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 1273 $(s)echo " fip Build the Firmware Image Package (FIP)" 1274 $(s)echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 1275 $(s)echo " checkcodebase Check the coding style of the entire source tree" 1276 $(s)echo " checkpatch Check the coding style on changes in the current" 1277 $(s)echo " branch against BASE_COMMIT (default origin/master)" 1278 $(s)echo " clean Clean the build for the selected platform" 1279 $(s)echo " cscope Generate cscope index" 1280 $(s)echo " distclean Remove all build artifacts for all platforms" 1281 $(s)echo " certtool Build the Certificate generation tool" 1282 $(s)echo " enctool Build the Firmware encryption tool" 1283 $(s)echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1284 $(s)echo " sp Build the Secure Partition Packages" 1285 $(s)echo " sptool Build the Secure Partition Package creation tool" 1286 $(s)echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1287 $(s)echo " memmap Print the memory map of the built binaries" 1288 $(s)echo " doc Build html based documentation using Sphinx tool" 1289 $(s)echo "" 1290 $(s)echo "Note: most build targets require PLAT to be set to a specific platform." 1291 $(s)echo "" 1292 $(s)echo "example: build all targets for the FVP platform:" 1293 $(s)echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1294 1295.PHONY: FORCE 1296FORCE:; 1297