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