blob: 75a539b7bd623834562f8f3fbf22b8c108516a45 [file] [log] [blame]
Jeevan Shriram062058c2016-11-07 16:46:44 -08001#Android makefile to build bootloader as a part of Android Build
Ashwini Muduganti36db63f2017-12-12 14:20:38 -08002ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
3 CLANG_BIN := $(SDCLANG_PATH)/
4else
5 CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH)/
6endif
7
Maria Yuf12a3612017-06-27 11:28:16 +08008ifneq ($(wildcard $(SDCLANG_PATH_2)),)
Ashwini Muduganti36db63f2017-12-12 14:20:38 -08009 ifeq ($(shell echo $(SDCLANG_PATH_2) | head -c 1),/)
10 CLANG_BIN := $(SDCLANG_PATH_2)/
11 else
12 CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH_2)/
13 endif
Maria Yuf12a3612017-06-27 11:28:16 +080014endif
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080015
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080016ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
17 VERIFIED_BOOT := VERIFIED_BOOT=1
18else
19 VERIFIED_BOOT := VERIFIED_BOOT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080020endif
21
Shivaprasad Hongal3860bbf2017-04-27 17:40:13 -070022ifeq ($(BOARD_AVB_ENABLE),true)
23 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=1
24else
25 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
26endif
27
Zhen Kongdd5c5e32017-07-05 13:44:45 -070028ifeq ($(BOARD_LEVB_ENABLE),true)
29 VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=1
30else
31 VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=0
32endif
33
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080034ifeq ($(TARGET_BUILD_VARIANT),user)
Vijay Kumar Pendoti9946e042016-09-16 17:38:51 +053035 USER_BUILD_VARIANT := USER_BUILD_VARIANT=1
36else
37 USER_BUILD_VARIANT := USER_BUILD_VARIANT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080038endif
39
Maria Yu3a174b82017-06-23 19:33:26 +080040# For most platform, abl needed always be built
41# in aarch64 arthitecture to run.
42# Specify BOOTLOADER_ARCH if needed to built with
43# other ARCHs.
44ifeq ($(BOOTLOADER_ARCH),)
45 BOOTLOADER_ARCH := AARCH64
46endif
47TARGET_ARCHITECTURE := $(BOOTLOADER_ARCH)
48
Jeevan Shriramd29e4402017-11-06 14:04:11 -080049ifeq ($(TARGET_ARCHITECTURE),arm)
50 CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin/arm-linux-androideabi-
51 CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
52else
53 CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android-
54 CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
55endif
56
57
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080058# ABL ELF output
59TARGET_ABL := $(PRODUCT_OUT)/abl.elf
Channagoud Kadabi9dff4e22016-02-10 11:19:49 -080060TARGET_EMMC_BOOTLOADER := $(TARGET_ABL)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080061ABL_OUT := $(TARGET_OUT_INTERMEDIATES)/ABL_OBJ
62
63abl_clean:
64 $(hide) rm -f $(TARGET_ABL)
65
66$(ABL_OUT):
67 mkdir -p $(ABL_OUT)
68
69# Top level target
70$(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
Jeevan Shriramd29e4402017-11-06 14:04:11 -080071 $(MAKE) -C bootable/bootloader/edk2 \
72 BOOTLOADER_OUT=../../../$(ABL_OUT) \
73 all \
74 $(VERIFIED_BOOT) \
75 $(VERIFIED_BOOT_2) \
Zhen Kongdd5c5e32017-07-05 13:44:45 -070076 $(VERIFIED_BOOT_LE) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -080077 $(USER_BUILD_VARIANT) \
78 CLANG_BIN=$(CLANG_BIN) \
79 CLANG_PREFIX=$(CLANG35_PREFIX)\
80 CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\
81 TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080082