Jeevan Shriram | 062058c | 2016-11-07 16:46:44 -0800 | [diff] [blame] | 1 | #Android makefile to build bootloader as a part of Android Build |
lijuang | 65c51d5 | 2018-03-28 13:52:57 +0800 | [diff] [blame] | 2 | CLANG_BIN := $(ANDROID_BUILD_TOP)/$(LLVM_PREBUILTS_PATH)/ |
| 3 | ABL_USE_SDLLVM := false |
| 4 | |
| 5 | ifneq ($(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 Muduganti | 36db63f | 2017-12-12 14:20:38 -0800 | [diff] [blame] | 13 | endif |
| 14 | |
Mukesh Ojha | d29676a | 2018-04-10 17:37:56 +0530 | [diff] [blame] | 15 | DISABLE_PARALLEL_DOWNLOAD_FLASH := DISABLE_PARALLEL_DOWNLOAD_FLASH=0 |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 16 | ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true) |
| 17 | VERIFIED_BOOT := VERIFIED_BOOT=1 |
| 18 | else |
| 19 | VERIFIED_BOOT := VERIFIED_BOOT=0 |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 20 | endif |
| 21 | |
Mukesh Ojha | 8dc65f5 | 2018-03-27 00:59:30 +0530 | [diff] [blame] | 22 | ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) |
| 23 | BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=1 |
| 24 | else |
| 25 | BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=0 |
| 26 | endif |
| 27 | |
Shivaprasad Hongal | 3860bbf | 2017-04-27 17:40:13 -0700 | [diff] [blame] | 28 | ifeq ($(BOARD_AVB_ENABLE),true) |
| 29 | VERIFIED_BOOT_2 := VERIFIED_BOOT_2=1 |
| 30 | else |
| 31 | VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0 |
| 32 | endif |
| 33 | |
Zhen Kong | dd5c5e3 | 2017-07-05 13:44:45 -0700 | [diff] [blame] | 34 | ifeq ($(BOARD_LEVB_ENABLE),true) |
| 35 | VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=1 |
| 36 | else |
| 37 | VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=0 |
| 38 | endif |
| 39 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 40 | ifeq ($(TARGET_BUILD_VARIANT),user) |
Vijay Kumar Pendoti | 9946e04 | 2016-09-16 17:38:51 +0530 | [diff] [blame] | 41 | USER_BUILD_VARIANT := USER_BUILD_VARIANT=1 |
| 42 | else |
| 43 | USER_BUILD_VARIANT := USER_BUILD_VARIANT=0 |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 44 | endif |
| 45 | |
Jeevan Shriram | d5d169f | 2018-04-20 16:09:10 -0700 | [diff] [blame] | 46 | ifneq ($(TARGET_BOOTLOADER_BOARD_NAME),) |
| 47 | BOARD_BOOTLOADER_PRODUCT_NAME := $(TARGET_BOOTLOADER_BOARD_NAME) |
| 48 | else |
| 49 | BOARD_BOOTLOADER_PRODUCT_NAME := QC_Reference_Phone |
| 50 | endif |
| 51 | |
Venkata Narendra Kumar Gutta | 688a161 | 2018-04-18 17:12:50 -0700 | [diff] [blame^] | 52 | ifeq ($(BOARD_ABL_SAFESTACK_DISABLE),true) |
| 53 | ABL_SAFESTACK := false |
| 54 | else |
| 55 | ABL_SAFESTACK := true |
| 56 | endif |
| 57 | |
| 58 | SAFESTACK_SUPPORTED_CLANG_VERSION = 6.0 |
| 59 | |
Maria Yu | 3a174b8 | 2017-06-23 19:33:26 +0800 | [diff] [blame] | 60 | # For most platform, abl needed always be built |
| 61 | # in aarch64 arthitecture to run. |
| 62 | # Specify BOOTLOADER_ARCH if needed to built with |
| 63 | # other ARCHs. |
| 64 | ifeq ($(BOOTLOADER_ARCH),) |
| 65 | BOOTLOADER_ARCH := AARCH64 |
| 66 | endif |
| 67 | TARGET_ARCHITECTURE := $(BOOTLOADER_ARCH) |
| 68 | |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 69 | ifeq ($(TARGET_ARCHITECTURE),arm) |
| 70 | CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin/arm-linux-androideabi- |
| 71 | CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION) |
| 72 | else |
| 73 | CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android- |
| 74 | CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION) |
| 75 | endif |
| 76 | |
| 77 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 78 | # ABL ELF output |
| 79 | TARGET_ABL := $(PRODUCT_OUT)/abl.elf |
Channagoud Kadabi | 9dff4e2 | 2016-02-10 11:19:49 -0800 | [diff] [blame] | 80 | TARGET_EMMC_BOOTLOADER := $(TARGET_ABL) |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 81 | ABL_OUT := $(TARGET_OUT_INTERMEDIATES)/ABL_OBJ |
| 82 | |
| 83 | abl_clean: |
| 84 | $(hide) rm -f $(TARGET_ABL) |
| 85 | |
| 86 | $(ABL_OUT): |
| 87 | mkdir -p $(ABL_OUT) |
| 88 | |
| 89 | # Top level target |
| 90 | $(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET) |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 91 | $(MAKE) -C bootable/bootloader/edk2 \ |
| 92 | BOOTLOADER_OUT=../../../$(ABL_OUT) \ |
| 93 | all \ |
Mukesh Ojha | 8dc65f5 | 2018-03-27 00:59:30 +0530 | [diff] [blame] | 94 | $(BUILD_SYSTEM_ROOT_IMAGE) \ |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 95 | $(VERIFIED_BOOT) \ |
| 96 | $(VERIFIED_BOOT_2) \ |
Zhen Kong | dd5c5e3 | 2017-07-05 13:44:45 -0700 | [diff] [blame] | 97 | $(VERIFIED_BOOT_LE) \ |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 98 | $(USER_BUILD_VARIANT) \ |
Mukesh Ojha | d29676a | 2018-04-10 17:37:56 +0530 | [diff] [blame] | 99 | $(DISABLE_PARALLEL_DOWNLOAD_FLASH) \ |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 100 | CLANG_BIN=$(CLANG_BIN) \ |
| 101 | CLANG_PREFIX=$(CLANG35_PREFIX)\ |
lijuang | 65c51d5 | 2018-03-28 13:52:57 +0800 | [diff] [blame] | 102 | ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \ |
Venkata Narendra Kumar Gutta | 688a161 | 2018-04-18 17:12:50 -0700 | [diff] [blame^] | 103 | ABL_SAFESTACK=$(ABL_SAFESTACK) \ |
| 104 | SAFESTACK_SUPPORTED_CLANG_VERSION=$(SAFESTACK_SUPPORTED_CLANG_VERSION) \ |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 105 | CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\ |
Jeevan Shriram | d5d169f | 2018-04-20 16:09:10 -0700 | [diff] [blame] | 106 | TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE) \ |
| 107 | BOARD_BOOTLOADER_PRODUCT_NAME=$(BOARD_BOOTLOADER_PRODUCT_NAME) |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 108 | |