blob: f3f28f6605bf6419983a8c0551925bb9bbb34098 [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
Mukesh Ojhad29676a2018-04-10 17:37:56 +053015DISABLE_PARALLEL_DOWNLOAD_FLASH := DISABLE_PARALLEL_DOWNLOAD_FLASH=0
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
Mukesh Ojha8dc65f52018-03-27 00:59:30 +053022ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
23 BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=1
24else
25 BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=0
26endif
27
Shivaprasad Hongal3860bbf2017-04-27 17:40:13 -070028ifeq ($(BOARD_AVB_ENABLE),true)
29 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=1
30else
31 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
32endif
33
Zhen Kongdd5c5e32017-07-05 13:44:45 -070034ifeq ($(BOARD_LEVB_ENABLE),true)
35 VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=1
36else
37 VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=0
38endif
39
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080040ifeq ($(TARGET_BUILD_VARIANT),user)
Vijay Kumar Pendoti9946e042016-09-16 17:38:51 +053041 USER_BUILD_VARIANT := USER_BUILD_VARIANT=1
42else
43 USER_BUILD_VARIANT := USER_BUILD_VARIANT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080044endif
45
Maria Yu3a174b82017-06-23 19:33:26 +080046# For most platform, abl needed always be built
47# in aarch64 arthitecture to run.
48# Specify BOOTLOADER_ARCH if needed to built with
49# other ARCHs.
50ifeq ($(BOOTLOADER_ARCH),)
51 BOOTLOADER_ARCH := AARCH64
52endif
53TARGET_ARCHITECTURE := $(BOOTLOADER_ARCH)
54
Jeevan Shriramd29e4402017-11-06 14:04:11 -080055ifeq ($(TARGET_ARCHITECTURE),arm)
56 CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin/arm-linux-androideabi-
57 CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
58else
59 CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android-
60 CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
61endif
62
63
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080064# ABL ELF output
65TARGET_ABL := $(PRODUCT_OUT)/abl.elf
Channagoud Kadabi9dff4e22016-02-10 11:19:49 -080066TARGET_EMMC_BOOTLOADER := $(TARGET_ABL)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080067ABL_OUT := $(TARGET_OUT_INTERMEDIATES)/ABL_OBJ
68
69abl_clean:
70 $(hide) rm -f $(TARGET_ABL)
71
72$(ABL_OUT):
73 mkdir -p $(ABL_OUT)
74
75# Top level target
76$(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
Jeevan Shriramd29e4402017-11-06 14:04:11 -080077 $(MAKE) -C bootable/bootloader/edk2 \
78 BOOTLOADER_OUT=../../../$(ABL_OUT) \
79 all \
Mukesh Ojha8dc65f52018-03-27 00:59:30 +053080 $(BUILD_SYSTEM_ROOT_IMAGE) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -080081 $(VERIFIED_BOOT) \
82 $(VERIFIED_BOOT_2) \
Zhen Kongdd5c5e32017-07-05 13:44:45 -070083 $(VERIFIED_BOOT_LE) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -080084 $(USER_BUILD_VARIANT) \
Mukesh Ojhad29676a2018-04-10 17:37:56 +053085 $(DISABLE_PARALLEL_DOWNLOAD_FLASH) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -080086 CLANG_BIN=$(CLANG_BIN) \
87 CLANG_PREFIX=$(CLANG35_PREFIX)\
lijuang65c51d52018-03-28 13:52:57 +080088 ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -080089 CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\
90 TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080091