Peter Griffin | b81ef8d | 2015-09-10 21:55:12 +0100 | [diff] [blame] | 1 | CROSS_COMPILE := aarch64-linux-gnu- |
| 2 | output_dir := $(PWD)/../bin |
| 3 | makejobs := $(shell grep '^processor' /proc/cpuinfo | sort -u | wc -l) |
| 4 | makethreads := $(shell dc -e "$(makejobs) 1 + p") |
| 5 | make_options := GCC49_AARCH64_PREFIX=$CROSS_COMPILE \ |
| 6 | -j$(makethreads) -l$(makejobs) |
| 7 | |
| 8 | BL30_HIKEY := $(output_dir)/mcuimage.bin |
| 9 | BL33_HIKEY := $(output_dir)/u-boot-hikey.bin |
| 10 | |
| 11 | .PHONY: help |
| 12 | help: |
| 13 | @echo "**** Common Makefile ****" |
| 14 | @echo "example:" |
| 15 | @echo "make -f build-tf.mak build" |
| 16 | |
| 17 | .PHONY: have-crosscompiler |
| 18 | have-crosscompiler: |
| 19 | @echo -n "Check that $(CROSS_COMPILE)gcc is available..." |
| 20 | @which $(CROSS_COMPILE)gcc > /dev/null ; \ |
| 21 | if [ ! $$? -eq 0 ] ; then \ |
| 22 | echo "ERROR: cross-compiler $(CROSS_COMPILE)gcc not in PATH=$$PATH!" ; \ |
| 23 | echo "ABORTING." ; \ |
| 24 | exit 1 ; \ |
| 25 | else \ |
| 26 | echo "OK" ;\ |
| 27 | fi |
| 28 | |
| 29 | build: have-crosscompiler FORCE |
| 30 | @echo "Build TF for Hikey..." |
| 31 | rm -rf build/ |
| 32 | CROSS_COMPILE=$(CROSS_COMPILE) \ |
| 33 | make all fip \ |
| 34 | BL30=$(BL30_HIKEY) \ |
| 35 | BL33=$(BL33_HIKEY) \ |
| 36 | DEBUG=1 \ |
| 37 | PLAT=hikey |
| 38 | @echo "Copy resulting binaries..." |
| 39 | cp build/hikey/debug/bl1.bin $(output_dir)/bl1-hikey.bin |
| 40 | cp build/hikey/debug/fip.bin $(output_dir)/fip-hikey.bin |
| 41 | |
| 42 | FORCE: |