Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 1 | AARCH64_TOOLCHAIN=GCC49 |
| 2 | EDK2_DIR=$(ANDROID_BUILD_TOP)/device/linaro/bootloader/edk2 |
| 3 | UEFI_TOOLS_DIR=$(ANDROID_BUILD_TOP)/device/linaro/hikey/uefi-tools |
| 4 | ATF_DIR=$(ANDROID_BUILD_TOP)/device/linaro/bootloader/arm-trusted-firmware |
| 5 | PRODUCT_OUT?=out/target/product/hikey |
| 6 | DIST_DIR?=$(ANDROID_BUILD_TOP)/out/dist |
| 7 | |
Greg Hackmann | 85085c5 | 2016-10-20 14:04:50 -0700 | [diff] [blame] | 8 | ifdef DEBUG |
| 9 | TARGET = DEBUG |
| 10 | else |
| 11 | TARGET = RELEASE |
| 12 | endif |
| 13 | |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 14 | all: $(DIST_DIR)/fip.bin $(DIST_DIR)/l-loader.bin |
| 15 | |
| 16 | $(DIST_DIR)/fip.bin: |
| 17 | cd $(EDK2_DIR) && \ |
| 18 | rm -rf Conf/tools_def.txt Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt && \ |
| 19 | export CROSS_COMPILE_32=arm-linux-androideabi- && \ |
| 20 | export CROSS_COMPILE_64=aarch64-linux-android- && \ |
| 21 | rm -rf OpenPlatformPkg && \ |
| 22 | ln -sf $(EDK2_DIR)/../OpenPlatformPkg OpenPlatformPkg && \ |
| 23 | rm -rf $(EDK2_DIR)/Build/ && \ |
| 24 | mkdir -p $(EDK2_DIR)/Build/ && \ |
| 25 | mkdir -p $(DIST_DIR) && \ |
| 26 | mkdir -p $(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi && \ |
| 27 | ln -sf $(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi $(EDK2_DIR)/Build/HiKey && \ |
Greg Hackmann | 85085c5 | 2016-10-20 14:04:50 -0700 | [diff] [blame] | 28 | $(UEFI_TOOLS_DIR)/uefi-build.sh -b $(TARGET) -D EDK2_OUT_DIR=$(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi -a $(ATF_DIR) hikey && \ |
| 29 | cp $(EDK2_DIR)/Build/HiKey/$(TARGET)_GCC49/FV/fip.bin $(DIST_DIR)/ |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 30 | |
| 31 | $(DIST_DIR)/l-loader.bin: $(DIST_DIR)/fip.bin |
| 32 | cd $(ANDROID_BUILD_TOP)/device/linaro/hikey/l-loader && \ |
Greg Hackmann | 85085c5 | 2016-10-20 14:04:50 -0700 | [diff] [blame] | 33 | ln -sf $(EDK2_DIR)/Build/HiKey/$(TARGET)_GCC49/FV//bl1.bin && \ |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame^] | 34 | make CROSS_COMPILE=arm-linux-androideabi- hikey && \ |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 35 | mv l-loader.bin $(DIST_DIR)/ |
John Stultz | b5d7339 | 2016-08-05 14:05:15 -0700 | [diff] [blame] | 36 | |
| 37 | clean: |
Vishal Bhoj | d8bc828 | 2017-08-04 17:04:31 +0100 | [diff] [blame] | 38 | rm -rf $(DIST_DIR)/fip.bin $(DIST_DIR)/l-loader.bin $(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi $(EDK2_DIR)/Build/HiKey |
John Stultz | daa4053 | 2017-08-04 11:39:33 -0700 | [diff] [blame] | 39 | cd $(EDK2_DIR)/BaseTools && make clean |