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