blob: 7b0f78bf577570ebebc6a5a14b99846a23007f0a [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001#
Dan Handleye83b0ca2014-01-14 18:17:09 +00002# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003#
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# Decrease the verbosity of the make script
32# can be made verbose by passing V=1 at the make command line
33ifdef V
James Morrisseyeaaeece2013-11-01 13:56:59 +000034 KBUILD_VERBOSE = ${V}
Achin Gupta4f6ad662013-10-25 09:08:21 +010035else
36 KBUILD_VERBOSE = 0
37endif
38
Achin Gupta7421b462014-02-01 18:53:26 +000039# Checkpatch ignores
40CHECK_IGNORE = --ignore COMPLEX_MACRO
41
42CHECKPATCH_ARGS = --no-tree --no-signoff ${CHECK_IGNORE}
43CHECKCODE_ARGS = --no-patch --no-tree --no-signoff ${CHECK_IGNORE}
Ian Spray36eaaf32014-01-30 17:25:28 +000044
James Morrisseyeaaeece2013-11-01 13:56:59 +000045ifeq "${KBUILD_VERBOSE}" "0"
Achin Gupta4f6ad662013-10-25 09:08:21 +010046 Q=@
Ian Spray36eaaf32014-01-30 17:25:28 +000047 CHECKCODE_ARGS += --no-summary --terse
Achin Gupta4f6ad662013-10-25 09:08:21 +010048else
49 Q=
50endif
51
52DEBUG ?= 0
James Morrisseyeaaeece2013-11-01 13:56:59 +000053
54ifneq (${DEBUG}, 0)
55 BUILD_TYPE := debug
56else
57 BUILD_TYPE := release
58endif
59
Ryan Harkind7a6b0f2014-01-13 14:40:13 +000060BL_COMMON_OBJS := misc_helpers.o \
61 cache_helpers.o \
62 tlb_helpers.o \
Achin Guptaa0cd9892014-02-09 13:30:38 +000063 xlat_helpers.o \
Ryan Harkind7a6b0f2014-01-13 14:40:13 +000064 std.o \
65 bl_common.o \
James Morrisseyf2f9bb52014-02-10 16:18:59 +000066 platform_helpers.o \
67 io_storage.o
Ryan Harkind7a6b0f2014-01-13 14:40:13 +000068
Ryan Harkin25cff832014-01-13 12:37:03 +000069ARCH ?= aarch64
Achin Gupta4f6ad662013-10-25 09:08:21 +010070
Ryan Harkin25cff832014-01-13 12:37:03 +000071# By default, build all platforms available
72PLAT ?= all
Achin Gupta375f5382014-02-18 18:12:48 +000073# By default, build no SPD component
74SPD ?= none
Achin Gupta4f6ad662013-10-25 09:08:21 +010075
Ryan Harkin25cff832014-01-13 12:37:03 +000076BUILD_BASE := ./build
77BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
78BUILD_BL1 := ${BUILD_PLAT}/bl1
79BUILD_BL2 := ${BUILD_PLAT}/bl2
80BUILD_BL31 := ${BUILD_PLAT}/bl31
81BUILD_DIRS := ${BUILD_BL1} ${BUILD_BL2} ${BUILD_BL31}
Achin Gupta4f6ad662013-10-25 09:08:21 +010082
Ryan Harkin25cff832014-01-13 12:37:03 +000083PLATFORMS := $(shell ls -I common plat/)
Achin Gupta375f5382014-02-18 18:12:48 +000084SPDS := $(shell ls -I none services/spd)
Ryan Harkin72ee3312014-01-15 16:55:07 +000085HELP_PLATFORMS := $(shell echo ${PLATFORMS} | sed 's/ /|/g')
86
Ryan Harkin25cff832014-01-13 12:37:03 +000087ifeq (${PLAT},)
88 $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform.")
89endif
90ifeq ($(findstring ${PLAT},${PLATFORMS} all),)
91 $(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}")
92endif
93
94ifeq (${PLAT},all)
95all: ${PLATFORMS}
96else
Harry Liebelf58ad362014-01-10 18:00:33 +000097all: msg_start bl1 bl2 bl31 fip
Ryan Harkin25cff832014-01-13 12:37:03 +000098endif
Achin Gupta4f6ad662013-10-25 09:08:21 +010099
Ryan Harkin25cff832014-01-13 12:37:03 +0000100msg_start:
101 @echo "Building ${PLAT}"
Achin Gupta4f6ad662013-10-25 09:08:21 +0100102
Ryan Harkin25cff832014-01-13 12:37:03 +0000103${PLATFORMS}:
104 ${MAKE} PLAT=$@ all
Achin Gupta4f6ad662013-10-25 09:08:21 +0100105
Ryan Harkin25cff832014-01-13 12:37:03 +0000106ifneq (${PLAT},all)
107 $(info Including ${PLAT}/platform.mk)
108 include plat/${PLAT}/platform.mk
109 $(info Including bl1.mk)
110 include bl1/bl1.mk
111 $(info Including bl2.mk)
112 include bl2/bl2.mk
113 $(info Including bl31.mk)
114 include bl31/bl31.mk
115endif
Achin Gupta4f6ad662013-10-25 09:08:21 +0100116
Achin Gupta375f5382014-02-18 18:12:48 +0000117# Include SPD Makefile if one has been specified
118ifneq (${SPD},none)
119 # We expect to locate an spd.mk under the specified SPD directory
120 SPD_MAKE := $(shell m="services/spd/${SPD}/${SPD}.mk"; [ -f "$$m" ] && echo "$$m")
121
122 ifeq (${SPD_MAKE},)
123 $(error Error: No services/spd/${SPD}/${SPD}.mk located)
124 endif
125 $(info Including ${SPD_MAKE})
126 include ${SPD_MAKE}
127
128 # If there's BL32 companion for the chosen SPD, and the SPD wants to build the
129 # BL2 from source, we expect that the SPD's Makefile would set NEED_BL32
130 # variable to "yes"
131endif
132
Harry Liebelf58ad362014-01-10 18:00:33 +0000133.PHONY: all msg_start ${PLATFORMS} dump clean realclean distclean bl1 bl2 bl31 cscope locate-checkpatch checkcodebase checkpatch fiptool fip locate-bl33
James Morrisseyeaaeece2013-11-01 13:56:59 +0000134.SUFFIXES:
135
136
Ryan Harkin25cff832014-01-13 12:37:03 +0000137BL1_OBJS := $(addprefix ${BUILD_BL1}/,${BL1_OBJS} ${BL_COMMON_OBJS} ${PLAT_BL_COMMON_OBJS})
138BL2_OBJS := $(addprefix ${BUILD_BL2}/,${BL2_OBJS} ${BL_COMMON_OBJS} ${PLAT_BL_COMMON_OBJS})
Achin Gupta375f5382014-02-18 18:12:48 +0000139BL31_OBJS := $(addprefix ${BUILD_BL31}/,${BL31_OBJS} ${BL_COMMON_OBJS} ${PLAT_BL_COMMON_OBJS} ${SPD_OBJS})
James Morrisseyeaaeece2013-11-01 13:56:59 +0000140BL1_MAPFILE := $(addprefix ${BUILD_BL1}/,${BL1_MAPFILE})
141BL2_MAPFILE := $(addprefix ${BUILD_BL2}/,${BL2_MAPFILE})
142BL31_MAPFILE := $(addprefix ${BUILD_BL31}/,${BL31_MAPFILE})
143BL1_LINKERFILE := $(addprefix ${BUILD_BL1}/,${BL1_LINKERFILE})
144BL2_LINKERFILE := $(addprefix ${BUILD_BL2}/,${BL2_LINKERFILE})
145BL31_LINKERFILE := $(addprefix ${BUILD_BL31}/,${BL31_LINKERFILE})
Achin Gupta4f6ad662013-10-25 09:08:21 +0100146
Ryan Harkind7a6b0f2014-01-13 14:40:13 +0000147INCLUDES += -Ilib/include/ \
James Morrisseyf2f9bb52014-02-10 16:18:59 +0000148 -Idrivers/io \
Ryan Harkind7a6b0f2014-01-13 14:40:13 +0000149 -Iinclude/${ARCH}/ \
150 -Iinclude/ \
151 -Iarch/system/gic \
Achin Gupta0a9f7472014-02-09 17:48:12 +0000152 -Iservices/psci \
Ryan Harkind7a6b0f2014-01-13 14:40:13 +0000153 -Iinclude/stdlib \
154 -Iinclude/stdlib/sys \
155 -Iplat/${PLAT} \
Achin Gupta375f5382014-02-18 18:12:48 +0000156 ${PLAT_INCLUDES} \
157 ${SPD_INCLUDES}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100158
Harry Liebel0af6d642013-12-20 18:51:12 +0000159ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
Sandrine Bailleuxdf64a552014-02-11 13:31:33 +0000160 -mgeneral-regs-only -D__ASSEMBLY__ ${INCLUDES} \
161 -DDEBUG=${DEBUG}
Harry Liebel4f603682014-01-14 18:11:48 +0000162CFLAGS := -nostdinc -pedantic -ffreestanding -Wall \
163 -Werror -mgeneral-regs-only -std=c99 -c -Os \
164 -DDEBUG=${DEBUG} ${INCLUDES} ${CFLAGS}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100165
Sandrine Bailleux3e850a82013-11-20 11:50:48 +0000166LDFLAGS += --fatal-warnings -O1
James Morrisseyeaaeece2013-11-01 13:56:59 +0000167BL1_LDFLAGS := -Map=${BL1_MAPFILE} --script ${BL1_LINKERFILE} --entry=${BL1_ENTRY_POINT}
168BL2_LDFLAGS := -Map=${BL2_MAPFILE} --script ${BL2_LINKERFILE} --entry=${BL2_ENTRY_POINT}
169BL31_LDFLAGS := -Map=${BL31_MAPFILE} --script ${BL31_LINKERFILE} --entry=${BL31_ENTRY_POINT}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100170
171
172vpath %.ld.S bl1:bl2:bl31
173vpath %.c bl1:bl2:bl31
174vpath %.c bl1/${ARCH}:bl2/${ARCH}:bl31/${ARCH}
175vpath %.S bl1/${ARCH}:bl2/${ARCH}:bl31/${ARCH}
176
177
James Morrisseyeaaeece2013-11-01 13:56:59 +0000178ifneq (${DEBUG}, 0)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100179#CFLAGS += -g -O0
180CFLAGS += -g
181# -save-temps -fverbose-asm
182ASFLAGS += -g -Wa,--gdwarf-2
James Morrissey40a6f642014-02-10 14:24:36 +0000183else
184CFLAGS += -DNDEBUG=1
Achin Gupta4f6ad662013-10-25 09:08:21 +0100185endif
186
187
James Morrisseyeaaeece2013-11-01 13:56:59 +0000188CC := ${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 ${CFLAGS}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100197
198
Ryan Harkin25cff832014-01-13 12:37:03 +0000199bl1: ${BUILD_BL1} ${BUILD_PLAT}/bl1.bin
200bl2: ${BUILD_BL2} ${BUILD_PLAT}/bl2.bin
201bl31: ${BUILD_BL31} ${BUILD_PLAT}/bl31.bin
Achin Gupta4f6ad662013-10-25 09:08:21 +0100202
Ian Spray36eaaf32014-01-30 17:25:28 +0000203BASE_COMMIT ?= origin/master
204
Harry Liebelf58ad362014-01-10 18:00:33 +0000205# Variables for use with Firmware Image Package
206FIPTOOLPATH ?= tools/fip_create
Achin Gupta375f5382014-02-18 18:12:48 +0000207FIPTOOL ?= ${FIPTOOLPATH}/fip_create
Harry Liebelf58ad362014-01-10 18:00:33 +0000208fiptool: ${FIPTOOL}
209fip: ${BUILD_PLAT}/fip.bin
210
Ryan Harkin25cff832014-01-13 12:37:03 +0000211ifeq (${PLAT},all)
212 ifeq (${MAKECMDGOALS},clean)
213 $(error "Please select a platform with PLAT=<platform>. You can use 'make distclean' to clean up all platform builds")
214 endif
215endif
Ian Spray36eaaf32014-01-30 17:25:28 +0000216
217locate-checkpatch:
218ifndef CHECKPATCH
219 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
220else
221ifeq (,$(wildcard ${CHECKPATCH}))
222 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
223endif
224endif
225
Harry Liebelf58ad362014-01-10 18:00:33 +0000226locate-bl33:
227ifndef BL33
228 $(error "Please set BL33 to point to the Normal World binary, eg: BL33=../uefi/FVP_AARCH64_EFI.fd")
229else
230ifeq (,$(wildcard ${BL33}))
231 $(error "The file BL33 points to cannot be found (${BL33})")
232endif
233endif
234
235
Achin Gupta375f5382014-02-18 18:12:48 +0000236# If BL32 needs to be built, provide necessary build rules and targets
237ifeq (${NEED_BL32},yes)
238BUILD_BL32 := ${BUILD_PLAT}/bl32
239BUILD_DIRS += ${BUILD_BL32}
240
241BL32_OBJS := $(addprefix ${BUILD_BL32}/,${BL32_OBJS})
242BL32_MAPFILE := $(addprefix ${BUILD_BL32}/,${BL32_MAPFILE})
243BL32_LINKERFILE := $(addprefix ${BUILD_BL32}/,${BL32_LINKERFILE})
244BL32_LDFLAGS := -Map=${BL32_MAPFILE} --script ${BL32_LINKERFILE} --entry=${BL32_ENTRY_POINT}
245
246bl32: ${BUILD_BL32} ${BUILD_PLAT}/bl32.bin
247all: bl32
248dump: bl32_dump
249.PHONY: bl32
250
251# Add BL32 image to FIP's input image list
252FIP_DEPS := bl32
253FIP_ARGS := --bl32 ${BUILD_PLAT}/bl32.bin
254
255${BUILD_BL32}/%.o: %.S
256 @echo " AS $<"
257 ${Q}${AS} ${ASFLAGS} -c $< -o $@
258
259${BUILD_BL32}/%.o: %.c
260 @echo " CC $<"
261 ${Q}${CC} ${CFLAGS} -c $< -o $@
262
263${BUILD_BL32}/%.ld: %.ld.S
264 @echo " PP $<"
265 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
266
267${BUILD_BL32}/bl32.elf: ${BL32_OBJS} ${BL32_LINKERFILE}
268 @echo " LD $@"
269 ${Q}${LD} -o $@ ${LDFLAGS} ${BL32_LDFLAGS} ${BL32_OBJS}
270
271${BUILD_PLAT}/bl32.bin: ${BUILD_BL32}/bl32.elf
272 @echo " BIN $@"
273 ${Q}${OC} -O binary $< $@
274 @echo
275 @echo "Built $@ successfully"
276 @echo
277
278bl32_dump:
279 ${Q}${OD} -d ${BUILD_BL32}/bl32.elf > ${BUILD_BL32}/bl32.dump
280endif
281
282
Achin Gupta4f6ad662013-10-25 09:08:21 +0100283clean:
284 @echo " CLEAN"
Ryan Harkin25cff832014-01-13 12:37:03 +0000285 ${Q}rm -rf ${BUILD_PLAT}
Harry Liebelf58ad362014-01-10 18:00:33 +0000286 ${Q}make -C ${FIPTOOLPATH} clean
Achin Gupta4f6ad662013-10-25 09:08:21 +0100287
James Morrisseyeaaeece2013-11-01 13:56:59 +0000288realclean distclean:
289 @echo " REALCLEAN"
290 ${Q}rm -rf ${BUILD_BASE}
Joakim Bech35fab8c2014-01-23 14:51:49 +0100291 ${Q}rm -f ${CURDIR}/cscope.*
Harry Liebelf58ad362014-01-10 18:00:33 +0000292 ${Q}make -C ${FIPTOOLPATH} clean
Achin Gupta4f6ad662013-10-25 09:08:21 +0100293
294dump:
295 @echo " OBJDUMP"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000296 ${Q}${OD} -d ${BUILD_BL1}/bl1.elf > ${BUILD_BL1}/bl1.dump
297 ${Q}${OD} -d ${BUILD_BL2}/bl2.elf > ${BUILD_BL2}/bl2.dump
298 ${Q}${OD} -d ${BUILD_BL31}/bl31.elf > ${BUILD_BL31}/bl31.dump
299
Ian Spray36eaaf32014-01-30 17:25:28 +0000300checkcodebase: locate-checkpatch
301 @echo " CHECKING STYLE"
302 @if test -d .git ; then \
303 git ls-files | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ; \
304 else \
305 find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \
306 fi
307
308checkpatch: locate-checkpatch
309 @echo " CHECKING STYLE"
310 @git format-patch --stdout ${BASE_COMMIT} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true
311
Harry Liebelf58ad362014-01-10 18:00:33 +0000312${FIPTOOL}:
313 @echo " BUILDING FIRMWARE IMAGE PACKAGE TOOL $@"
314 @echo
315 ${Q}make -C ${FIPTOOLPATH}
316 @echo
317
James Morrisseyeaaeece2013-11-01 13:56:59 +0000318${BUILD_DIRS}:
319 ${Q}mkdir -p "$@"
Achin Gupta4f6ad662013-10-25 09:08:21 +0100320
James Morrisseyeaaeece2013-11-01 13:56:59 +0000321
322${BUILD_BL1}/%.o: %.S
323 @echo " AS $<"
324 ${Q}${AS} ${ASFLAGS} -c $< -o $@
325
326${BUILD_BL2}/%.o: %.S
327 @echo " AS $<"
328 ${Q}${AS} ${ASFLAGS} -c $< -o $@
329
330${BUILD_BL31}/%.o: %.S
Achin Gupta4f6ad662013-10-25 09:08:21 +0100331 @echo " AS $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000332 ${Q}${AS} ${ASFLAGS} -c $< -o $@
333
334${BUILD_BL1}/%.o: %.c
335 @echo " CC $<"
336 ${Q}${CC} ${CFLAGS} -c $< -o $@
337
338${BUILD_BL2}/%.o: %.c
339 @echo " CC $<"
340 ${Q}${CC} ${CFLAGS} -c $< -o $@
Achin Gupta4f6ad662013-10-25 09:08:21 +0100341
James Morrisseyeaaeece2013-11-01 13:56:59 +0000342${BUILD_BL31}/%.o: %.c
Achin Gupta4f6ad662013-10-25 09:08:21 +0100343 @echo " CC $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000344 ${Q}${CC} ${CFLAGS} -c $< -o $@
345
346${BUILD_BL1}/%.ld: %.ld.S
Ryan Harkin25cff832014-01-13 12:37:03 +0000347 @echo " PP $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000348 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
349
350${BUILD_BL2}/%.ld: %.ld.S
Ryan Harkin25cff832014-01-13 12:37:03 +0000351 @echo " PP $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000352 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
Achin Gupta4f6ad662013-10-25 09:08:21 +0100353
James Morrisseyeaaeece2013-11-01 13:56:59 +0000354${BUILD_BL31}/%.ld: %.ld.S
Ryan Harkin25cff832014-01-13 12:37:03 +0000355 @echo " PP $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000356 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
Achin Gupta4f6ad662013-10-25 09:08:21 +0100357
358
James Morrisseyeaaeece2013-11-01 13:56:59 +0000359${BUILD_BL1}/bl1.elf: ${BL1_OBJS} ${BL1_LINKERFILE}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100360 @echo " LD $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000361 ${Q}${LD} -o $@ ${LDFLAGS} ${BL1_LDFLAGS} ${BL1_OBJS}
362
363${BUILD_BL2}/bl2.elf: ${BL2_OBJS} ${BL2_LINKERFILE}
364 @echo " LD $@"
365 ${Q}${LD} -o $@ ${LDFLAGS} ${BL2_LDFLAGS} ${BL2_OBJS}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100366
James Morrisseyeaaeece2013-11-01 13:56:59 +0000367${BUILD_BL31}/bl31.elf: ${BL31_OBJS} ${BL31_LINKERFILE}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100368 @echo " LD $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000369 ${Q}${LD} -o $@ ${LDFLAGS} ${BL31_LDFLAGS} ${BL31_OBJS}
370
Ryan Harkin25cff832014-01-13 12:37:03 +0000371${BUILD_PLAT}/bl1.bin: ${BUILD_BL1}/bl1.elf
372 @echo " BIN $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000373 ${Q}${OC} -O binary $< $@
374 @echo
Achin Gupta4f6ad662013-10-25 09:08:21 +0100375 @echo "Built $@ successfully"
376 @echo
377
Ryan Harkin25cff832014-01-13 12:37:03 +0000378${BUILD_PLAT}/bl2.bin: ${BUILD_BL2}/bl2.elf
379 @echo " BIN $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000380 ${Q}${OC} -O binary $< $@
381 @echo
Achin Gupta4f6ad662013-10-25 09:08:21 +0100382 @echo "Built $@ successfully"
383 @echo
384
Ryan Harkin25cff832014-01-13 12:37:03 +0000385${BUILD_PLAT}/bl31.bin: ${BUILD_BL31}/bl31.elf
386 @echo " BIN $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000387 ${Q}${OC} -O binary $< $@
388 @echo
389 @echo "Built $@ successfully"
390 @echo
Ryan Harkin72ee3312014-01-15 16:55:07 +0000391
Achin Gupta375f5382014-02-18 18:12:48 +0000392${BUILD_PLAT}/fip.bin: bl2 bl31 ${FIP_DEPS} locate-bl33 ${FIPTOOL}
Harry Liebelf58ad362014-01-10 18:00:33 +0000393 @echo " CREATE FIRMWARE IMAGE PACKAGE $@"
394 @echo
395 ${Q}${FIPTOOL} --dump \
396 --bl2 ${BUILD_PLAT}/bl2.bin \
397 --bl31 ${BUILD_PLAT}/bl31.bin \
398 --bl33 ${BL33} \
Achin Gupta375f5382014-02-18 18:12:48 +0000399 ${FIP_ARGS} \
Harry Liebelf58ad362014-01-10 18:00:33 +0000400 $@
401 @echo
402
403
Joakim Bech35fab8c2014-01-23 14:51:49 +0100404cscope:
405 @echo " CSCOPE"
406 ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
407 ${Q}cscope -b -q -k
408
Ryan Harkin72ee3312014-01-15 16:55:07 +0000409help:
Ian Spray36eaaf32014-01-30 17:25:28 +0000410 @echo "usage: ${MAKE} PLAT=<all|${HELP_PLATFORMS}> <all|bl1|bl2|bl31|distclean|clean|checkcodebase|checkpatch|dump>"
Ryan Harkin72ee3312014-01-15 16:55:07 +0000411 @echo ""
412 @echo "PLAT is used to specify which platform you wish to build."
413 @echo ""
414 @echo "Supported Targets:"
Achin Gupta375f5382014-02-18 18:12:48 +0000415 @echo " all Build the BL1, BL31 binaries"
Ian Spray36eaaf32014-01-30 17:25:28 +0000416 @echo " bl1 Build the BL1 binary"
Ian Spray36eaaf32014-01-30 17:25:28 +0000417 @echo " bl31 Build the BL31 binary"
418 @echo " checkcodebase Check the coding style of the entire source tree"
419 @echo " checkpatch Check the coding style on changes in the current"
420 @echo " branch against BASE_COMMIT (default origin/master)"
421 @echo " clean Clean the build for the selected platform"
Harry Liebelf58ad362014-01-10 18:00:33 +0000422 @echo " cscope Generate cscope index"
Ian Spray36eaaf32014-01-30 17:25:28 +0000423 @echo " distclean Remove all build artifacts for all platforms"
424 @echo " dump Generate object file dumps"
Harry Liebelf58ad362014-01-10 18:00:33 +0000425 @echo " fiptool Build the Firmware Image Package(FIP) creation tool"
Ryan Harkin72ee3312014-01-15 16:55:07 +0000426 @echo ""
427 @echo "note: most build targets require PLAT to be set to a specific platform."
428 @echo ""
429 @echo "example: build all targets for the FVP platform:"
430 @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"