14f6ad66aSAchin Gupta# 254035fc4SSandrine Bailleux# Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta# 44f6ad66aSAchin Gupta# Redistribution and use in source and binary forms, with or without 54f6ad66aSAchin Gupta# modification, are permitted provided that the following conditions are met: 64f6ad66aSAchin Gupta# 74f6ad66aSAchin Gupta# Redistributions of source code must retain the above copyright notice, this 84f6ad66aSAchin Gupta# list of conditions and the following disclaimer. 94f6ad66aSAchin Gupta# 104f6ad66aSAchin Gupta# Redistributions in binary form must reproduce the above copyright notice, 114f6ad66aSAchin Gupta# this list of conditions and the following disclaimer in the documentation 124f6ad66aSAchin Gupta# and/or other materials provided with the distribution. 134f6ad66aSAchin Gupta# 144f6ad66aSAchin Gupta# Neither the name of ARM nor the names of its contributors may be used 154f6ad66aSAchin Gupta# to endorse or promote products derived from this software without specific 164f6ad66aSAchin Gupta# prior written permission. 174f6ad66aSAchin Gupta# 184f6ad66aSAchin Gupta# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 194f6ad66aSAchin Gupta# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 204f6ad66aSAchin Gupta# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214f6ad66aSAchin Gupta# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 224f6ad66aSAchin Gupta# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 234f6ad66aSAchin Gupta# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 244f6ad66aSAchin Gupta# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 254f6ad66aSAchin Gupta# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 264f6ad66aSAchin Gupta# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 274f6ad66aSAchin Gupta# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 284f6ad66aSAchin Gupta# POSSIBILITY OF SUCH DAMAGE. 294f6ad66aSAchin Gupta# 304f6ad66aSAchin Gupta 31e35c4045SJeenu Viswambharan# 32aaa3e722SJuan Castillo# Trusted Firmware Version 33aaa3e722SJuan Castillo# 34c6249aaaSDan HandleyVERSION_MAJOR := 1 356791f52eSDan HandleyVERSION_MINOR := 2 36aaa3e722SJuan Castillo 3788154678SJuan Castillo# Default goal is build all images 3888154678SJuan Castillo.DEFAULT_GOAL := all 3988154678SJuan Castillo 40231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/ 41231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 42e7f54dbdSEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk 4373c99d4eSJuan Castillo 4473c99d4eSJuan Castillo################################################################################ 45e35c4045SJeenu Viswambharan# Default values for build configurations 4673c99d4eSJuan Castillo################################################################################ 47e35c4045SJeenu Viswambharan 489d29c227SSoby Mathew# The Target build architecture. Supported values are: aarch64, aarch32. 49031dbb12SSoby MathewARCH := aarch64 50e35c4045SJeenu Viswambharan# Build verbosity 51e35c4045SJeenu ViswambharanV := 0 52e35c4045SJeenu Viswambharan# Debug build 53e35c4045SJeenu ViswambharanDEBUG := 0 54e35c4045SJeenu Viswambharan# Build platform 55e35c4045SJeenu ViswambharanDEFAULT_PLAT := fvp 56e35c4045SJeenu ViswambharanPLAT := ${DEFAULT_PLAT} 57e35c4045SJeenu Viswambharan# SPD choice 58e35c4045SJeenu ViswambharanSPD := none 599d29c227SSoby Mathew# The AArch32 Secure Payload to be built as BL32 image 609d29c227SSoby MathewAARCH32_SP := none 61e35c4045SJeenu Viswambharan# Base commit to perform code check on 62e35c4045SJeenu ViswambharanBASE_COMMIT := origin/master 632da8d8bfSJeenu Viswambharan# NS timer register save and restore 642da8d8bfSJeenu ViswambharanNS_TIMER_SWITCH := 0 651645d3eeSSandrine Bailleux# By default, BL1 acts as the reset handler, not BL31 66dbad1bacSVikram KanigiriRESET_TO_BL31 := 0 670f21c547SJuan Castillo# Include FP registers in cpu context 680f21c547SJuan CastilloCTX_INCLUDE_FPREGS := 0 698cd16e6bSSoby Mathew# Build flag to include AArch32 registers in cpu context save and restore 708cd16e6bSSoby Mathew# during world switch. This flag must be set to 0 for AArch64-only platforms. 718cd16e6bSSoby MathewCTX_INCLUDE_AARCH32_REGS := 1 722b98e789SSandrine Bailleux# Determine the version of ARM GIC architecture to use for interrupt management 732b98e789SSandrine Bailleux# in EL3. The platform port can change this value if needed. 742b98e789SSandrine BailleuxARM_GIC_ARCH := 2 7523e47edeSVikram Kanigiri# Determine the version of ARM CCI product used in the platform. The platform 7623e47edeSVikram Kanigiri# port can change this value if needed. 7723e47edeSVikram KanigiriARM_CCI_PRODUCT_ID := 400 78bc920128SSoby Mathew# Flag used to indicate if ASM_ASSERTION should be enabled for the build. 79bc920128SSoby Mathew# This defaults to being present in DEBUG builds only. 80bc920128SSoby MathewASM_ASSERTION := ${DEBUG} 818c5fe0b5SSoby Mathew# Build option to choose whether Trusted firmware uses Coherent memory or not. 828c5fe0b5SSoby MathewUSE_COHERENT_MEM := 1 838ee24980SSoby Mathew# Flag used to choose the power state format viz Extended State-ID or the Original 848ee24980SSoby Mathew# format. 858ee24980SSoby MathewPSCI_EXTENDED_STATE_ID := 0 867f48fab9SJuan Castillo# Default FIP file name 877f48fab9SJuan CastilloFIP_NAME := fip.bin 880191262dSYatharth Kochar# Default FWU_FIP file name 890191262dSYatharth KocharFWU_FIP_NAME := fwu_fip.bin 90db6071c9SJuan Castillo# By default, use the -pedantic option in the gcc command line 91db6071c9SJuan CastilloDISABLE_PEDANTIC := 0 926f971622SJuan Castillo# Flags to generate the Chain of Trust 936f971622SJuan CastilloGENERATE_COT := 0 946f971622SJuan CastilloCREATE_KEYS := 1 95fd34e7baSJuan CastilloSAVE_KEYS := 0 966eadf762SJuan Castillo# Flags to build TF with Trusted Boot support 976eadf762SJuan CastilloTRUSTED_BOARD_BOOT := 0 98bf031bbaSSandrine Bailleux# By default, consider that the platform's reset address is not programmable. 99bf031bbaSSandrine Bailleux# The platform Makefile is free to override this value. 100bf031bbaSSandrine BailleuxPROGRAMMABLE_RESET_ADDRESS := 0 1017a24cba5SSoby Mathew# Build flag to treat usage of deprecated platform and framework APIs as error. 1027a24cba5SSoby MathewERROR_DEPRECATED := 0 103a9bec67dSSandrine Bailleux# By default, consider that the platform may release several CPUs out of reset. 104a9bec67dSSandrine Bailleux# The platform Makefile is free to override this value. 105a9bec67dSSandrine BailleuxCOLD_BOOT_SINGLE_CPU := 0 10635e8c766SSandrine Bailleux# Flag to introduce an infinite loop in BL1 just before it exits into the next 10735e8c766SSandrine Bailleux# image. This is meant to help debugging the post-BL2 phase. 10835e8c766SSandrine BailleuxSPIN_ON_BL1_EXIT := 0 10912f654b6SJuan Castillo# Build PL011 UART driver in minimal generic UART mode 11012f654b6SJuan CastilloPL011_GENERIC_UART := 0 111a31d8983SYatharth Kochar# Flag to enable Performance Measurement Framework 112a31d8983SYatharth KocharENABLE_PMF := 0 113170fb93dSYatharth Kochar# Flag to enable PSCI STATs functionality 114170fb93dSYatharth KocharENABLE_PSCI_STAT := 0 1155d1c104fSSandrine Bailleux# Whether code and read-only data should be put on separate memory pages. 1165d1c104fSSandrine Bailleux# The platform Makefile is free to override this value. 1175d1c104fSSandrine BailleuxSEPARATE_CODE_AND_RODATA := 0 11872600226SYatharth Kochar# Flag to enable new version of image loading 11972600226SYatharth KocharLOAD_IMAGE_V2 := 0 12073c99d4eSJuan Castillo 12173c99d4eSJuan Castillo################################################################################ 12273c99d4eSJuan Castillo# Checkpatch script options 12373c99d4eSJuan Castillo################################################################################ 12473c99d4eSJuan Castillo 125f607739cSSandrine BailleuxCHECKCODE_ARGS := --no-patch 126f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files 127f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 1281a41e8c1SDan Handley include/lib/libfdt \ 129f0b489c1SDan Handley include/lib/stdlib, \ 130f0b489c1SDan Handley $(wildcard include/lib/*))) 131f0b489c1SDan HandleyINC_DIRS_TO_CHECK := $(sort $(filter-out \ 132f0b489c1SDan Handley include/lib, \ 133f0b489c1SDan Handley $(wildcard include/*))) 134f0b489c1SDan HandleyLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 1351a41e8c1SDan Handley lib/libfdt \ 136f0b489c1SDan Handley lib/stdlib, \ 137f0b489c1SDan Handley $(wildcard lib/*))) 138f0b489c1SDan HandleyROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 139f0b489c1SDan Handley lib \ 140f0b489c1SDan Handley include \ 141f0b489c1SDan Handley docs \ 142f0b489c1SDan Handley %.md, \ 143f0b489c1SDan Handley $(wildcard *))) 144f0b489c1SDan HandleyCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 145f0b489c1SDan Handley ${INC_DIRS_TO_CHECK} \ 146f0b489c1SDan Handley ${INC_LIB_DIRS_TO_CHECK} \ 147f0b489c1SDan Handley ${LIB_DIRS_TO_CHECK} 14836eaaf37SIan Spray 14973c99d4eSJuan Castillo 15073c99d4eSJuan Castillo################################################################################ 15173c99d4eSJuan Castillo# Process build options 15273c99d4eSJuan Castillo################################################################################ 15373c99d4eSJuan Castillo 15473c99d4eSJuan Castillo# Verbose flag 155e35c4045SJeenu Viswambharanifeq (${V},0) 156b169f6a9SEvan Lloyd Q:=@ 15736eaaf37SIan Spray CHECKCODE_ARGS += --no-summary --terse 1584f6ad66aSAchin Guptaelse 159b169f6a9SEvan Lloyd Q:= 1604f6ad66aSAchin Guptaendif 1612f2cef46SJeenu Viswambharanexport Q 1622f2cef46SJeenu Viswambharan 16373c99d4eSJuan Castillo# Process Debug flag 16473c99d4eSJuan Castillo$(eval $(call add_define,DEBUG)) 165eaaeece2SJames Morrisseyifneq (${DEBUG}, 0) 166eaaeece2SJames Morrissey BUILD_TYPE := debug 167403973c9SSandrine Bailleux TF_CFLAGS += -g 16873c99d4eSJuan Castillo ASFLAGS += -g -Wa,--gdwarf-2 169289c28a8SDan Handley # Use LOG_LEVEL_INFO by default for debug builds 170289c28a8SDan Handley LOG_LEVEL := 40 171eaaeece2SJames Morrisseyelse 172eaaeece2SJames Morrissey BUILD_TYPE := release 17373c99d4eSJuan Castillo $(eval $(call add_define,NDEBUG)) 174289c28a8SDan Handley # Use LOG_LEVEL_NOTICE by default for release builds 175289c28a8SDan Handley LOG_LEVEL := 20 176eaaeece2SJames Morrisseyendif 177eaaeece2SJames Morrissey 178aaa3e722SJuan Castillo# Default build string (git branch and commit) 179aaa3e722SJuan Castilloifeq (${BUILD_STRING},) 180aaa3e722SJuan Castillo BUILD_STRING := $(shell git log -n 1 --pretty=format:"%h") 181aaa3e722SJuan Castilloendif 182aaa3e722SJuan CastilloVERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING} 183aaa3e722SJuan Castillo 18473c99d4eSJuan Castillo# The cert_create tool cannot generate certificates individually, so we use the 18573c99d4eSJuan Castillo# target 'certificates' to create them all 18673c99d4eSJuan Castilloifneq (${GENERATE_COT},0) 18773c99d4eSJuan Castillo FIP_DEPS += certificates 1880191262dSYatharth Kochar FWU_FIP_DEPS += fwu_certificates 18973c99d4eSJuan Castilloendif 19073c99d4eSJuan Castillo 1911a0a3f06SYatharth Kochar# For AArch32, enable new version of image loading. 1921a0a3f06SYatharth Kocharifeq (${ARCH},aarch32) 1931a0a3f06SYatharth Kochar LOAD_IMAGE_V2 := 1 1941a0a3f06SYatharth Kocharendif 19573c99d4eSJuan Castillo 19673c99d4eSJuan Castillo################################################################################ 19773c99d4eSJuan Castillo# Toolchain 19873c99d4eSJuan Castillo################################################################################ 19973c99d4eSJuan Castillo 20073c99d4eSJuan CastilloCC := ${CROSS_COMPILE}gcc 20173c99d4eSJuan CastilloCPP := ${CROSS_COMPILE}cpp 20273c99d4eSJuan CastilloAS := ${CROSS_COMPILE}gcc 20373c99d4eSJuan CastilloAR := ${CROSS_COMPILE}ar 20473c99d4eSJuan CastilloLD := ${CROSS_COMPILE}ld 20573c99d4eSJuan CastilloOC := ${CROSS_COMPILE}objcopy 20673c99d4eSJuan CastilloOD := ${CROSS_COMPILE}objdump 20773c99d4eSJuan CastilloNM := ${CROSS_COMPILE}nm 20873c99d4eSJuan CastilloPP := ${CROSS_COMPILE}gcc -E 20973c99d4eSJuan Castillo 2109d29c227SSoby MathewASFLAGS_aarch64 = -mgeneral-regs-only 2119d29c227SSoby MathewTF_CFLAGS_aarch64 = -mgeneral-regs-only -mstrict-align 2129d29c227SSoby Mathew 2139d29c227SSoby MathewASFLAGS_aarch32 = -march=armv8-a 2149d29c227SSoby MathewTF_CFLAGS_aarch32 = -march=armv8-a 2159d29c227SSoby Mathew 21673c99d4eSJuan CastilloASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \ 21773c99d4eSJuan Castillo -Werror -Wmissing-include-dirs \ 2189d29c227SSoby Mathew -D__ASSEMBLY__ $(ASFLAGS_$(ARCH)) \ 21973c99d4eSJuan Castillo ${DEFINES} ${INCLUDES} 220403973c9SSandrine BailleuxTF_CFLAGS += -nostdinc -ffreestanding -Wall \ 22173c99d4eSJuan Castillo -Werror -Wmissing-include-dirs \ 222fa1d3712SJuan Castillo -std=c99 -c -Os \ 2239d29c227SSoby Mathew $(TF_CFLAGS_$(ARCH)) \ 22473c99d4eSJuan Castillo ${DEFINES} ${INCLUDES} 225403973c9SSandrine BailleuxTF_CFLAGS += -ffunction-sections -fdata-sections 22673c99d4eSJuan Castillo 22773c99d4eSJuan CastilloLDFLAGS += --fatal-warnings -O1 22873c99d4eSJuan CastilloLDFLAGS += --gc-sections 22973c99d4eSJuan Castillo 23073c99d4eSJuan Castillo 23173c99d4eSJuan Castillo################################################################################ 23273c99d4eSJuan Castillo# Common sources and include directories 23373c99d4eSJuan Castillo################################################################################ 234f0b489c1SDan Handleyinclude lib/stdlib/stdlib.mk 23573c99d4eSJuan Castillo 23673c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 237b79af934SSoby Mathew common/tf_printf.c \ 2389d29c227SSoby Mathew common/${ARCH}/debug.S \ 2399d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 2409d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 2419d29c227SSoby Mathew plat/common/${ARCH}/platform_helpers.S \ 242f0b489c1SDan Handley ${STDLIB_SRCS} 243d7a6b0f8SRyan Harkin 24448bfb88eSYatharth KocharINCLUDES += -Iinclude/bl1 \ 24548bfb88eSYatharth Kochar -Iinclude/bl31 \ 2464ecca339SDan Handley -Iinclude/common \ 2479d29c227SSoby Mathew -Iinclude/common/${ARCH} \ 2484ecca339SDan Handley -Iinclude/drivers \ 2494ecca339SDan Handley -Iinclude/drivers/arm \ 2501779ba6bSJuan Castillo -Iinclude/drivers/auth \ 251935db693SDan Handley -Iinclude/drivers/io \ 252c13b2e32SVarun Wadekar -Iinclude/drivers/ti/uart \ 2534ecca339SDan Handley -Iinclude/lib \ 2549d29c227SSoby Mathew -Iinclude/lib/${ARCH} \ 2559d29c227SSoby Mathew -Iinclude/lib/cpus/${ARCH} \ 256532ed618SSoby Mathew -Iinclude/lib/el3_runtime \ 2579d29c227SSoby Mathew -Iinclude/lib/el3_runtime/${ARCH} \ 258afdda571Sdp-arm -Iinclude/lib/pmf \ 259532ed618SSoby Mathew -Iinclude/lib/psci \ 2605f0cdb05SDan Handley -Iinclude/plat/common \ 261532ed618SSoby Mathew -Iinclude/services \ 262375f538aSAchin Gupta ${PLAT_INCLUDES} \ 263375f538aSAchin Gupta ${SPD_INCLUDES} 2644f6ad66aSAchin Gupta 26573c99d4eSJuan Castillo 26673c99d4eSJuan Castillo################################################################################ 26773c99d4eSJuan Castillo# Generic definitions 26873c99d4eSJuan Castillo################################################################################ 26973c99d4eSJuan Castillo 270231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 271231c1470SEvan Lloyd 27273c99d4eSJuan CastilloBUILD_BASE := ./build 27373c99d4eSJuan CastilloBUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} 27473c99d4eSJuan Castillo 275231c1470SEvan LloydSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 27673c99d4eSJuan Castillo 27773c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value 27873c99d4eSJuan CastilloINCLUDE_TBBR_MK := 1 27973c99d4eSJuan Castillo 28073c99d4eSJuan Castillo 28173c99d4eSJuan Castillo################################################################################ 28273c99d4eSJuan Castillo# Include SPD Makefile if one has been specified 28373c99d4eSJuan Castillo################################################################################ 28473c99d4eSJuan Castillo 28573c99d4eSJuan Castilloifneq (${SPD},none) 2869d29c227SSoby Mathewifeq (${ARCH},aarch32) 2879d29c227SSoby Mathew $(error "Error: SPD is incompatible with AArch32.") 2889d29c227SSoby Mathewendif 2894c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 2904c117f6cSSandrine Bailleux $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 2914c117f6cSSandrine Bailleux $(warning "The SPD and its BL32 companion will be present but ignored.") 2924c117f6cSSandrine Bailleuxendif 29373c99d4eSJuan Castillo # We expect to locate an spd.mk under the specified SPD directory 294231c1470SEvan Lloyd SPD_MAKE := $(wildcard services/spd/${SPD}/${SPD}.mk) 29573c99d4eSJuan Castillo 29673c99d4eSJuan Castillo ifeq (${SPD_MAKE},) 29773c99d4eSJuan Castillo $(error Error: No services/spd/${SPD}/${SPD}.mk located) 29873c99d4eSJuan Castillo endif 29973c99d4eSJuan Castillo $(info Including ${SPD_MAKE}) 30073c99d4eSJuan Castillo include ${SPD_MAKE} 30173c99d4eSJuan Castillo 30270d1fc53SJuan Castillo # If there's BL32 companion for the chosen SPD, we expect that the SPD's 30370d1fc53SJuan Castillo # Makefile would set NEED_BL32 to "yes". In this case, the build system 30470d1fc53SJuan Castillo # supports two mutually exclusive options: 30570d1fc53SJuan Castillo # * BL32 is built from source: then BL32_SOURCES must contain the list 30670d1fc53SJuan Castillo # of source files to build BL32 30770d1fc53SJuan Castillo # * BL32 is a prebuilt binary: then BL32 must point to the image file 30870d1fc53SJuan Castillo # that will be included in the FIP 30970d1fc53SJuan Castillo # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 31070d1fc53SJuan Castillo # over the sources. 311e35c4045SJeenu Viswambharanendif 312e35c4045SJeenu Viswambharan 313c04d2606SDan Handley 31473c99d4eSJuan Castillo################################################################################ 31573c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform 31673c99d4eSJuan Castillo# makefile may use all previous definitions in this file) 31773c99d4eSJuan Castillo################################################################################ 3182da8d8bfSJeenu Viswambharan 31973c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL} 3200f21c547SJuan Castillo 3219d29c227SSoby Mathew# Platform compatibility is not supported in AArch32 3229d29c227SSoby Mathewifneq (${ARCH},aarch32) 32393271a1eSAchin Gupta# If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default 32493271a1eSAchin Guptaifndef ENABLE_PLAT_COMPAT 32593271a1eSAchin GuptaENABLE_PLAT_COMPAT := 1 32693271a1eSAchin Guptaendif 32793271a1eSAchin Gupta 32893271a1eSAchin Gupta# Include the platform compatibility helpers for PSCI 32993271a1eSAchin Guptaifneq (${ENABLE_PLAT_COMPAT}, 0) 33093271a1eSAchin Guptainclude plat/compat/plat_compat.mk 33193271a1eSAchin Guptaendif 3329d29c227SSoby Mathewendif 33393271a1eSAchin Gupta 33454035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default 33554035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations. 33654035fc4SSandrine Bailleux# This can be overridden by the platform. 33773c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk 3384f6ad66aSAchin Gupta 3394f6ad66aSAchin Gupta 34073c99d4eSJuan Castillo################################################################################ 341cf2c8a33SAntonio Nino Diaz# Check incompatible options 342cf2c8a33SAntonio Nino Diaz################################################################################ 343cf2c8a33SAntonio Nino Diaz 344cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE 34568450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 34668450a6dSAntonio Nino Diaz $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 34768450a6dSAntonio Nino Diaz incompatible build options. EL3_PAYLOAD_BASE has priority.") 348cf2c8a33SAntonio Nino Diaz endif 349cf2c8a33SAntonio Nino Diazendif 350cf2c8a33SAntonio Nino Diaz 351cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes) 352cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 353cf2c8a33SAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 354cf2c8a33SAntonio Nino Diaz BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 355cf2c8a33SAntonio Nino Diaz endif 35668450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 35768450a6dSAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 35868450a6dSAntonio Nino Diaz PRELOADED_BL33_BASE is used and won't be added to the FIP \ 35968450a6dSAntonio Nino Diaz file.") 360cf2c8a33SAntonio Nino Diaz endif 361cf2c8a33SAntonio Nino Diazendif 362cf2c8a33SAntonio Nino Diaz 36372600226SYatharth Kochar# TRUSTED_BOARD_BOOT is currently not supported when LOAD_IMAGE_V2 is enabled. 36472600226SYatharth Kocharifeq (${LOAD_IMAGE_V2},1) 36572600226SYatharth Kochar ifeq (${TRUSTED_BOARD_BOOT},1) 36672600226SYatharth Kochar $(error "TRUSTED_BOARD_BOOT is currently not supported \ 36772600226SYatharth Kochar for LOAD_IMAGE_V2=1") 36872600226SYatharth Kochar endif 36972600226SYatharth Kocharendif 370cf2c8a33SAntonio Nino Diaz 3711a0a3f06SYatharth Kochar# For AArch32, LOAD_IMAGE_V2 must be enabled. 3721a0a3f06SYatharth Kocharifeq (${ARCH},aarch32) 3731a0a3f06SYatharth Kochar ifeq (${LOAD_IMAGE_V2}, 0) 3741a0a3f06SYatharth Kochar $(error "For AArch32, LOAD_IMAGE_V2 must be enabled.") 3751a0a3f06SYatharth Kochar endif 3761a0a3f06SYatharth Kocharendif 3771a0a3f06SYatharth Kochar 3781a0a3f06SYatharth Kochar 379cf2c8a33SAntonio Nino Diaz################################################################################ 38073c99d4eSJuan Castillo# Process platform overrideable behaviour 38173c99d4eSJuan Castillo################################################################################ 3824f6ad66aSAchin Gupta 38373c99d4eSJuan Castillo# Check if -pedantic option should be used 38473c99d4eSJuan Castilloifeq (${DISABLE_PEDANTIC},0) 385403973c9SSandrine Bailleux TF_CFLAGS += -pedantic 38673c99d4eSJuan Castilloendif 387f58ad36fSHarry Liebel 3881645d3eeSSandrine Bailleux# Using the ARM Trusted Firmware BL2 implies that a BL33 image also needs to be 38973c99d4eSJuan Castillo# supplied for the FIP and Certificate generation tools. This flag can be 39073c99d4eSJuan Castillo# overridden by the platform. 39173c99d4eSJuan Castilloifdef BL2_SOURCES 392cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 393cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 394cf2c8a33SAntonio Nino Diaz # in the FIP file. 3954c117f6cSSandrine Bailleux NEED_BL33 := no 396cf2c8a33SAntonio Nino Diaz else 39768450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 398cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 399cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 400cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 401cf2c8a33SAntonio Nino Diaz else 402cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 403cf2c8a33SAntonio Nino Diaz endif 4044c117f6cSSandrine Bailleux endif 40573c99d4eSJuan Castilloendif 4066f971622SJuan Castillo 40773c99d4eSJuan Castillo# Process TBB related flags 4086f971622SJuan Castilloifneq (${GENERATE_COT},0) 40973c99d4eSJuan Castillo # Common cert_create options 4106f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 4116f971622SJuan Castillo $(eval CRT_ARGS += -n) 4120191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 413fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 414fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 4150191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 416fd34e7baSJuan Castillo endif 4176f971622SJuan Castillo endif 41873c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 41973c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 42073c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 42173c99d4eSJuan Castillo endif 4226f971622SJuan Castilloendif 4236f971622SJuan Castillo 424170fb93dSYatharth Kochar# Make sure PMF is enabled if PSCI STAT is enabled. 425170fb93dSYatharth Kocharifeq (${ENABLE_PSCI_STAT},1) 426170fb93dSYatharth KocharENABLE_PMF := 1 427170fb93dSYatharth Kocharendif 42873c99d4eSJuan Castillo 42973c99d4eSJuan Castillo################################################################################ 430819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc) 43173c99d4eSJuan Castillo################################################################################ 43273c99d4eSJuan Castillo 43373c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool 43473c99d4eSJuan CastilloCRTTOOLPATH ?= tools/cert_create 43542a45b51SEvan LloydCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 43673c99d4eSJuan Castillo 43773c99d4eSJuan Castillo# Variables for use with Firmware Image Package 438819281eeSdp-armFIPTOOLPATH ?= tools/fiptool 439819281eeSdp-armFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 44073c99d4eSJuan Castillo 44173c99d4eSJuan Castillo 44273c99d4eSJuan Castillo################################################################################ 44373c99d4eSJuan Castillo# Build options checks 44473c99d4eSJuan Castillo################################################################################ 44573c99d4eSJuan Castillo 44673c99d4eSJuan Castillo$(eval $(call assert_boolean,DEBUG)) 44773c99d4eSJuan Castillo$(eval $(call assert_boolean,NS_TIMER_SWITCH)) 44873c99d4eSJuan Castillo$(eval $(call assert_boolean,RESET_TO_BL31)) 44973c99d4eSJuan Castillo$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS)) 4508cd16e6bSSoby Mathew$(eval $(call assert_boolean,CTX_INCLUDE_AARCH32_REGS)) 45173c99d4eSJuan Castillo$(eval $(call assert_boolean,ASM_ASSERTION)) 45273c99d4eSJuan Castillo$(eval $(call assert_boolean,USE_COHERENT_MEM)) 45373c99d4eSJuan Castillo$(eval $(call assert_boolean,DISABLE_PEDANTIC)) 45473c99d4eSJuan Castillo$(eval $(call assert_boolean,GENERATE_COT)) 45573c99d4eSJuan Castillo$(eval $(call assert_boolean,CREATE_KEYS)) 45673c99d4eSJuan Castillo$(eval $(call assert_boolean,SAVE_KEYS)) 45773c99d4eSJuan Castillo$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT)) 45873c99d4eSJuan Castillo$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS)) 459a9bec67dSSandrine Bailleux$(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU)) 46073c99d4eSJuan Castillo$(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID)) 4617a24cba5SSoby Mathew$(eval $(call assert_boolean,ERROR_DEPRECATED)) 46293271a1eSAchin Gupta$(eval $(call assert_boolean,ENABLE_PLAT_COMPAT)) 46335e8c766SSandrine Bailleux$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT)) 46412f654b6SJuan Castillo$(eval $(call assert_boolean,PL011_GENERIC_UART)) 465a31d8983SYatharth Kochar$(eval $(call assert_boolean,ENABLE_PMF)) 466170fb93dSYatharth Kochar$(eval $(call assert_boolean,ENABLE_PSCI_STAT)) 4675d1c104fSSandrine Bailleux$(eval $(call assert_boolean,SEPARATE_CODE_AND_RODATA)) 46872600226SYatharth Kochar$(eval $(call assert_boolean,LOAD_IMAGE_V2)) 46973c99d4eSJuan Castillo 47073c99d4eSJuan Castillo 47173c99d4eSJuan Castillo################################################################################ 47273c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 47373c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 47473c99d4eSJuan Castillo# platform to overwrite the default options 47573c99d4eSJuan Castillo################################################################################ 47673c99d4eSJuan Castillo 47773c99d4eSJuan Castillo$(eval $(call add_define,PLAT_${PLAT})) 47881d139d5SAntonio Nino Diaz$(eval $(call add_define,SPD_${SPD})) 47973c99d4eSJuan Castillo$(eval $(call add_define,NS_TIMER_SWITCH)) 48073c99d4eSJuan Castillo$(eval $(call add_define,RESET_TO_BL31)) 48173c99d4eSJuan Castillo$(eval $(call add_define,CTX_INCLUDE_FPREGS)) 4828cd16e6bSSoby Mathew$(eval $(call add_define,CTX_INCLUDE_AARCH32_REGS)) 48373c99d4eSJuan Castillo$(eval $(call add_define,ARM_GIC_ARCH)) 48473c99d4eSJuan Castillo$(eval $(call add_define,ARM_CCI_PRODUCT_ID)) 48573c99d4eSJuan Castillo$(eval $(call add_define,ASM_ASSERTION)) 48673c99d4eSJuan Castillo$(eval $(call add_define,LOG_LEVEL)) 48773c99d4eSJuan Castillo$(eval $(call add_define,USE_COHERENT_MEM)) 48873c99d4eSJuan Castillo$(eval $(call add_define,TRUSTED_BOARD_BOOT)) 48973c99d4eSJuan Castillo$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS)) 490a9bec67dSSandrine Bailleux$(eval $(call add_define,COLD_BOOT_SINGLE_CPU)) 49173c99d4eSJuan Castillo$(eval $(call add_define,PSCI_EXTENDED_STATE_ID)) 4927a24cba5SSoby Mathew$(eval $(call add_define,ERROR_DEPRECATED)) 49393271a1eSAchin Gupta$(eval $(call add_define,ENABLE_PLAT_COMPAT)) 49435e8c766SSandrine Bailleux$(eval $(call add_define,SPIN_ON_BL1_EXIT)) 495cf2c8a33SAntonio Nino Diaz$(eval $(call add_define,PL011_GENERIC_UART)) 496a31d8983SYatharth Kochar$(eval $(call add_define,ENABLE_PMF)) 497170fb93dSYatharth Kochar$(eval $(call add_define,ENABLE_PSCI_STAT)) 4985d1c104fSSandrine Bailleux$(eval $(call add_define,SEPARATE_CODE_AND_RODATA)) 49972600226SYatharth Kochar$(eval $(call add_define,LOAD_IMAGE_V2)) 5004c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 5014c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 5024c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 503cf2c8a33SAntonio Nino Diazelse 50468450a6dSAntonio Nino Diaz # Define the PRELOADED_BL33_BASE flag only if it is provided and 50568450a6dSAntonio Nino Diaz # EL3_PAYLOAD_BASE is not defined, as it has priority. 50668450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 50768450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 5084c117f6cSSandrine Bailleux endif 509cf2c8a33SAntonio Nino Diazendif 510031dbb12SSoby Mathew# Define the AARCH32/AARCH64 flag based on the ARCH flag 511031dbb12SSoby Mathewifeq (${ARCH},aarch32) 512031dbb12SSoby Mathew $(eval $(call add_define,AARCH32)) 513031dbb12SSoby Mathewelse 514031dbb12SSoby Mathew $(eval $(call add_define,AARCH64)) 515031dbb12SSoby Mathewendif 51673c99d4eSJuan Castillo 51773c99d4eSJuan Castillo################################################################################ 51873c99d4eSJuan Castillo# Include BL specific makefiles 51973c99d4eSJuan Castillo################################################################################ 52073c99d4eSJuan Castilloifdef BL1_SOURCES 52173c99d4eSJuan CastilloNEED_BL1 := yes 52273c99d4eSJuan Castilloinclude bl1/bl1.mk 52373c99d4eSJuan Castilloendif 52473c99d4eSJuan Castillo 52573c99d4eSJuan Castilloifdef BL2_SOURCES 52673c99d4eSJuan CastilloNEED_BL2 := yes 52773c99d4eSJuan Castilloinclude bl2/bl2.mk 52873c99d4eSJuan Castilloendif 52973c99d4eSJuan Castillo 530*6fe8aa2fSYatharth Kochar# For AArch32, BL31 is not applicable, and BL2U is not supported at present. 531*6fe8aa2fSYatharth Kocharifneq (${ARCH},aarch32) 5329003fa0bSYatharth Kocharifdef BL2U_SOURCES 5339003fa0bSYatharth KocharNEED_BL2U := yes 5349003fa0bSYatharth Kocharinclude bl2u/bl2u.mk 5359003fa0bSYatharth Kocharendif 5369003fa0bSYatharth Kochar 53773c99d4eSJuan Castilloifdef BL31_SOURCES 5384c117f6cSSandrine Bailleux# When booting an EL3 payload, there is no need to compile the BL31 image nor 5394c117f6cSSandrine Bailleux# put it in the FIP. 5404c117f6cSSandrine Bailleuxifndef EL3_PAYLOAD_BASE 54173c99d4eSJuan CastilloNEED_BL31 := yes 54273c99d4eSJuan Castilloinclude bl31/bl31.mk 54373c99d4eSJuan Castilloendif 5444c117f6cSSandrine Bailleuxendif 5459d29c227SSoby Mathewendif 54673c99d4eSJuan Castillo 5479d29c227SSoby Mathewifeq (${ARCH},aarch32) 5489d29c227SSoby MathewNEED_BL32 := yes 5499d29c227SSoby Mathew 5509d29c227SSoby Mathew################################################################################ 5519d29c227SSoby Mathew# Build `AARCH32_SP` as BL32 image for AArch32 5529d29c227SSoby Mathew################################################################################ 5539d29c227SSoby Mathewifneq (${AARCH32_SP},none) 5549d29c227SSoby Mathew# We expect to locate an sp.mk under the specified AARCH32_SP directory 5559d29c227SSoby MathewAARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 5569d29c227SSoby Mathew 5579d29c227SSoby Mathewifeq (${AARCH32_SP_MAKE},) 5589d29c227SSoby Mathew $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 5599d29c227SSoby Mathewendif 5609d29c227SSoby Mathew 5619d29c227SSoby Mathew$(info Including ${AARCH32_SP_MAKE}) 5629d29c227SSoby Mathewinclude ${AARCH32_SP_MAKE} 5639d29c227SSoby Mathewendif 5649d29c227SSoby Mathew 5659d29c227SSoby Mathewendif 56673c99d4eSJuan Castillo 56773c99d4eSJuan Castillo################################################################################ 56873c99d4eSJuan Castillo# Build targets 56973c99d4eSJuan Castillo################################################################################ 57073c99d4eSJuan Castillo 5710191262dSYatharth Kochar.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip fwu_fip certtool 57273c99d4eSJuan Castillo.SUFFIXES: 57373c99d4eSJuan Castillo 57473c99d4eSJuan Castilloall: msg_start 57573c99d4eSJuan Castillo 57673c99d4eSJuan Castillomsg_start: 57773c99d4eSJuan Castillo @echo "Building ${PLAT}" 57873c99d4eSJuan Castillo 5797a24cba5SSoby Mathew# Check if deprecated declarations should be treated as error or not. 5807a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0) 581403973c9SSandrine Bailleux TF_CFLAGS += -Wno-error=deprecated-declarations 5827a24cba5SSoby Mathewendif 5837a24cba5SSoby Mathew 58473c99d4eSJuan Castillo# Expand build macros for the different images 58573c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 58673c99d4eSJuan Castillo$(eval $(call MAKE_BL,1)) 58773c99d4eSJuan Castilloendif 58873c99d4eSJuan Castillo 58973c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 5908f0617efSJuan Castillo$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},tb-fw)),\ 5918f0617efSJuan Castillo $(eval $(call MAKE_BL,2,tb-fw))) 59273c99d4eSJuan Castilloendif 59373c99d4eSJuan Castillo 59473c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 59573c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 5968f0617efSJuan Castillo$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},soc-fw)),\ 5978f0617efSJuan Castillo $(eval $(call MAKE_BL,31,soc-fw))) 59873c99d4eSJuan Castilloendif 59973c99d4eSJuan Castillo 60070d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 60170d1fc53SJuan Castillo# build system will call FIP_ADD_IMG to print a warning message and abort the 60270d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 60373c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 6048f0617efSJuan Castillo$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},tos-fw)),\ 6058f0617efSJuan Castillo $(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\ 6068f0617efSJuan Castillo $(eval $(call FIP_ADD_IMG,BL32,--tos-fw)))) 60773c99d4eSJuan Castilloendif 60873c99d4eSJuan Castillo 60973c99d4eSJuan Castillo# Add the BL33 image if required by the platform 61073c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 6118f0617efSJuan Castillo$(eval $(call FIP_ADD_IMG,BL33,--nt-fw)) 612db6071c9SJuan Castilloendif 613db6071c9SJuan Castillo 6149003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 6159003fa0bSYatharth KocharBL2U_PATH := $(if ${BL2U},${BL2U},$(call IMG_BIN,2u)) 6169003fa0bSYatharth Kochar$(if ${BL2U}, ,$(eval $(call MAKE_BL,2u))) 6178f0617efSJuan Castillo$(eval $(call FWU_FIP_ADD_PAYLOAD,${BL2U_PATH},--ap-fwu-cfg)) 6189003fa0bSYatharth Kocharendif 6199003fa0bSYatharth Kochar 62036eaaf37SIan Spraylocate-checkpatch: 62136eaaf37SIan Sprayifndef CHECKPATCH 62236eaaf37SIan Spray $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl") 62336eaaf37SIan Sprayelse 62436eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 62536eaaf37SIan Spray $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl") 62636eaaf37SIan Sprayendif 62736eaaf37SIan Sprayendif 62836eaaf37SIan Spray 6294f6ad66aSAchin Guptaclean: 6304f6ad66aSAchin Gupta @echo " CLEAN" 631f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 6322f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 6336f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 6344f6ad66aSAchin Gupta 635eaaeece2SJames Morrisseyrealclean distclean: 636eaaeece2SJames Morrissey @echo " REALCLEAN" 637f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 638f1477d4aSEvan Lloyd $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 6392f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 6406f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 6414f6ad66aSAchin Gupta 64236eaaf37SIan Spraycheckcodebase: locate-checkpatch 64336eaaf37SIan Spray @echo " CHECKING STYLE" 64436eaaf37SIan Spray @if test -d .git ; then \ 6451a41e8c1SDan Handley git ls-files | grep -E -v libfdt\|stdlib\|docs\|\.md | \ 6461a41e8c1SDan Handley while read GIT_FILE ; \ 6471a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 6481a41e8c1SDan Handley done ; \ 64936eaaf37SIan Spray else \ 6501a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 6511a41e8c1SDan Handley -not -iwholename "*build*" \ 6521a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 6531a41e8c1SDan Handley -not -iwholename "*stdlib*" \ 6541a41e8c1SDan Handley -not -iwholename "*docs*" \ 6551a41e8c1SDan Handley -not -iwholename "*.md" \ 6561a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 65736eaaf37SIan Spray fi 65836eaaf37SIan Spray 65936eaaf37SIan Spraycheckpatch: locate-checkpatch 66036eaaf37SIan Spray @echo " CHECKING STYLE" 661f607739cSSandrine Bailleux ${Q}git log -p ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} - || true 66236eaaf37SIan Spray 66373c99d4eSJuan Castillocerttool: ${CRTTOOL} 66473c99d4eSJuan Castillo 6656f971622SJuan Castillo.PHONY: ${CRTTOOL} 6666f971622SJuan Castillo${CRTTOOL}: 6676f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} 668f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 6696f971622SJuan Castillo @echo "Built $@ successfully" 670f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 6716f971622SJuan Castillo 6726f971622SJuan Castilloifneq (${GENERATE_COT},0) 67373c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} 6746f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 675f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 6766f971622SJuan Castillo @echo "Built $@ successfully" 6776f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 678f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 67973c99d4eSJuan Castilloendif 68027713fb4SSoby Mathew 68173c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 682819281eeSdp-arm ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 683819281eeSdp-arm ${Q}${FIPTOOL} info $@ 684f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 6852f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 686f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 687f58ad36fSHarry Liebel 6880191262dSYatharth Kocharifneq (${GENERATE_COT},0) 6890191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 6900191262dSYatharth Kochar ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 6910191262dSYatharth Kochar @echo 6920191262dSYatharth Kochar @echo "Built $@ successfully" 6930191262dSYatharth Kochar @echo "FWU certificates can be found in ${BUILD_PLAT}" 6940191262dSYatharth Kochar @echo 6950191262dSYatharth Kocharendif 6960191262dSYatharth Kochar 6970191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 698819281eeSdp-arm ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 699819281eeSdp-arm ${Q}${FIPTOOL} info $@ 7000191262dSYatharth Kochar @echo 7010191262dSYatharth Kochar @echo "Built $@ successfully" 7020191262dSYatharth Kochar @echo 7030191262dSYatharth Kochar 70473c99d4eSJuan Castillofiptool: ${FIPTOOL} 70573c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 7060191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 70773c99d4eSJuan Castillo 70873c99d4eSJuan Castillo.PHONY: ${FIPTOOL} 70973c99d4eSJuan Castillo${FIPTOOL}: 710819281eeSdp-arm ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${FIPTOOLPATH} 711f58ad36fSHarry Liebel 71235fab8c9SJoakim Bechcscope: 71335fab8c9SJoakim Bech @echo " CSCOPE" 71435fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 71535fab8c9SJoakim Bech ${Q}cscope -b -q -k 71635fab8c9SJoakim Bech 71772ee3314SRyan Harkinhelp: 718231c1470SEvan Lloyd @echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]" 71972ee3314SRyan Harkin @echo "" 72072ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 72108c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 72272ee3314SRyan Harkin @echo "" 7231b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 7241b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 7251b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 7261b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 7271b578596SSandrine Bailleux @echo "" 72872ee3314SRyan Harkin @echo "Supported Targets:" 7291b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 73036eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 7318aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 7329003fa0bSYatharth Kochar @echo " bl2u Build the BL2U binary" 733d178637dSJuan Castillo @echo " bl31 Build the BL31 binary" 7349d29c227SSoby Mathew @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 7359d29c227SSoby Mathew @echo " this builds secure payload specified by AARCH32_SP" 73673c99d4eSJuan Castillo @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 7371b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 7380191262dSYatharth Kochar @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 73936eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 74036eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 74136eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 74272ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 74335fab8c9SJoakim Bech @echo " cscope Generate cscope index" 74472ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 7456f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 746f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package(FIP) creation tool" 74772ee3314SRyan Harkin @echo "" 7481b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 74972ee3314SRyan Harkin @echo "" 75072ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 75172ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 752