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