-
Notifications
You must be signed in to change notification settings - Fork 0
/
AndroidBoot.mk
108 lines (90 loc) · 3.14 KB
/
AndroidBoot.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#Android makefile to build bootloader as a part of Android Build
CLANG_BIN := $(ANDROID_BUILD_TOP)/$(LLVM_PREBUILTS_PATH)/
ABL_USE_SDLLVM := false
ifneq ($(wildcard $(SDCLANG_PATH)),)
ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
CLANG_BIN := $(SDCLANG_PATH)/
else
CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH)/
endif
ABL_USE_SDLLVM := true
endif
DISABLE_PARALLEL_DOWNLOAD_FLASH := DISABLE_PARALLEL_DOWNLOAD_FLASH=0
ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
VERIFIED_BOOT := VERIFIED_BOOT=1
else
VERIFIED_BOOT := VERIFIED_BOOT=0
endif
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=1
else
BUILD_SYSTEM_ROOT_IMAGE := BUILD_SYSTEM_ROOT_IMAGE=0
endif
ifeq ($(BOARD_AVB_ENABLE),true)
VERIFIED_BOOT_2 := VERIFIED_BOOT_2=1
else
VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
endif
ifeq ($(BOARD_LEVB_ENABLE),true)
VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=1
else
VERIFIED_BOOT_LE := VERIFIED_BOOT_LE=0
endif
ifeq ($(TARGET_BUILD_VARIANT),user)
USER_BUILD_VARIANT := USER_BUILD_VARIANT=1
else
USER_BUILD_VARIANT := USER_BUILD_VARIANT=0
endif
ifneq ($(TARGET_BOOTLOADER_BOARD_NAME),)
BOARD_BOOTLOADER_PRODUCT_NAME := $(TARGET_BOOTLOADER_BOARD_NAME)
else
BOARD_BOOTLOADER_PRODUCT_NAME := QC_Reference_Phone
endif
ifeq ($(BOARD_ABL_SAFESTACK_DISABLE),true)
ABL_SAFESTACK := false
else
ABL_SAFESTACK := true
endif
SAFESTACK_SUPPORTED_CLANG_VERSION = 6.0
# For most platform, abl needed always be built
# in aarch64 arthitecture to run.
# Specify BOOTLOADER_ARCH if needed to built with
# other ARCHs.
ifeq ($(BOOTLOADER_ARCH),)
BOOTLOADER_ARCH := AARCH64
endif
TARGET_ARCHITECTURE := $(BOOTLOADER_ARCH)
ifeq ($(TARGET_ARCHITECTURE),arm)
CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin/arm-linux-androideabi-
CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
else
CLANG35_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android-
CLANG35_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
endif
# ABL ELF output
TARGET_ABL := $(PRODUCT_OUT)/abl.elf
TARGET_EMMC_BOOTLOADER := $(TARGET_ABL)
ABL_OUT := $(TARGET_OUT_INTERMEDIATES)/ABL_OBJ
abl_clean:
$(hide) rm -f $(TARGET_ABL)
$(ABL_OUT):
mkdir -p $(ABL_OUT)
# Top level target
$(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
$(MAKE) -C bootable/bootloader/edk2 \
BOOTLOADER_OUT=../../../$(ABL_OUT) \
all \
$(BUILD_SYSTEM_ROOT_IMAGE) \
$(VERIFIED_BOOT) \
$(VERIFIED_BOOT_2) \
$(VERIFIED_BOOT_LE) \
$(USER_BUILD_VARIANT) \
$(DISABLE_PARALLEL_DOWNLOAD_FLASH) \
CLANG_BIN=$(CLANG_BIN) \
CLANG_PREFIX=$(CLANG35_PREFIX)\
ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \
ABL_SAFESTACK=$(ABL_SAFESTACK) \
SAFESTACK_SUPPORTED_CLANG_VERSION=$(SAFESTACK_SUPPORTED_CLANG_VERSION) \
CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\
TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE) \
BOARD_BOOTLOADER_PRODUCT_NAME=$(BOARD_BOOTLOADER_PRODUCT_NAME)