blob: 2a57f0f946e37f089c4ccea7c54a779437d86b5a [file] [log] [blame]
Vishal Bhoj9a67d912016-06-09 10:02:07 +01001AARCH64_TOOLCHAIN=GCC49
2EDK2_DIR=$(ANDROID_BUILD_TOP)/device/linaro/bootloader/edk2
3UEFI_TOOLS_DIR=$(ANDROID_BUILD_TOP)/device/linaro/hikey/uefi-tools
4ATF_DIR=$(ANDROID_BUILD_TOP)/device/linaro/bootloader/arm-trusted-firmware
5PRODUCT_OUT?=out/target/product/hikey
6DIST_DIR?=$(ANDROID_BUILD_TOP)/out/dist
7
Greg Hackmann85085c52016-10-20 14:04:50 -07008ifdef DEBUG
9 TARGET = DEBUG
10else
11 TARGET = RELEASE
12endif
13
Vishal Bhoj9a67d912016-06-09 10:02:07 +010014all: $(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 Hackmann85085c52016-10-20 14:04:50 -070028 $(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 Bhoj9a67d912016-06-09 10:02:07 +010030
31$(DIST_DIR)/l-loader.bin: $(DIST_DIR)/fip.bin
32 cd $(ANDROID_BUILD_TOP)/device/linaro/hikey/l-loader && \
Greg Hackmann85085c52016-10-20 14:04:50 -070033 ln -sf $(EDK2_DIR)/Build/HiKey/$(TARGET)_GCC49/FV//bl1.bin && \
Vishal Bhoj9a67d912016-06-09 10:02:07 +010034 make CROSS_COMPILE=arm-linux-androideabi- l-loader.bin && \
35 mv l-loader.bin $(DIST_DIR)/
John Stultzb5d73392016-08-05 14:05:15 -070036
37clean:
38 rm -rf $(DIST_DIR)/fip.bin $(DIST_DIR)/l-loader.bin
39