1# 2# Copyright (c) 2013-2017, 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 := 1 11VERSION_MINOR := 3 12 13# Default goal is build all images 14.DEFAULT_GOAL := all 15 16# Avoid any implicit propagation of command line variable definitions to 17# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 18# usage. Other command line options like "-s" are still propagated as usual. 19MAKEOVERRIDES = 20 21MAKE_HELPERS_DIRECTORY := make_helpers/ 22include ${MAKE_HELPERS_DIRECTORY}build_macros.mk 23include ${MAKE_HELPERS_DIRECTORY}build_env.mk 24 25################################################################################ 26# Default values for build configurations, and their dependencies 27################################################################################ 28 29ifdef ASM_ASSERTION 30 $(warning ASM_ASSERTION is removed, use ENABLE_ASSERTIONS instead.) 31endif 32 33include ${MAKE_HELPERS_DIRECTORY}defaults.mk 34 35# Assertions enabled for DEBUG builds by default 36ENABLE_ASSERTIONS := ${DEBUG} 37ENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 38PLAT := ${DEFAULT_PLAT} 39 40################################################################################ 41# Checkpatch script options 42################################################################################ 43 44CHECKCODE_ARGS := --no-patch 45# Do not check the coding style on imported library files or documentation files 46INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 47 include/lib/libfdt \ 48 include/lib/stdlib, \ 49 $(wildcard include/lib/*))) 50INC_DIRS_TO_CHECK := $(sort $(filter-out \ 51 include/lib, \ 52 $(wildcard include/*))) 53LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 54 lib/compiler-rt \ 55 lib/libfdt% \ 56 lib/stdlib, \ 57 $(wildcard lib/*))) 58ROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 59 lib \ 60 include \ 61 docs \ 62 %.md, \ 63 $(wildcard *))) 64CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 65 ${INC_DIRS_TO_CHECK} \ 66 ${INC_LIB_DIRS_TO_CHECK} \ 67 ${LIB_DIRS_TO_CHECK} 68 69 70################################################################################ 71# Process build options 72################################################################################ 73 74# Verbose flag 75ifeq (${V},0) 76 Q:=@ 77 CHECKCODE_ARGS += --no-summary --terse 78else 79 Q:= 80endif 81export Q 82 83# Process Debug flag 84$(eval $(call add_define,DEBUG)) 85ifneq (${DEBUG}, 0) 86 BUILD_TYPE := debug 87 TF_CFLAGS += -g 88 ASFLAGS += -g -Wa,--gdwarf-2 89 # Use LOG_LEVEL_INFO by default for debug builds 90 LOG_LEVEL := 40 91else 92 BUILD_TYPE := release 93 $(eval $(call add_define,NDEBUG)) 94 # Use LOG_LEVEL_NOTICE by default for release builds 95 LOG_LEVEL := 20 96endif 97 98# Default build string (git branch and commit) 99ifeq (${BUILD_STRING},) 100 BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 101endif 102VERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING} 103 104# The cert_create tool cannot generate certificates individually, so we use the 105# target 'certificates' to create them all 106ifneq (${GENERATE_COT},0) 107 FIP_DEPS += certificates 108 FWU_FIP_DEPS += fwu_certificates 109endif 110 111 112################################################################################ 113# Toolchain 114################################################################################ 115 116HOSTCC := gcc 117export HOSTCC 118 119CC := ${CROSS_COMPILE}gcc 120CPP := ${CROSS_COMPILE}cpp 121AS := ${CROSS_COMPILE}gcc 122AR := ${CROSS_COMPILE}ar 123LD := ${CROSS_COMPILE}ld 124OC := ${CROSS_COMPILE}objcopy 125OD := ${CROSS_COMPILE}objdump 126NM := ${CROSS_COMPILE}nm 127PP := ${CROSS_COMPILE}gcc -E 128 129ASFLAGS_aarch64 = -mgeneral-regs-only 130TF_CFLAGS_aarch64 = -mgeneral-regs-only -mstrict-align 131 132ASFLAGS_aarch32 = -march=armv8-a 133TF_CFLAGS_aarch32 = -march=armv8-a 134 135CPPFLAGS = ${DEFINES} ${INCLUDES} -nostdinc \ 136 -Wmissing-include-dirs -Werror 137ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ 138 -D__ASSEMBLY__ -ffreestanding \ 139 -Wa,--fatal-warnings 140TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 141 -ffreestanding -fno-builtin -Wall -std=gnu99 \ 142 -Os -ffunction-sections -fdata-sections 143 144LDFLAGS += --fatal-warnings -O1 145LDFLAGS += --gc-sections 146 147 148################################################################################ 149# Common sources and include directories 150################################################################################ 151include lib/compiler-rt/compiler-rt.mk 152include lib/stdlib/stdlib.mk 153 154BL_COMMON_SOURCES += common/bl_common.c \ 155 common/tf_printf.c \ 156 common/${ARCH}/debug.S \ 157 lib/${ARCH}/cache_helpers.S \ 158 lib/${ARCH}/misc_helpers.S \ 159 plat/common/${ARCH}/plat_common.c \ 160 plat/common/${ARCH}/platform_helpers.S \ 161 ${COMPILER_RT_SRCS} \ 162 ${STDLIB_SRCS} 163 164INCLUDES += -Iinclude/bl1 \ 165 -Iinclude/bl31 \ 166 -Iinclude/common \ 167 -Iinclude/common/${ARCH} \ 168 -Iinclude/drivers \ 169 -Iinclude/drivers/arm \ 170 -Iinclude/drivers/auth \ 171 -Iinclude/drivers/io \ 172 -Iinclude/drivers/ti/uart \ 173 -Iinclude/lib \ 174 -Iinclude/lib/${ARCH} \ 175 -Iinclude/lib/cpus \ 176 -Iinclude/lib/cpus/${ARCH} \ 177 -Iinclude/lib/el3_runtime \ 178 -Iinclude/lib/el3_runtime/${ARCH} \ 179 -Iinclude/lib/pmf \ 180 -Iinclude/lib/psci \ 181 -Iinclude/lib/xlat_tables \ 182 -Iinclude/plat/common \ 183 -Iinclude/services \ 184 ${PLAT_INCLUDES} \ 185 ${SPD_INCLUDES} \ 186 -Iinclude/tools_share 187 188 189################################################################################ 190# Generic definitions 191################################################################################ 192 193include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 194 195BUILD_BASE := ./build 196BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} 197 198SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 199 200# Platforms providing their own TBB makefile may override this value 201INCLUDE_TBBR_MK := 1 202 203 204################################################################################ 205# Include SPD Makefile if one has been specified 206################################################################################ 207 208ifneq (${SPD},none) 209ifeq (${ARCH},aarch32) 210 $(error "Error: SPD is incompatible with AArch32.") 211endif 212ifdef EL3_PAYLOAD_BASE 213 $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 214 $(warning "The SPD and its BL32 companion will be present but ignored.") 215endif 216 # We expect to locate an spd.mk under the specified SPD directory 217 SPD_MAKE := $(wildcard services/spd/${SPD}/${SPD}.mk) 218 219 ifeq (${SPD_MAKE},) 220 $(error Error: No services/spd/${SPD}/${SPD}.mk located) 221 endif 222 $(info Including ${SPD_MAKE}) 223 include ${SPD_MAKE} 224 225 # If there's BL32 companion for the chosen SPD, we expect that the SPD's 226 # Makefile would set NEED_BL32 to "yes". In this case, the build system 227 # supports two mutually exclusive options: 228 # * BL32 is built from source: then BL32_SOURCES must contain the list 229 # of source files to build BL32 230 # * BL32 is a prebuilt binary: then BL32 must point to the image file 231 # that will be included in the FIP 232 # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 233 # over the sources. 234endif 235 236################################################################################ 237# Include libraries' Makefile that are used in all BL 238################################################################################ 239 240include lib/stack_protector/stack_protector.mk 241 242 243################################################################################ 244# Include the platform specific Makefile after the SPD Makefile (the platform 245# makefile may use all previous definitions in this file) 246################################################################################ 247 248include ${PLAT_MAKEFILE_FULL} 249 250# Platform compatibility is not supported in AArch32 251ifneq (${ARCH},aarch32) 252# If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default 253ifndef ENABLE_PLAT_COMPAT 254ENABLE_PLAT_COMPAT := 1 255endif 256 257# Include the platform compatibility helpers for PSCI 258ifneq (${ENABLE_PLAT_COMPAT}, 0) 259include plat/compat/plat_compat.mk 260endif 261endif 262 263# Include the CPU specific operations makefile, which provides default 264# values for all CPU errata workarounds and CPU specific optimisations. 265# This can be overridden by the platform. 266include lib/cpus/cpu-ops.mk 267 268ifeq (${ARCH},aarch32) 269NEED_BL32 := yes 270 271################################################################################ 272# Build `AARCH32_SP` as BL32 image for AArch32 273################################################################################ 274ifneq (${AARCH32_SP},none) 275# We expect to locate an sp.mk under the specified AARCH32_SP directory 276AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 277 278ifeq (${AARCH32_SP_MAKE},) 279 $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 280endif 281 282$(info Including ${AARCH32_SP_MAKE}) 283include ${AARCH32_SP_MAKE} 284endif 285 286endif 287 288################################################################################ 289# Check incompatible options 290################################################################################ 291 292ifdef EL3_PAYLOAD_BASE 293 ifdef PRELOADED_BL33_BASE 294 $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 295 incompatible build options. EL3_PAYLOAD_BASE has priority.") 296 endif 297endif 298 299ifeq (${NEED_BL33},yes) 300 ifdef EL3_PAYLOAD_BASE 301 $(warning "BL33 image is not needed when option \ 302 BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 303 endif 304 ifdef PRELOADED_BL33_BASE 305 $(warning "BL33 image is not needed when option \ 306 PRELOADED_BL33_BASE is used and won't be added to the FIP \ 307 file.") 308 endif 309endif 310 311# For AArch32, LOAD_IMAGE_V2 must be enabled. 312ifeq (${ARCH},aarch32) 313 ifeq (${LOAD_IMAGE_V2}, 0) 314 $(error "For AArch32, LOAD_IMAGE_V2 must be enabled.") 315 endif 316endif 317 318# When building for systems with hardware-assisted coherency, there's no need to 319# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 320ifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 321$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 322endif 323 324################################################################################ 325# Process platform overrideable behaviour 326################################################################################ 327 328# Check if -pedantic option should be used 329ifeq (${DISABLE_PEDANTIC},0) 330 TF_CFLAGS += -pedantic 331endif 332 333# Using the ARM Trusted Firmware BL2 implies that a BL33 image also needs to be 334# supplied for the FIP and Certificate generation tools. This flag can be 335# overridden by the platform. 336ifdef BL2_SOURCES 337 ifdef EL3_PAYLOAD_BASE 338 # If booting an EL3 payload there is no need for a BL33 image 339 # in the FIP file. 340 NEED_BL33 := no 341 else 342 ifdef PRELOADED_BL33_BASE 343 # If booting a BL33 preloaded image there is no need of 344 # another one in the FIP file. 345 NEED_BL33 := no 346 else 347 NEED_BL33 ?= yes 348 endif 349 endif 350endif 351 352# If SCP_BL2 is given, we always want FIP to include it. 353ifdef SCP_BL2 354 NEED_SCP_BL2 := yes 355endif 356 357# Process TBB related flags 358ifneq (${GENERATE_COT},0) 359 # Common cert_create options 360 ifneq (${CREATE_KEYS},0) 361 $(eval CRT_ARGS += -n) 362 $(eval FWU_CRT_ARGS += -n) 363 ifneq (${SAVE_KEYS},0) 364 $(eval CRT_ARGS += -k) 365 $(eval FWU_CRT_ARGS += -k) 366 endif 367 endif 368 # Include TBBR makefile (unless the platform indicates otherwise) 369 ifeq (${INCLUDE_TBBR_MK},1) 370 include make_helpers/tbbr/tbbr_tools.mk 371 endif 372endif 373 374ifneq (${FIP_ALIGN},0) 375FIP_ARGS += --align ${FIP_ALIGN} 376endif 377 378################################################################################ 379# Auxiliary tools (fiptool, cert_create, etc) 380################################################################################ 381 382# Variables for use with Certificate Generation Tool 383CRTTOOLPATH ?= tools/cert_create 384CRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 385 386# Variables for use with Firmware Image Package 387FIPTOOLPATH ?= tools/fiptool 388FIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 389 390################################################################################ 391# Include BL specific makefiles 392################################################################################ 393ifdef BL1_SOURCES 394NEED_BL1 := yes 395include bl1/bl1.mk 396endif 397 398ifdef BL2_SOURCES 399NEED_BL2 := yes 400include bl2/bl2.mk 401endif 402 403ifdef BL2U_SOURCES 404NEED_BL2U := yes 405include bl2u/bl2u.mk 406endif 407 408# For AArch32, BL31 is not currently supported. 409ifneq (${ARCH},aarch32) 410ifdef BL31_SOURCES 411# When booting an EL3 payload, there is no need to compile the BL31 image nor 412# put it in the FIP. 413ifndef EL3_PAYLOAD_BASE 414NEED_BL31 := yes 415include bl31/bl31.mk 416endif 417endif 418endif 419 420################################################################################ 421# Build options checks 422################################################################################ 423 424$(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU)) 425$(eval $(call assert_boolean,CREATE_KEYS)) 426$(eval $(call assert_boolean,CTX_INCLUDE_AARCH32_REGS)) 427$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS)) 428$(eval $(call assert_boolean,DEBUG)) 429$(eval $(call assert_boolean,DISABLE_PEDANTIC)) 430$(eval $(call assert_boolean,ENABLE_ASSERTIONS)) 431$(eval $(call assert_boolean,ENABLE_PLAT_COMPAT)) 432$(eval $(call assert_boolean,ENABLE_PMF)) 433$(eval $(call assert_boolean,ENABLE_PSCI_STAT)) 434$(eval $(call assert_boolean,ENABLE_RUNTIME_INSTRUMENTATION)) 435$(eval $(call assert_boolean,ERROR_DEPRECATED)) 436$(eval $(call assert_boolean,GENERATE_COT)) 437$(eval $(call assert_boolean,HW_ASSISTED_COHERENCY)) 438$(eval $(call assert_boolean,LOAD_IMAGE_V2)) 439$(eval $(call assert_boolean,NS_TIMER_SWITCH)) 440$(eval $(call assert_boolean,PL011_GENERIC_UART)) 441$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS)) 442$(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID)) 443$(eval $(call assert_boolean,RESET_TO_BL31)) 444$(eval $(call assert_boolean,SAVE_KEYS)) 445$(eval $(call assert_boolean,SEPARATE_CODE_AND_RODATA)) 446$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT)) 447$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT)) 448$(eval $(call assert_boolean,USE_COHERENT_MEM)) 449$(eval $(call assert_boolean,USE_TBBR_DEFS)) 450$(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY)) 451 452$(eval $(call assert_numeric,ARM_ARCH_MAJOR)) 453$(eval $(call assert_numeric,ARM_ARCH_MINOR)) 454 455################################################################################ 456# Add definitions to the cpp preprocessor based on the current build options. 457# This is done after including the platform specific makefile to allow the 458# platform to overwrite the default options 459################################################################################ 460 461$(eval $(call add_define,ARM_CCI_PRODUCT_ID)) 462$(eval $(call add_define,ARM_ARCH_MAJOR)) 463$(eval $(call add_define,ARM_ARCH_MINOR)) 464$(eval $(call add_define,ARM_GIC_ARCH)) 465$(eval $(call add_define,COLD_BOOT_SINGLE_CPU)) 466$(eval $(call add_define,CTX_INCLUDE_AARCH32_REGS)) 467$(eval $(call add_define,CTX_INCLUDE_FPREGS)) 468$(eval $(call add_define,ENABLE_ASSERTIONS)) 469$(eval $(call add_define,ENABLE_PLAT_COMPAT)) 470$(eval $(call add_define,ENABLE_PMF)) 471$(eval $(call add_define,ENABLE_PSCI_STAT)) 472$(eval $(call add_define,ENABLE_RUNTIME_INSTRUMENTATION)) 473$(eval $(call add_define,ERROR_DEPRECATED)) 474$(eval $(call add_define,HW_ASSISTED_COHERENCY)) 475$(eval $(call add_define,LOAD_IMAGE_V2)) 476$(eval $(call add_define,LOG_LEVEL)) 477$(eval $(call add_define,NS_TIMER_SWITCH)) 478$(eval $(call add_define,PL011_GENERIC_UART)) 479$(eval $(call add_define,PLAT_${PLAT})) 480$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS)) 481$(eval $(call add_define,PSCI_EXTENDED_STATE_ID)) 482$(eval $(call add_define,RESET_TO_BL31)) 483$(eval $(call add_define,SEPARATE_CODE_AND_RODATA)) 484$(eval $(call add_define,SPD_${SPD})) 485$(eval $(call add_define,SPIN_ON_BL1_EXIT)) 486$(eval $(call add_define,TRUSTED_BOARD_BOOT)) 487$(eval $(call add_define,USE_COHERENT_MEM)) 488$(eval $(call add_define,USE_TBBR_DEFS)) 489$(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY)) 490 491# Define the EL3_PAYLOAD_BASE flag only if it is provided. 492ifdef EL3_PAYLOAD_BASE 493 $(eval $(call add_define,EL3_PAYLOAD_BASE)) 494else 495 # Define the PRELOADED_BL33_BASE flag only if it is provided and 496 # EL3_PAYLOAD_BASE is not defined, as it has priority. 497 ifdef PRELOADED_BL33_BASE 498 $(eval $(call add_define,PRELOADED_BL33_BASE)) 499 endif 500endif 501# Define the AARCH32/AARCH64 flag based on the ARCH flag 502ifeq (${ARCH},aarch32) 503 $(eval $(call add_define,AARCH32)) 504else 505 $(eval $(call add_define,AARCH64)) 506endif 507 508################################################################################ 509# Build targets 510################################################################################ 511 512.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip fwu_fip certtool 513.SUFFIXES: 514 515all: msg_start 516 517msg_start: 518 @echo "Building ${PLAT}" 519 520# Check if deprecated declarations should be treated as error or not. 521ifeq (${ERROR_DEPRECATED},0) 522 TF_CFLAGS += -Wno-error=deprecated-declarations 523endif 524 525# Expand build macros for the different images 526ifeq (${NEED_BL1},yes) 527$(eval $(call MAKE_BL,1)) 528endif 529 530ifeq (${NEED_BL2},yes) 531$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},tb-fw)),\ 532 $(eval $(call MAKE_BL,2,tb-fw))) 533endif 534 535ifeq (${NEED_SCP_BL2},yes) 536$(eval $(call FIP_ADD_IMG,SCP_BL2,--scp-fw)) 537endif 538 539ifeq (${NEED_BL31},yes) 540BL31_SOURCES += ${SPD_SOURCES} 541$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},soc-fw)),\ 542 $(eval $(call MAKE_BL,31,soc-fw))) 543endif 544 545# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 546# build system will call FIP_ADD_IMG to print a warning message and abort the 547# process. Note that the dependency on BL32 applies to the FIP only. 548ifeq (${NEED_BL32},yes) 549$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},tos-fw)),\ 550 $(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\ 551 $(eval $(call FIP_ADD_IMG,BL32,--tos-fw)))) 552endif 553 554# Add the BL33 image if required by the platform 555ifeq (${NEED_BL33},yes) 556$(eval $(call FIP_ADD_IMG,BL33,--nt-fw)) 557endif 558 559ifeq (${NEED_BL2U},yes) 560BL2U_PATH := $(if ${BL2U},${BL2U},$(call IMG_BIN,2u)) 561$(if ${BL2U}, ,$(eval $(call MAKE_BL,2u))) 562$(eval $(call FWU_FIP_ADD_PAYLOAD,${BL2U_PATH},--ap-fwu-cfg)) 563endif 564 565locate-checkpatch: 566ifndef CHECKPATCH 567 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl") 568else 569ifeq (,$(wildcard ${CHECKPATCH})) 570 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl") 571endif 572endif 573 574clean: 575 @echo " CLEAN" 576 $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 577 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 578 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 579 580realclean distclean: 581 @echo " REALCLEAN" 582 $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 583 $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 584 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 585 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 586 587checkcodebase: locate-checkpatch 588 @echo " CHECKING STYLE" 589 @if test -d .git ; then \ 590 git ls-files | grep -E -v 'libfdt|stdlib|docs|\.md' | \ 591 while read GIT_FILE ; \ 592 do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 593 done ; \ 594 else \ 595 find . -type f -not -iwholename "*.git*" \ 596 -not -iwholename "*build*" \ 597 -not -iwholename "*libfdt*" \ 598 -not -iwholename "*stdlib*" \ 599 -not -iwholename "*docs*" \ 600 -not -iwholename "*.md" \ 601 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 602 fi 603 604checkpatch: locate-checkpatch 605 @echo " CHECKING STYLE" 606 ${Q}git format-patch --stdout ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} - || true 607 608certtool: ${CRTTOOL} 609 610.PHONY: ${CRTTOOL} 611${CRTTOOL}: 612 ${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} --no-print-directory -C ${CRTTOOLPATH} 613 @${ECHO_BLANK_LINE} 614 @echo "Built $@ successfully" 615 @${ECHO_BLANK_LINE} 616 617ifneq (${GENERATE_COT},0) 618certificates: ${CRT_DEPS} ${CRTTOOL} 619 ${Q}${CRTTOOL} ${CRT_ARGS} 620 @${ECHO_BLANK_LINE} 621 @echo "Built $@ successfully" 622 @echo "Certificates can be found in ${BUILD_PLAT}" 623 @${ECHO_BLANK_LINE} 624endif 625 626${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 627 ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 628 ${Q}${FIPTOOL} info $@ 629 @${ECHO_BLANK_LINE} 630 @echo "Built $@ successfully" 631 @${ECHO_BLANK_LINE} 632 633ifneq (${GENERATE_COT},0) 634fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 635 ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 636 @${ECHO_BLANK_LINE} 637 @echo "Built $@ successfully" 638 @echo "FWU certificates can be found in ${BUILD_PLAT}" 639 @${ECHO_BLANK_LINE} 640endif 641 642${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 643 ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 644 ${Q}${FIPTOOL} info $@ 645 @${ECHO_BLANK_LINE} 646 @echo "Built $@ successfully" 647 @${ECHO_BLANK_LINE} 648 649fiptool: ${FIPTOOL} 650fip: ${BUILD_PLAT}/${FIP_NAME} 651fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 652 653.PHONY: ${FIPTOOL} 654${FIPTOOL}: 655 ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${FIPTOOLPATH} 656 657cscope: 658 @echo " CSCOPE" 659 ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 660 ${Q}cscope -b -q -k 661 662help: 663 @echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]" 664 @echo "" 665 @echo "PLAT is used to specify which platform you wish to build." 666 @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 667 @echo "" 668 @echo "Please refer to the User Guide for a list of all supported options." 669 @echo "Note that the build system doesn't track dependencies for build " 670 @echo "options. Therefore, if any of the build options are changed " 671 @echo "from a previous build, a clean build must be performed." 672 @echo "" 673 @echo "Supported Targets:" 674 @echo " all Build all individual bootloader binaries" 675 @echo " bl1 Build the BL1 binary" 676 @echo " bl2 Build the BL2 binary" 677 @echo " bl2u Build the BL2U binary" 678 @echo " bl31 Build the BL31 binary" 679 @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 680 @echo " this builds secure payload specified by AARCH32_SP" 681 @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 682 @echo " fip Build the Firmware Image Package (FIP)" 683 @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 684 @echo " checkcodebase Check the coding style of the entire source tree" 685 @echo " checkpatch Check the coding style on changes in the current" 686 @echo " branch against BASE_COMMIT (default origin/master)" 687 @echo " clean Clean the build for the selected platform" 688 @echo " cscope Generate cscope index" 689 @echo " distclean Remove all build artifacts for all platforms" 690 @echo " certtool Build the Certificate generation tool" 691 @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 692 @echo "" 693 @echo "Note: most build targets require PLAT to be set to a specific platform." 694 @echo "" 695 @echo "example: build all targets for the FVP platform:" 696 @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 697