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