blob: c9b3fca5d4e835e87c90eebde38cb84f9fa5fd1a [file] [log] [blame]
Jeevan Shriram062058c2016-11-07 16:46:44 -08001#Android makefile to build bootloader as a part of Android Build
lijuang65c51d52018-03-28 13:52:57 +08002CLANG_BIN := $(ANDROID_BUILD_TOP)/$(LLVM_PREBUILTS_PATH)/
3ABL_USE_SDLLVM := false
4
5ifneq ($(wildcard $(SDCLANG_PATH)),)
6 ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
7 CLANG_BIN := $(SDCLANG_PATH)/
8 else
9 CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH)/
10 endif
11
12 ABL_USE_SDLLVM := true
Ashwini Muduganti36db63f2017-12-12 14:20:38 -080013endif
14
Maria Yuf12a3612017-06-27 11:28:16 +080015ifneq ($(wildcard $(SDCLANG_PATH_2)),)
Ashwini Muduganti36db63f2017-12-12 14:20:38 -080016 ifeq ($(shell echo $(SDCLANG_PATH_2) | head -c 1),/)
17 CLANG_BIN := $(SDCLANG_PATH_2)/
18 else
19 CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH_2)/
20 endif
lijuang65c51d52018-03-28 13:52:57 +080021
22 ABL_USE_SDLLVM := true
Maria Yuf12a3612017-06-27 11:28:16 +080023endif
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080024
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080025ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
26 VERIFIED_BOOT := VERIFIED_BOOT=1
27else
28 VERIFIED_BOOT := VERIFIED_BOOT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080029endif
30
Shivaprasad Hongal3860bbf2017-04-27 17:40:13 -070031ifeq ($(BOARD_AVB_ENABLE),true)
32 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=1
33else
34 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
35endif
36
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080037ifeq ($(TARGET_BUILD_VARIANT),user)
Vijay Kumar Pendoti9946e042016-09-16 17:38:51 +053038 USER_BUILD_VARIANT := USER_BUILD_VARIANT=1
39else
40 USER_BUILD_VARIANT := USER_BUILD_VARIANT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080041endif
42
Maria Yu3a174b82017-06-23 19:33:26 +080043# For most platform, abl needed always be built
44# in aarch64 arthitecture to run.
45# Specify BOOTLOADER_ARCH if needed to built with
46# other ARCHs.
47ifeq ($(BOOTLOADER_ARCH),)
48 BOOTLOADER_ARCH := AARCH64
49endif
50TARGET_ARCHITECTURE := $(BOOTLOADER_ARCH)
51
Jeevan Shriramd29e4402017-11-06 14:04:11 -080052ifeq ($(TARGET_ARCHITECTURE),arm)
53 CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin/arm-linux-androideabi-
54 CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
55else
56 CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android-
57 CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
58endif
59
60
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080061# ABL ELF output
62TARGET_ABL := $(PRODUCT_OUT)/abl.elf
Channagoud Kadabi9dff4e22016-02-10 11:19:49 -080063TARGET_EMMC_BOOTLOADER := $(TARGET_ABL)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080064ABL_OUT := $(TARGET_OUT_INTERMEDIATES)/ABL_OBJ
65
66abl_clean:
67 $(hide) rm -f $(TARGET_ABL)
68
69$(ABL_OUT):
70 mkdir -p $(ABL_OUT)
71
72# Top level target
73$(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
Jeevan Shriramd29e4402017-11-06 14:04:11 -080074 $(MAKE) -C bootable/bootloader/edk2 \
75 BOOTLOADER_OUT=../../../$(ABL_OUT) \
76 all \
77 $(VERIFIED_BOOT) \
78 $(VERIFIED_BOOT_2) \
79 $(USER_BUILD_VARIANT) \
80 CLANG_BIN=$(CLANG_BIN) \
81 CLANG_PREFIX=$(CLANG35_PREFIX)\
lijuang65c51d52018-03-28 13:52:57 +080082 ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -080083 CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\
84 TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080085