blob: 4270e2f8546377a7e592132605b6081e8851c211 [file] [log] [blame]
Jeevan Shriram062058c2016-11-07 16:46:44 -08001#Android makefile to build bootloader as a part of Android Build
Bhanuprakash Modem23720102018-09-27 21:55:40 +05302ANDROID_TOP=$(shell pwd)
3CLANG_BIN := $(ANDROID_TOP)/$(LLVM_PREBUILTS_PATH)/
lijuang65c51d52018-03-28 13:52:57 +08004ABL_USE_SDLLVM := false
5
6ifneq ($(wildcard $(SDCLANG_PATH)),)
7 ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
8 CLANG_BIN := $(SDCLANG_PATH)/
9 else
Bhanuprakash Modem23720102018-09-27 21:55:40 +053010 CLANG_BIN := $(ANDROID_TOP)/$(SDCLANG_PATH)/
lijuang65c51d52018-03-28 13:52:57 +080011 endif
12
13 ABL_USE_SDLLVM := true
Ashwini Muduganti36db63f2017-12-12 14:20:38 -080014endif
15
Bhanuprakash Modem78a89d72018-10-10 19:00:44 +053016# LD is not available for older Android versions
17ifeq (1,$(filter 1,$(shell echo "$$(( $(PLATFORM_SDK_VERSION) > 27 ))" )))
18LDOPT="-fuse-ld=$(ANDROID_TOP)/$(SOONG_LLVM_PREBUILTS_PATH)/ld.lld"
19endif
20
Bhanuprakash Modem23720102018-09-27 21:55:40 +053021# Use host tools from prebuilts. Partner should determine the correct host tools to use
Bhanuprakash Modem78a89d72018-10-10 19:00:44 +053022PREBUILT_HOST_TOOLS := CC=$(ANDROID_TOP)/$(CLANG)\ \
23 CXX=$(ANDROID_TOP)/$(CLANG_CXX)\ \
24 LDPATH=$(LDOPT)\ \
Bhanuprakash Modem23720102018-09-27 21:55:40 +053025 AR=$(ANDROID_TOP)/$(HOST_AR)
Bhanuprakash Modem78a89d72018-10-10 19:00:44 +053026PREBUILT_PYTHON_PATH=$(ANDROID_TOP)/prebuilts/python/linux-x86/2.7.5/bin/python2
Bhanuprakash Modem23720102018-09-27 21:55:40 +053027
Mukesh Ojhad29676a2018-04-10 17:37:56 +053028DISABLE_PARALLEL_DOWNLOAD_FLASH := DISABLE_PARALLEL_DOWNLOAD_FLASH=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080029ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
30 VERIFIED_BOOT := VERIFIED_BOOT=1
31else
32 VERIFIED_BOOT := VERIFIED_BOOT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080033endif
34
Mukesh Ojha8dc65f52018-03-27 00:59:30 +053035ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
36 BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=1
37else
38 BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=0
39endif
40
Shivaprasad Hongal3860bbf2017-04-27 17:40:13 -070041ifeq ($(BOARD_AVB_ENABLE),true)
42 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=1
43else
44 VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
45endif
46
Zhen Kongdd5c5e32017-07-05 13:44:45 -070047ifeq ($(BOARD_LEVB_ENABLE),true)
48 VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=1
49else
50 VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=0
51endif
52
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080053ifeq ($(TARGET_BUILD_VARIANT),user)
Vijay Kumar Pendoti9946e042016-09-16 17:38:51 +053054 USER_BUILD_VARIANT := USER_BUILD_VARIANT=1
55else
56 USER_BUILD_VARIANT := USER_BUILD_VARIANT=0
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080057endif
58
Jeevan Shriramd5d169f2018-04-20 16:09:10 -070059ifneq ($(TARGET_BOOTLOADER_BOARD_NAME),)
60 BOARD_BOOTLOADER_PRODUCT_NAME := $(TARGET_BOOTLOADER_BOARD_NAME)
61else
62 BOARD_BOOTLOADER_PRODUCT_NAME := QC_Reference_Phone
63endif
64
Venkata Narendra Kumar Gutta688a1612018-04-18 17:12:50 -070065ifeq ($(BOARD_ABL_SAFESTACK_DISABLE),true)
66 ABL_SAFESTACK := false
67else
68 ABL_SAFESTACK := true
69endif
70
71SAFESTACK_SUPPORTED_CLANG_VERSION = 6.0
72
Maria Yu3a174b82017-06-23 19:33:26 +080073# For most platform, abl needed always be built
74# in aarch64 arthitecture to run.
75# Specify BOOTLOADER_ARCH if needed to built with
76# other ARCHs.
77ifeq ($(BOOTLOADER_ARCH),)
78 BOOTLOADER_ARCH := AARCH64
79endif
80TARGET_ARCHITECTURE := $(BOOTLOADER_ARCH)
81
Jeevan Shriramd29e4402017-11-06 14:04:11 -080082ifeq ($(TARGET_ARCHITECTURE),arm)
Bhanuprakash Modem23720102018-09-27 21:55:40 +053083 CLANG35_PREFIX := $(ANDROID_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin/arm-linux-androideabi-
84 CLANG35_GCC_TOOLCHAIN := $(ANDROID_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
Jeevan Shriramd29e4402017-11-06 14:04:11 -080085else
Bhanuprakash Modem23720102018-09-27 21:55:40 +053086 CLANG35_PREFIX := $(ANDROID_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android-
87 CLANG35_GCC_TOOLCHAIN := $(ANDROID_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
Jeevan Shriramd29e4402017-11-06 14:04:11 -080088endif
89
90
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080091# ABL ELF output
92TARGET_ABL := $(PRODUCT_OUT)/abl.elf
Channagoud Kadabi9dff4e22016-02-10 11:19:49 -080093TARGET_EMMC_BOOTLOADER := $(TARGET_ABL)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080094ABL_OUT := $(TARGET_OUT_INTERMEDIATES)/ABL_OBJ
95
96abl_clean:
97 $(hide) rm -f $(TARGET_ABL)
98
99$(ABL_OUT):
100 mkdir -p $(ABL_OUT)
101
102# Top level target
103$(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
Jeevan Shriramd29e4402017-11-06 14:04:11 -0800104 $(MAKE) -C bootable/bootloader/edk2 \
105 BOOTLOADER_OUT=../../../$(ABL_OUT) \
106 all \
Bhanuprakash Modem23720102018-09-27 21:55:40 +0530107 PREBUILT_HOST_TOOLS=$(PREBUILT_HOST_TOOLS) \
Bhanuprakash Modem78a89d72018-10-10 19:00:44 +0530108 PREBUILT_PYTHON_PATH=$(PREBUILT_PYTHON_PATH) \
Mukesh Ojha8dc65f52018-03-27 00:59:30 +0530109 $(BUILD_SYSTEM_ROOT_IMAGE) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -0800110 $(VERIFIED_BOOT) \
111 $(VERIFIED_BOOT_2) \
Zhen Kongdd5c5e32017-07-05 13:44:45 -0700112 $(VERIFIED_BOOT_LE) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -0800113 $(USER_BUILD_VARIANT) \
Mukesh Ojhad29676a2018-04-10 17:37:56 +0530114 $(DISABLE_PARALLEL_DOWNLOAD_FLASH) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -0800115 CLANG_BIN=$(CLANG_BIN) \
116 CLANG_PREFIX=$(CLANG35_PREFIX)\
lijuang65c51d52018-03-28 13:52:57 +0800117 ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \
Venkata Narendra Kumar Gutta688a1612018-04-18 17:12:50 -0700118 ABL_SAFESTACK=$(ABL_SAFESTACK) \
119 SAFESTACK_SUPPORTED_CLANG_VERSION=$(SAFESTACK_SUPPORTED_CLANG_VERSION) \
Jeevan Shriramd29e4402017-11-06 14:04:11 -0800120 CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\
Jeevan Shriramd5d169f2018-04-20 16:09:10 -0700121 TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE) \
122 BOARD_BOOTLOADER_PRODUCT_NAME=$(BOARD_BOOTLOADER_PRODUCT_NAME)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -0800123