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