14f6ad66aSAchin Gupta# 2c04d2606SDan Handley# Copyright (c) 2013-2015, 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 35130ed88dSAchin GuptaVERSION_MINOR := 1 36aaa3e722SJuan Castillo 37aaa3e722SJuan Castillo# 38e35c4045SJeenu Viswambharan# Default values for build configurations 39e35c4045SJeenu Viswambharan# 40e35c4045SJeenu Viswambharan 41e35c4045SJeenu Viswambharan# Build verbosity 42e35c4045SJeenu ViswambharanV := 0 43e35c4045SJeenu Viswambharan# Debug build 44e35c4045SJeenu ViswambharanDEBUG := 0 45e35c4045SJeenu Viswambharan# Build platform 46e35c4045SJeenu ViswambharanDEFAULT_PLAT := fvp 47e35c4045SJeenu ViswambharanPLAT := ${DEFAULT_PLAT} 48e35c4045SJeenu Viswambharan# SPD choice 49e35c4045SJeenu ViswambharanSPD := none 50e35c4045SJeenu Viswambharan# Base commit to perform code check on 51e35c4045SJeenu ViswambharanBASE_COMMIT := origin/master 522da8d8bfSJeenu Viswambharan# NS timer register save and restore 532da8d8bfSJeenu ViswambharanNS_TIMER_SWITCH := 0 54dbad1bacSVikram Kanigiri# By default, Bl1 acts as the reset handler, not BL31 55dbad1bacSVikram KanigiriRESET_TO_BL31 := 0 560f21c547SJuan Castillo# Include FP registers in cpu context 570f21c547SJuan CastilloCTX_INCLUDE_FPREGS := 0 582b98e789SSandrine Bailleux# Determine the version of ARM GIC architecture to use for interrupt management 592b98e789SSandrine Bailleux# in EL3. The platform port can change this value if needed. 602b98e789SSandrine BailleuxARM_GIC_ARCH := 2 6123e47edeSVikram Kanigiri# Determine the version of ARM CCI product used in the platform. The platform 6223e47edeSVikram Kanigiri# port can change this value if needed. 6323e47edeSVikram KanigiriARM_CCI_PRODUCT_ID := 400 64bc920128SSoby Mathew# Flag used to indicate if ASM_ASSERTION should be enabled for the build. 65bc920128SSoby Mathew# This defaults to being present in DEBUG builds only. 66bc920128SSoby MathewASM_ASSERTION := ${DEBUG} 678c5fe0b5SSoby Mathew# Build option to choose whether Trusted firmware uses Coherent memory or not. 688c5fe0b5SSoby MathewUSE_COHERENT_MEM := 1 697f48fab9SJuan Castillo# Default FIP file name 707f48fab9SJuan CastilloFIP_NAME := fip.bin 71db6071c9SJuan Castillo# By default, use the -pedantic option in the gcc command line 72db6071c9SJuan CastilloDISABLE_PEDANTIC := 0 736f971622SJuan Castillo# Flags to generate the Chain of Trust 746f971622SJuan CastilloGENERATE_COT := 0 756f971622SJuan CastilloCREATE_KEYS := 1 76fd34e7baSJuan CastilloSAVE_KEYS := 0 776eadf762SJuan Castillo# Flags to build TF with Trusted Boot support 786eadf762SJuan CastilloTRUSTED_BOARD_BOOT := 0 7940febc3aSJuan CastilloAUTH_MOD := none 80bf031bbaSSandrine Bailleux# By default, consider that the platform's reset address is not programmable. 81bf031bbaSSandrine Bailleux# The platform Makefile is free to override this value. 82bf031bbaSSandrine BailleuxPROGRAMMABLE_RESET_ADDRESS := 0 834f6ad66aSAchin Gupta 847421b465SAchin Gupta# Checkpatch ignores 859b4ee6b3SJuan CastilloCHECK_IGNORE = --ignore COMPLEX_MACRO \ 869b4ee6b3SJuan Castillo --ignore GERRIT_CHANGE_ID \ 879b4ee6b3SJuan Castillo --ignore GIT_COMMIT_ID 887421b465SAchin Gupta 897421b465SAchin GuptaCHECKPATCH_ARGS = --no-tree --no-signoff ${CHECK_IGNORE} 907421b465SAchin GuptaCHECKCODE_ARGS = --no-patch --no-tree --no-signoff ${CHECK_IGNORE} 9195d5353cSSandrine Bailleux# Do not check the coding style on C library files 92662109a5SSandrine BailleuxCHECK_PATHS = $(shell ls -I include -I lib) \ 93662109a5SSandrine Bailleux $(addprefix include/,$(shell ls -I stdlib include)) \ 94662109a5SSandrine Bailleux $(addprefix lib/,$(shell ls -I stdlib lib)) 9536eaaf37SIan Spray 96e35c4045SJeenu Viswambharanifeq (${V},0) 974f6ad66aSAchin Gupta Q=@ 9836eaaf37SIan Spray CHECKCODE_ARGS += --no-summary --terse 994f6ad66aSAchin Guptaelse 1004f6ad66aSAchin Gupta Q= 1014f6ad66aSAchin Guptaendif 1022f2cef46SJeenu Viswambharanexport Q 1032f2cef46SJeenu Viswambharan 104eaaeece2SJames Morrisseyifneq (${DEBUG}, 0) 105eaaeece2SJames Morrissey BUILD_TYPE := debug 106289c28a8SDan Handley # Use LOG_LEVEL_INFO by default for debug builds 107289c28a8SDan Handley LOG_LEVEL := 40 108eaaeece2SJames Morrisseyelse 109eaaeece2SJames Morrissey BUILD_TYPE := release 110289c28a8SDan Handley # Use LOG_LEVEL_NOTICE by default for release builds 111289c28a8SDan Handley LOG_LEVEL := 20 112eaaeece2SJames Morrisseyendif 113eaaeece2SJames Morrissey 114aaa3e722SJuan Castillo# Default build string (git branch and commit) 115aaa3e722SJuan Castilloifeq (${BUILD_STRING},) 116aaa3e722SJuan Castillo BUILD_STRING := $(shell git log -n 1 --pretty=format:"%h") 117aaa3e722SJuan Castilloendif 118aaa3e722SJuan Castillo 119aaa3e722SJuan CastilloVERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING} 120aaa3e722SJuan Castillo 121bee82417SDan HandleyBL_COMMON_SOURCES := common/bl_common.c \ 122b79af934SSoby Mathew common/tf_printf.c \ 123626ed510SSoby Mathew common/aarch64/debug.S \ 124bee82417SDan Handley lib/aarch64/cache_helpers.S \ 125bee82417SDan Handley lib/aarch64/misc_helpers.S \ 126bee82417SDan Handley lib/aarch64/xlat_helpers.c \ 127bee82417SDan Handley lib/stdlib/std.c \ 128bee82417SDan Handley plat/common/aarch64/platform_helpers.S 129d7a6b0f8SRyan Harkin 130eaaeece2SJames MorrisseyBUILD_BASE := ./build 13125cff83eSRyan HarkinBUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} 1324f6ad66aSAchin Gupta 133c04d2606SDan HandleyPLAT_MAKEFILE := platform.mk 134c04d2606SDan Handley# Generate the platforms list by recursively searching for all directories 135c04d2606SDan Handley# under /plat containing a PLAT_MAKEFILE. Append each platform with a `|` 136c04d2606SDan Handley# char and strip out the final '|'. 137c04d2606SDan HandleyPLATFORMS := $(shell find plat/ -name '${PLAT_MAKEFILE}' -print0 | \ 138c04d2606SDan Handley sed -r 's%[^\x00]*\/([^/]*)\/${PLAT_MAKEFILE}\x00%\1|%g' | \ 139c04d2606SDan Handley sed -r 's/\|$$//') 140375f538aSAchin GuptaSPDS := $(shell ls -I none services/spd) 14172ee3314SRyan Harkin 142289e0dadSJeenu Viswambharan# Convenience function for adding build definitions 143289e0dadSJeenu Viswambharan# $(eval $(call add_define,FOO)) will have: 144289e0dadSJeenu Viswambharan# -DFOO if $(FOO) is empty; -DFOO=$(FOO) otherwise 145289e0dadSJeenu Viswambharandefine add_define 146289e0dadSJeenu ViswambharanDEFINES += -D$(1)$(if $(value $(1)),=$(value $(1)),) 147289e0dadSJeenu Viswambharanendef 148289e0dadSJeenu Viswambharan 149289e0dadSJeenu Viswambharan# Convenience function for verifying option has a boolean value 150289e0dadSJeenu Viswambharan# $(eval $(call assert_boolean,FOO)) will assert FOO is 0 or 1 151289e0dadSJeenu Viswambharandefine assert_boolean 152289e0dadSJeenu Viswambharan$(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) must be boolean)) 153289e0dadSJeenu Viswambharanendef 154289e0dadSJeenu Viswambharan 15525cff83eSRyan Harkinifeq (${PLAT},) 156c04d2606SDan Handley $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform") 15725cff83eSRyan Harkinendif 158c04d2606SDan HandleyPLAT_MAKEFILE_FULL := $(shell find plat/ -wholename '*/${PLAT}/${PLAT_MAKEFILE}') 159c04d2606SDan Handleyifeq ($(PLAT_MAKEFILE_FULL),) 16025cff83eSRyan Harkin $(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}") 16125cff83eSRyan Harkinendif 1624f6ad66aSAchin Gupta 1634bfc2d21SJon Medhurstall: msg_start 16425cff83eSRyan Harkin 16525cff83eSRyan Harkinmsg_start: 16625cff83eSRyan Harkin @echo "Building ${PLAT}" 16725cff83eSRyan Harkin 168c04d2606SDan Handleyinclude ${PLAT_MAKEFILE_FULL} 1694bfc2d21SJon Medhurst 1705541bb3fSSoby Mathew# Include the CPU specific operations makefile. By default all CPU errata 1715541bb3fSSoby Mathew# workarounds and CPU specifc optimisations are disabled. This can be 172d9bdaf2dSSoby Mathew# overridden by the platform. 1735541bb3fSSoby Mathewinclude lib/cpus/cpu-ops.mk 174d9bdaf2dSSoby Mathew 1754bfc2d21SJon Medhurstifdef BL1_SOURCES 1764bfc2d21SJon MedhurstNEED_BL1 := yes 1774f6ad66aSAchin Guptainclude bl1/bl1.mk 1784bfc2d21SJon Medhurstendif 1794bfc2d21SJon Medhurst 1804bfc2d21SJon Medhurstifdef BL2_SOURCES 1814bfc2d21SJon MedhurstNEED_BL2 := yes 1824f6ad66aSAchin Guptainclude bl2/bl2.mk 18327713fb4SSoby Mathew# Using the ARM Trusted Firmware BL2 implies that a BL3-3 image also need to be supplied for the FIP. 18427713fb4SSoby Mathew# This flag can be overridden by the platform. 18527713fb4SSoby MathewNEED_BL33 ?= yes 1864bfc2d21SJon Medhurstendif 1874bfc2d21SJon Medhurst 1884bfc2d21SJon Medhurstifdef BL31_SOURCES 1894bfc2d21SJon MedhurstNEED_BL31 := yes 1904f6ad66aSAchin Guptainclude bl31/bl31.mk 19125cff83eSRyan Harkinendif 1924f6ad66aSAchin Gupta 193375f538aSAchin Gupta# Include SPD Makefile if one has been specified 194375f538aSAchin Guptaifneq (${SPD},none) 195375f538aSAchin Gupta # We expect to locate an spd.mk under the specified SPD directory 196375f538aSAchin Gupta SPD_MAKE := $(shell m="services/spd/${SPD}/${SPD}.mk"; [ -f "$$m" ] && echo "$$m") 197375f538aSAchin Gupta 198375f538aSAchin Gupta ifeq (${SPD_MAKE},) 199375f538aSAchin Gupta $(error Error: No services/spd/${SPD}/${SPD}.mk located) 200375f538aSAchin Gupta endif 201375f538aSAchin Gupta $(info Including ${SPD_MAKE}) 202375f538aSAchin Gupta include ${SPD_MAKE} 203375f538aSAchin Gupta 20427713fb4SSoby Mathew # If there's BL3-2 companion for the chosen SPD, and the SPD wants to build the 20527713fb4SSoby Mathew # BL3-2 from source, we expect that the SPD's Makefile would set NEED_BL32 20627713fb4SSoby Mathew # variable to "yes". In case the BL3-2 is a binary which needs to be included in 20727713fb4SSoby Mathew # fip, then the NEED_BL32 needs to be set and BL3-2 would need to point to the bin. 208375f538aSAchin Guptaendif 209375f538aSAchin Gupta 2106f971622SJuan Castillo.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip certtool 211eaaeece2SJames Morrissey.SUFFIXES: 212eaaeece2SJames Morrissey 213a0df63efSSandrine BailleuxINCLUDES += -Iinclude/bl31 \ 2144ecca339SDan Handley -Iinclude/bl31/services \ 2154ecca339SDan Handley -Iinclude/common \ 2164ecca339SDan Handley -Iinclude/drivers \ 2174ecca339SDan Handley -Iinclude/drivers/arm \ 218935db693SDan Handley -Iinclude/drivers/io \ 219c13b2e32SVarun Wadekar -Iinclude/drivers/ti/uart \ 2204ecca339SDan Handley -Iinclude/lib \ 2214ecca339SDan Handley -Iinclude/lib/aarch64 \ 222add40351SSoby Mathew -Iinclude/lib/cpus/aarch64 \ 2235f0cdb05SDan Handley -Iinclude/plat/common \ 224d7a6b0f8SRyan Harkin -Iinclude/stdlib \ 225d7a6b0f8SRyan Harkin -Iinclude/stdlib/sys \ 226375f538aSAchin Gupta ${PLAT_INCLUDES} \ 227375f538aSAchin Gupta ${SPD_INCLUDES} 2284f6ad66aSAchin Gupta 229e35c4045SJeenu Viswambharan# Process DEBUG flag 230e35c4045SJeenu Viswambharan$(eval $(call assert_boolean,DEBUG)) 231e35c4045SJeenu Viswambharan$(eval $(call add_define,DEBUG)) 232e35c4045SJeenu Viswambharanifeq (${DEBUG},0) 233e35c4045SJeenu Viswambharan $(eval $(call add_define,NDEBUG)) 234e35c4045SJeenu Viswambharanelse 235e35c4045SJeenu ViswambharanCFLAGS += -g 236e35c4045SJeenu ViswambharanASFLAGS += -g -Wa,--gdwarf-2 237e35c4045SJeenu Viswambharanendif 238e35c4045SJeenu Viswambharan 239c04d2606SDan Handley# Process PLAT flag 240c04d2606SDan Handley$(eval $(call add_define,PLAT_${PLAT})) 241c04d2606SDan Handley 2422da8d8bfSJeenu Viswambharan# Process NS_TIMER_SWITCH flag 2432da8d8bfSJeenu Viswambharan$(eval $(call assert_boolean,NS_TIMER_SWITCH)) 2442da8d8bfSJeenu Viswambharan$(eval $(call add_define,NS_TIMER_SWITCH)) 2452da8d8bfSJeenu Viswambharan 246dbad1bacSVikram Kanigiri# Process RESET_TO_BL31 flag 247dbad1bacSVikram Kanigiri$(eval $(call assert_boolean,RESET_TO_BL31)) 248dbad1bacSVikram Kanigiri$(eval $(call add_define,RESET_TO_BL31)) 249dbad1bacSVikram Kanigiri 2500f21c547SJuan Castillo# Process CTX_INCLUDE_FPREGS flag 2510f21c547SJuan Castillo$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS)) 2520f21c547SJuan Castillo$(eval $(call add_define,CTX_INCLUDE_FPREGS)) 2530f21c547SJuan Castillo 2542b98e789SSandrine Bailleux# Process ARM_GIC_ARCH flag 2552b98e789SSandrine Bailleux$(eval $(call add_define,ARM_GIC_ARCH)) 2562b98e789SSandrine Bailleux 25723e47edeSVikram Kanigiri# Process ARM_CCI_PRODUCT_ID flag 25823e47edeSVikram Kanigiri$(eval $(call add_define,ARM_CCI_PRODUCT_ID)) 25923e47edeSVikram Kanigiri 260bc920128SSoby Mathew# Process ASM_ASSERTION flag 261bc920128SSoby Mathew$(eval $(call assert_boolean,ASM_ASSERTION)) 262bc920128SSoby Mathew$(eval $(call add_define,ASM_ASSERTION)) 2632b98e789SSandrine Bailleux 264289c28a8SDan Handley# Process LOG_LEVEL flag 265289c28a8SDan Handley$(eval $(call add_define,LOG_LEVEL)) 266289c28a8SDan Handley 2678c5fe0b5SSoby Mathew# Process USE_COHERENT_MEM flag 2688c5fe0b5SSoby Mathew$(eval $(call assert_boolean,USE_COHERENT_MEM)) 2698c5fe0b5SSoby Mathew$(eval $(call add_define,USE_COHERENT_MEM)) 2708c5fe0b5SSoby Mathew 2716f971622SJuan Castillo# Process Generate CoT flags 2726f971622SJuan Castillo$(eval $(call assert_boolean,GENERATE_COT)) 2736f971622SJuan Castillo$(eval $(call assert_boolean,CREATE_KEYS)) 274fd34e7baSJuan Castillo$(eval $(call assert_boolean,SAVE_KEYS)) 2756f971622SJuan Castillo 2766eadf762SJuan Castillo# Process TRUSTED_BOARD_BOOT flag 2776eadf762SJuan Castillo$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT)) 2786eadf762SJuan Castillo$(eval $(call add_define,TRUSTED_BOARD_BOOT)) 2796eadf762SJuan Castillo 280bf031bbaSSandrine Bailleux# Process PROGRAMMABLE_RESET_ADDRESS flag 281bf031bbaSSandrine Bailleux$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS)) 282bf031bbaSSandrine Bailleux$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS)) 283bf031bbaSSandrine Bailleux 2840af6d64dSHarry LiebelASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \ 285a0df63efSSandrine Bailleux -Werror -Wmissing-include-dirs \ 286e35c4045SJeenu Viswambharan -mgeneral-regs-only -D__ASSEMBLY__ \ 287e35c4045SJeenu Viswambharan ${DEFINES} ${INCLUDES} 288db6071c9SJuan CastilloCFLAGS += -nostdinc -ffreestanding -Wall \ 289a0df63efSSandrine Bailleux -Werror -Wmissing-include-dirs \ 290a0df63efSSandrine Bailleux -mgeneral-regs-only -std=c99 -c -Os \ 291e35c4045SJeenu Viswambharan ${DEFINES} ${INCLUDES} 292dccc537aSAndrew ThoelkeCFLAGS += -ffunction-sections -fdata-sections 2934f6ad66aSAchin Gupta 2943e850a84SSandrine BailleuxLDFLAGS += --fatal-warnings -O1 295dccc537aSAndrew ThoelkeLDFLAGS += --gc-sections 2964f6ad66aSAchin Gupta 2974f6ad66aSAchin Gupta 298eaaeece2SJames MorrisseyCC := ${CROSS_COMPILE}gcc 299eaaeece2SJames MorrisseyCPP := ${CROSS_COMPILE}cpp 300eaaeece2SJames MorrisseyAS := ${CROSS_COMPILE}gcc 301eaaeece2SJames MorrisseyAR := ${CROSS_COMPILE}ar 302eaaeece2SJames MorrisseyLD := ${CROSS_COMPILE}ld 303eaaeece2SJames MorrisseyOC := ${CROSS_COMPILE}objcopy 304eaaeece2SJames MorrisseyOD := ${CROSS_COMPILE}objdump 305eaaeece2SJames MorrisseyNM := ${CROSS_COMPILE}nm 306eaaeece2SJames MorrisseyPP := ${CROSS_COMPILE}gcc -E ${CFLAGS} 3074f6ad66aSAchin Gupta 308f58ad36fSHarry Liebel# Variables for use with Firmware Image Package 309f58ad36fSHarry LiebelFIPTOOLPATH ?= tools/fip_create 310f58ad36fSHarry LiebelFIPTOOL ?= ${FIPTOOLPATH}/fip_create 311f58ad36fSHarry Liebelfiptool: ${FIPTOOL} 3127f48fab9SJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 313f58ad36fSHarry Liebel 3146f971622SJuan Castillo# Variables for use with Certificate Generation Tool 3156f971622SJuan CastilloCRTTOOLPATH ?= tools/cert_create 3166f971622SJuan CastilloCRTTOOL ?= ${CRTTOOLPATH}/cert_create 3176f971622SJuan Castillocerttool: ${CRTTOOL} 3186f971622SJuan Castillo 3196f971622SJuan Castillo# CoT generation tool default parameters 3206f971622SJuan CastilloTRUSTED_KEY_CERT := ${BUILD_PLAT}/trusted_key.crt 3216f971622SJuan Castillo 3226f971622SJuan Castillo# Pass the private keys to the CoT generation tool in the command line 3236f971622SJuan Castillo# If CREATE_KEYS is set, the '-n' option will be added, indicating the tool to create new keys 3246f971622SJuan Castilloifneq (${GENERATE_COT},0) 3256f971622SJuan Castillo $(eval CERTS := yes) 3266f971622SJuan Castillo 327b7124ea7SJuan Castillo $(eval FIP_DEPS += certificates) 328b7124ea7SJuan Castillo $(eval FIP_ARGS += --trusted-key-cert ${TRUSTED_KEY_CERT}) 329b7124ea7SJuan Castillo 3306f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 3316f971622SJuan Castillo $(eval CRT_ARGS += -n) 332fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 333fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 334fd34e7baSJuan Castillo endif 3356f971622SJuan Castillo endif 3366f971622SJuan Castillo $(eval CRT_ARGS += $(if ${ROT_KEY}, --rot-key ${ROT_KEY})) 3376f971622SJuan Castillo $(eval CRT_ARGS += $(if ${TRUSTED_WORLD_KEY}, --trusted-world-key ${TRUSTED_WORLD_KEY})) 3386f971622SJuan Castillo $(eval CRT_ARGS += $(if ${NON_TRUSTED_WORLD_KEY}, --non-trusted-world-key ${NON_TRUSTED_WORLD_KEY})) 3396f971622SJuan Castillo $(eval CRT_ARGS += --trusted-key-cert ${TRUSTED_KEY_CERT}) 340*ccbf890eSJuan Castillo $(eval CRT_ARGS += $(if ${KEY_ALG}, --key-alg ${KEY_ALG})) 3416f971622SJuan Castilloendif 3426f971622SJuan Castillo 34340febc3aSJuan Castillo# Check Trusted Board Boot options 34440febc3aSJuan Castilloifneq (${TRUSTED_BOARD_BOOT},0) 34540febc3aSJuan Castillo ifeq (${AUTH_MOD},none) 34640febc3aSJuan Castillo $(error Error: When TRUSTED_BOARD_BOOT=1, AUTH_MOD has to be the name of a valid authentication module) 34740febc3aSJuan Castillo else 34840febc3aSJuan Castillo # We expect to locate an *.mk file under the specified AUTH_MOD directory 34940febc3aSJuan Castillo AUTH_MAKE := $(shell m="common/auth/${AUTH_MOD}/${AUTH_MOD}.mk"; [ -f "$$m" ] && echo "$$m") 35040febc3aSJuan Castillo ifeq (${AUTH_MAKE},) 35140febc3aSJuan Castillo $(error Error: No common/auth/${AUTH_MOD}/${AUTH_MOD}.mk located) 35240febc3aSJuan Castillo endif 35340febc3aSJuan Castillo $(info Including ${AUTH_MAKE}) 35440febc3aSJuan Castillo include ${AUTH_MAKE} 35540febc3aSJuan Castillo endif 35640febc3aSJuan Castillo 35740febc3aSJuan Castillo BL_COMMON_SOURCES += common/auth.c 35840febc3aSJuan Castilloendif 35940febc3aSJuan Castillo 360db6071c9SJuan Castillo# Check if -pedantic option should be used 361db6071c9SJuan Castilloifeq (${DISABLE_PEDANTIC},0) 362db6071c9SJuan Castillo CFLAGS += -pedantic 363db6071c9SJuan Castilloendif 364db6071c9SJuan Castillo 36536eaaf37SIan Spraylocate-checkpatch: 36636eaaf37SIan Sprayifndef CHECKPATCH 36736eaaf37SIan Spray $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl") 36836eaaf37SIan Sprayelse 36936eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 37036eaaf37SIan Spray $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl") 37136eaaf37SIan Sprayendif 37236eaaf37SIan Sprayendif 37336eaaf37SIan Spray 3744f6ad66aSAchin Guptaclean: 3754f6ad66aSAchin Gupta @echo " CLEAN" 37625cff83eSRyan Harkin ${Q}rm -rf ${BUILD_PLAT} 3772f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 3786f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 3794f6ad66aSAchin Gupta 380eaaeece2SJames Morrisseyrealclean distclean: 381eaaeece2SJames Morrissey @echo " REALCLEAN" 382eaaeece2SJames Morrissey ${Q}rm -rf ${BUILD_BASE} 38335fab8c9SJoakim Bech ${Q}rm -f ${CURDIR}/cscope.* 3842f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 3856f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 3864f6ad66aSAchin Gupta 38736eaaf37SIan Spraycheckcodebase: locate-checkpatch 38836eaaf37SIan Spray @echo " CHECKING STYLE" 38936eaaf37SIan Spray @if test -d .git ; then \ 3904f2104ffSJuan Castillo git ls-files | grep -v stdlib | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ; \ 39136eaaf37SIan Spray else \ 3924f2104ffSJuan Castillo find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -not -iwholename "*stdlib*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 39336eaaf37SIan Spray fi 39436eaaf37SIan Spray 39536eaaf37SIan Spraycheckpatch: locate-checkpatch 39636eaaf37SIan Spray @echo " CHECKING STYLE" 397662109a5SSandrine Bailleux ${Q}git log -p ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true 39836eaaf37SIan Spray 3996f971622SJuan Castillo.PHONY: ${CRTTOOL} 4006f971622SJuan Castillo${CRTTOOL}: 4016f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} 4026f971622SJuan Castillo @echo 4036f971622SJuan Castillo @echo "Built $@ successfully" 4046f971622SJuan Castillo @echo 4056f971622SJuan Castillo 40607deed40SSandrine Bailleux.PHONY: ${FIPTOOL} 407f58ad36fSHarry Liebel${FIPTOOL}: 4082f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} 409f58ad36fSHarry Liebel 4106d55d109SJon Medhurstdefine match_goals 4116d55d109SJon Medhurst$(strip $(foreach goal,$(1),$(filter $(goal),$(MAKECMDGOALS)))) 4126d55d109SJon Medhurstendef 413eaaeece2SJames Morrissey 4148d2296f3SSandrine Bailleux# List of rules that involve building things 4158d2296f3SSandrine BailleuxBUILD_TARGETS := all bl1 bl2 bl31 bl32 fip 416eaaeece2SJames Morrissey 4178d2296f3SSandrine Bailleux# Does the list of goals specified on the command line include a build target? 4188d2296f3SSandrine Bailleuxifneq ($(call match_goals,${BUILD_TARGETS}),) 4198d2296f3SSandrine BailleuxIS_ANYTHING_TO_BUILD := 1 4208d2296f3SSandrine Bailleuxendif 4214f6ad66aSAchin Gupta 4226d55d109SJon Medhurstdefine MAKE_C 423eaaeece2SJames Morrissey 4246d55d109SJon Medhurst$(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2)))) 4256d55d109SJon Medhurst$(eval PREREQUISITES := $(patsubst %.o,%.d,$(OBJ))) 426eaaeece2SJames Morrissey 4276d55d109SJon Medhurst$(OBJ) : $(2) 4286d55d109SJon Medhurst @echo " CC $$<" 42927905d0aSSoby Mathew $$(Q)$$(CC) $$(CFLAGS) -DIMAGE_BL$(3) -c $$< -o $$@ 430eaaeece2SJames Morrissey 4316d55d109SJon Medhurst 4326d55d109SJon Medhurst$(PREREQUISITES) : $(2) 4336d55d109SJon Medhurst @echo " DEPS $$@" 4346d55d109SJon Medhurst @mkdir -p $(1) 4356d55d109SJon Medhurst $$(Q)$$(CC) $$(CFLAGS) -M -MT $(OBJ) -MF $$@ $$< 4366d55d109SJon Medhurst 4378d2296f3SSandrine Bailleuxifdef IS_ANYTHING_TO_BUILD 4386d55d109SJon Medhurst-include $(PREREQUISITES) 4396d55d109SJon Medhurstendif 4406d55d109SJon Medhurst 4416d55d109SJon Medhurstendef 4426d55d109SJon Medhurst 4436d55d109SJon Medhurst 4446d55d109SJon Medhurstdefine MAKE_S 4456d55d109SJon Medhurst 4466d55d109SJon Medhurst$(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2)))) 4476d55d109SJon Medhurst$(eval PREREQUISITES := $(patsubst %.o,%.d,$(OBJ))) 4486d55d109SJon Medhurst 4496d55d109SJon Medhurst$(OBJ) : $(2) 4506d55d109SJon Medhurst @echo " AS $$<" 45127905d0aSSoby Mathew $$(Q)$$(AS) $$(ASFLAGS) -DIMAGE_BL$(3) -c $$< -o $$@ 4526d55d109SJon Medhurst 4536d55d109SJon Medhurst$(PREREQUISITES) : $(2) 4546d55d109SJon Medhurst @echo " DEPS $$@" 4556d55d109SJon Medhurst @mkdir -p $(1) 4566d55d109SJon Medhurst $$(Q)$$(AS) $$(ASFLAGS) -M -MT $(OBJ) -MF $$@ $$< 4576d55d109SJon Medhurst 4588d2296f3SSandrine Bailleuxifdef IS_ANYTHING_TO_BUILD 4596d55d109SJon Medhurst-include $(PREREQUISITES) 4606d55d109SJon Medhurstendif 4616d55d109SJon Medhurst 4626d55d109SJon Medhurstendef 4636d55d109SJon Medhurst 4646d55d109SJon Medhurst 4656d55d109SJon Medhurstdefine MAKE_LD 4666d55d109SJon Medhurst 4676d55d109SJon Medhurst$(eval PREREQUISITES := $(1).d) 4686d55d109SJon Medhurst 4696d55d109SJon Medhurst$(1) : $(2) 4706d55d109SJon Medhurst @echo " PP $$<" 471513dd3a0SJuan Castillo $$(Q)$$(AS) $$(ASFLAGS) -P -E -D__LINKER__ -o $$@ $$< 4726d55d109SJon Medhurst 4736d55d109SJon Medhurst$(PREREQUISITES) : $(2) 4746d55d109SJon Medhurst @echo " DEPS $$@" 4756d55d109SJon Medhurst @mkdir -p $$(dir $$@) 4766d55d109SJon Medhurst $$(Q)$$(AS) $$(ASFLAGS) -M -MT $(1) -MF $$@ $$< 4776d55d109SJon Medhurst 4788d2296f3SSandrine Bailleuxifdef IS_ANYTHING_TO_BUILD 4796d55d109SJon Medhurst-include $(PREREQUISITES) 4806d55d109SJon Medhurstendif 4816d55d109SJon Medhurst 4826d55d109SJon Medhurstendef 4836d55d109SJon Medhurst 4846d55d109SJon Medhurst 4856d55d109SJon Medhurstdefine MAKE_OBJS 4866d55d109SJon Medhurst $(eval C_OBJS := $(filter %.c,$(2))) 4876d55d109SJon Medhurst $(eval REMAIN := $(filter-out %.c,$(2))) 48827905d0aSSoby Mathew $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C,$(1),$(obj),$(3)))) 4896d55d109SJon Medhurst 4906d55d109SJon Medhurst $(eval S_OBJS := $(filter %.S,$(REMAIN))) 4916d55d109SJon Medhurst $(eval REMAIN := $(filter-out %.S,$(REMAIN))) 49227905d0aSSoby Mathew $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S,$(1),$(obj),$(3)))) 4936d55d109SJon Medhurst 4946d55d109SJon Medhurst $(and $(REMAIN),$(error Unexpected source files present: $(REMAIN))) 4956d55d109SJon Medhurstendef 4966d55d109SJon Medhurst 4976d55d109SJon Medhurst 4986d55d109SJon Medhurst# NOTE: The line continuation '\' is required in the next define otherwise we 4996d55d109SJon Medhurst# end up with a line-feed characer at the end of the last c filename. 5006d55d109SJon Medhurst# Also bare this issue in mind if extending the list of supported filetypes. 5016d55d109SJon Medhurstdefine SOURCES_TO_OBJS 5026d55d109SJon Medhurst $(notdir $(patsubst %.c,%.o,$(filter %.c,$(1)))) \ 5036d55d109SJon Medhurst $(notdir $(patsubst %.S,%.o,$(filter %.S,$(1)))) 5046d55d109SJon Medhurstendef 5056d55d109SJon Medhurst 5066f971622SJuan Castillo 5076f971622SJuan Castillo# MAKE_TOOL_ARGS macro defines the command line arguments for the FIP and CRT 5086f971622SJuan Castillo# tools at each BL stage. Arguments: 5096f971622SJuan Castillo# $(1) = BL stage (2, 30, 31, 32, 33) 5106f971622SJuan Castillo# $(2) = Binary file 5116f971622SJuan Castillo# $(3) = In FIP (false if empty) 5126f971622SJuan Castillo# $(4) = Create certificates (false if empty) 5136f971622SJuan Castillo# $(5) = Create key certificate (false if empty) 5146f971622SJuan Castillo# $(6) = Private key (optional) 5156f971622SJuan Castillodefine MAKE_TOOL_ARGS 5166f971622SJuan Castillo 5176f971622SJuan Castillo$(eval FIP_DEPS += $(if $3,$(2),)) 5186f971622SJuan Castillo$(eval FIP_ARGS += $(if $3,--bl$(1) $(2),)) 519b7124ea7SJuan Castillo$(eval FIP_ARGS += $(if $4,--bl$(1)-cert $(BUILD_PLAT)/bl$(1).crt)) 520b7124ea7SJuan Castillo$(eval FIP_ARGS += $(if $4,$(if $5,--bl$(1)-key-cert $(BUILD_PLAT)/bl$(1)_key.crt))) 5216f971622SJuan Castillo 5226f971622SJuan Castillo$(eval CRT_DEPS += $(if $4,$(2),)) 5236f971622SJuan Castillo$(eval CRT_ARGS += $(if $4,--bl$(1) $(2))) 5246f971622SJuan Castillo$(eval CRT_ARGS += $(if $4,$(if $6,--bl$(1)-key $(6)))) 5256f971622SJuan Castillo$(eval CRT_ARGS += $(if $4,--bl$(1)-cert $(BUILD_PLAT)/bl$(1).crt)) 5266f971622SJuan Castillo$(eval CRT_ARGS += $(if $4,$(if $5,--bl$(1)-key-cert $(BUILD_PLAT)/bl$(1)_key.crt))) 5276f971622SJuan Castillo 5286f971622SJuan Castilloendef 5296f971622SJuan Castillo 5306f971622SJuan Castillo 5316f971622SJuan Castillo# MAKE_BL macro defines the targets and options to build each BL image. 5326f971622SJuan Castillo# Arguments: 5336f971622SJuan Castillo# $(1) = BL stage (2, 30, 31, 32, 33) 5346f971622SJuan Castillo# $(2) = In FIP (false if empty) 5356f971622SJuan Castillo# $(3) = Create certificates (false if empty) 5366f971622SJuan Castillo# $(4) = Create key certificate (false if empty) 5376f971622SJuan Castillo# $(5) = Private key (optional) 5386d55d109SJon Medhurstdefine MAKE_BL 5396d55d109SJon Medhurst $(eval BUILD_DIR := ${BUILD_PLAT}/bl$(1)) 5406d55d109SJon Medhurst $(eval SOURCES := $(BL$(1)_SOURCES) $(BL_COMMON_SOURCES) $(PLAT_BL_COMMON_SOURCES)) 5416d55d109SJon Medhurst $(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES)))) 5426d55d109SJon Medhurst $(eval LINKERFILE := $(BUILD_DIR)/bl$(1).ld) 5436d55d109SJon Medhurst $(eval MAPFILE := $(BUILD_DIR)/bl$(1).map) 5446d55d109SJon Medhurst $(eval ELF := $(BUILD_DIR)/bl$(1).elf) 5456d55d109SJon Medhurst $(eval DUMP := $(BUILD_DIR)/bl$(1).dump) 5466d55d109SJon Medhurst $(eval BIN := $(BUILD_PLAT)/bl$(1).bin) 5476d55d109SJon Medhurst 54827905d0aSSoby Mathew $(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),$(1))) 5496d55d109SJon Medhurst $(eval $(call MAKE_LD,$(LINKERFILE),$(BL$(1)_LINKERFILE))) 5506d55d109SJon Medhurst 5516d55d109SJon Medhurst$(BUILD_DIR) : 5526d55d109SJon Medhurst $$(Q)mkdir -p "$$@" 5536d55d109SJon Medhurst 5546d55d109SJon Medhurst$(ELF) : $(OBJS) $(LINKERFILE) 5556d55d109SJon Medhurst @echo " LD $$@" 556aaa3e722SJuan Castillo @echo 'const char build_message[] = "Built : "__TIME__", "__DATE__; \ 557aaa3e722SJuan Castillo const char version_string[] = "${VERSION_STRING}";' | \ 558fb052462SJon Medhurst $$(CC) $$(CFLAGS) -xc - -o $(BUILD_DIR)/build_message.o 5596d55d109SJon Medhurst $$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \ 5609f98aa1aSJeenu Viswambharan $(BUILD_DIR)/build_message.o $(OBJS) 5616d55d109SJon Medhurst 5626d55d109SJon Medhurst$(DUMP) : $(ELF) 5636d55d109SJon Medhurst @echo " OD $$@" 5646d55d109SJon Medhurst $${Q}$${OD} -dx $$< > $$@ 5656d55d109SJon Medhurst 5666d55d109SJon Medhurst$(BIN) : $(ELF) 5676d55d109SJon Medhurst @echo " BIN $$@" 5686d55d109SJon Medhurst $$(Q)$$(OC) -O binary $$< $$@ 569eaaeece2SJames Morrissey @echo 5706d55d109SJon Medhurst @echo "Built $$@ successfully" 5714f6ad66aSAchin Gupta @echo 5724f6ad66aSAchin Gupta 5736d55d109SJon Medhurst.PHONY : bl$(1) 5746d55d109SJon Medhurstbl$(1) : $(BUILD_DIR) $(BIN) $(DUMP) 5754f6ad66aSAchin Gupta 5766d55d109SJon Medhurstall : bl$(1) 5776d55d109SJon Medhurst 5786f971622SJuan Castillo$(eval $(call MAKE_TOOL_ARGS,$(1),$(BIN),$(2),$(3),$(4),$(5))) 5796d55d109SJon Medhurst 5806d55d109SJon Medhurstendef 5816d55d109SJon Medhurst 5826d55d109SJon Medhurst 5834bfc2d21SJon Medhurstifeq (${NEED_BL1},yes) 5846d55d109SJon Medhurst$(eval $(call MAKE_BL,1)) 5854bfc2d21SJon Medhurstendif 5866d55d109SJon Medhurst 5874bfc2d21SJon Medhurstifeq (${NEED_BL2},yes) 5886f971622SJuan Castillo$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},in_fip,${CERTS})),\ 5896f971622SJuan Castillo $(eval $(call MAKE_BL,2,in_fip,${CERTS}))) 5904bfc2d21SJon Medhurstendif 5916d55d109SJon Medhurst 5924bfc2d21SJon Medhurstifeq (${NEED_BL31},yes) 5936d55d109SJon MedhurstBL31_SOURCES += ${SPD_SOURCES} 5946f971622SJuan Castillo$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},in_fip,${CERTS},${CERTS},${BL31_KEY})),\ 5956f971622SJuan Castillo $(eval $(call MAKE_BL,31,in_fip,${CERTS},${CERTS},${BL31_KEY}))) 5964bfc2d21SJon Medhurstendif 5976d55d109SJon Medhurst 5986d55d109SJon Medhurstifeq (${NEED_BL32},yes) 5996f971622SJuan Castillo$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},in_fip,${CERTS},${CERTS},${BL32_KEY})),\ 6006f971622SJuan Castillo $(eval $(call MAKE_BL,32,in_fip,${CERTS},${CERTS},${BL32_KEY}))) 6016d55d109SJon Medhurstendif 60272ee3314SRyan Harkin 60393d81d64SSandrine Bailleuxifeq (${NEED_BL30},yes) 6046f971622SJuan Castillo$(if ${BL30}, $(eval $(call MAKE_TOOL_ARGS,30,${BL30},in_fip,${CERTS},${CERTS},${BL30_KEY}))) 60593d81d64SSandrine Bailleux 60693d81d64SSandrine Bailleux# If BL3-0 is needed by the platform then 'BL30' variable must be defined. 60793d81d64SSandrine Bailleuxcheck_bl30: 60893d81d64SSandrine Bailleux $(if ${BL30},,$(error "To build a FIP for platform ${PLAT}, please set BL30 to point to the SCP firmware")) 60993d81d64SSandrine Bailleuxelse 61027713fb4SSoby Mathew 61193d81d64SSandrine Bailleux# If BL3-0 is not needed by the platform but the user still specified the path 61293d81d64SSandrine Bailleux# to a BL3-0 image then warn him that it will be ignored. 61393d81d64SSandrine Bailleuxcheck_bl30: 61493d81d64SSandrine Bailleux $(if ${BL30},$(warning "BL3-0 is not supported on platform ${PLAT}, it will just be ignored"),) 61593d81d64SSandrine Bailleuxendif 61693d81d64SSandrine Bailleux 61727713fb4SSoby Mathewifeq (${NEED_BL33},yes) 6186f971622SJuan Castillo$(if ${BL33}, $(eval $(call MAKE_TOOL_ARGS,33,${BL33},in_fip,${CERTS},${CERTS},${BL33_KEY}))) 61927713fb4SSoby Mathew 62027713fb4SSoby Mathew# If BL3-3 is needed by the platform then 'BL33' variable must be defined. 62127713fb4SSoby Mathewcheck_bl33: 6224bfc2d21SJon Medhurst $(if ${BL33},,$(error "To build a FIP, please set BL33 to point to the Normal World binary, eg: BL33=../uefi/FVP_AARCH64_EFI.fd")) 62327713fb4SSoby Mathewelse 62427713fb4SSoby Mathew 62527713fb4SSoby Mathew# If BL3-3 is not needed by the platform but the user still specified the path 62627713fb4SSoby Mathew# to a BL3-3 image then warn him that it will be ignored. 62727713fb4SSoby Mathewcheck_bl33: 62827713fb4SSoby Mathew $(if ${BL33},$(warning "BL3-3 is not supported on platform ${PLAT}, it will just be ignored"),) 62927713fb4SSoby Mathewendif 63027713fb4SSoby Mathew 6316f971622SJuan Castillo# Add the dependency on the certificates 6326f971622SJuan Castilloifneq (${GENERATE_COT},0) 63385cdfdb2SJuan Castillo fip: certificates 6346f971622SJuan Castilloendif 6356f971622SJuan Castillo 6366f971622SJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} check_bl30 check_bl33 6376f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 6386f971622SJuan Castillo @echo 6396f971622SJuan Castillo @echo "Built $@ successfully" 6406f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 6416f971622SJuan Castillo @echo 64227713fb4SSoby Mathew 6437f48fab9SJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} check_bl30 check_bl33 644f58ad36fSHarry Liebel ${Q}${FIPTOOL} --dump \ 645375f538aSAchin Gupta ${FIP_ARGS} \ 646f58ad36fSHarry Liebel $@ 647f58ad36fSHarry Liebel @echo 6482f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 6492f2cef46SJeenu Viswambharan @echo 650f58ad36fSHarry Liebel 651f58ad36fSHarry Liebel 65235fab8c9SJoakim Bechcscope: 65335fab8c9SJoakim Bech @echo " CSCOPE" 65435fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 65535fab8c9SJoakim Bech ${Q}cscope -b -q -k 65635fab8c9SJoakim Bech 65772ee3314SRyan Harkinhelp: 658c04d2606SDan Handley @echo "usage: ${MAKE} PLAT=<${PLATFORMS}> [OPTIONS] [TARGET]" 65972ee3314SRyan Harkin @echo "" 66072ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 66108c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 66272ee3314SRyan Harkin @echo "" 6631b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 6641b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 6651b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 6661b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 6671b578596SSandrine Bailleux @echo "" 66872ee3314SRyan Harkin @echo "Supported Targets:" 6691b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 67036eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 6718aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 6721b578596SSandrine Bailleux @echo " bl31 Build the BL3-1 binary" 6731b578596SSandrine Bailleux @echo " bl32 Build the BL3-2 binary" 6741b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 67536eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 67636eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 67736eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 67872ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 67935fab8c9SJoakim Bech @echo " cscope Generate cscope index" 68072ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 6816f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 682f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package(FIP) creation tool" 68372ee3314SRyan Harkin @echo "" 6841b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 68572ee3314SRyan Harkin @echo "" 68672ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 68772ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 688