-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
208 lines (173 loc) · 5.74 KB
/
makefile
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
UEFI_TOP_DIR := .
export SIGN_ABL_IMAGE := ${SIGN_ABL_IMAGE}
ifndef $(BOOTLOADER_OUT)
BOOTLOADER_OUT := $(shell pwd)
endif
export $(BOOTLOADER_OUT)
BUILDDIR=$(shell pwd)
export MAKEPATH := $(MAKEPATH)
export CLANG35_BIN := $(CLANG_BIN)
export FUSE_LD := $(CLANG35_BIN)/ld.lld
export EXTRA_GCC_ARG :=
export CLANG35_GCC_TOOLCHAIN := $(CLANG35_GCC_TOOLCHAIN)
export $(BOARD_BOOTLOADER_PRODUCT_NAME)
export ARCHITECTURE := AARCH64
export CLANG35_AARCH64_PREFIX := $(CLANG_PREFIX)
ABL_OUT := $(BOOTLOADER_OUT)/Build
WORKSPACE=$(BUILDDIR)
TARGET_TOOLS := CLANG35
TARGET := DEBUG
BUILD_ROOT := $(ABL_OUT)/$(TARGET)_$(TARGET_TOOLS)
EDK_TOOLS := $(BUILDDIR)/BaseTools
EDK_TOOLS_BIN := $(EDK_TOOLS)/Source/C/bin
ABL_FV_IMG := $(BUILD_ROOT)/FV/abl.fv
ABL_FV_ELF := $(BOOTLOADER_OUT)/../../unsigned_abl.elf
SHELL:=/bin/bash
EDK_TOOLS_SRC_FILE := $(shell find $(EDK_TOOLS) -name "*" -type f)
EDK_TOOLS_PATH_MARK_FILE := $(ABL_OUT)/BaseTools_Mark
export TARGET_EDK_TOOLS_BIN := $(ABL_OUT)/Source/C/bin
define edk_tools_generate
mkdir -p $(ABL_OUT)/Scripts
cp -rf $(EDK_TOOLS)/Scripts/GccBase.lds $(ABL_OUT)/Scripts
(. ./edksetup.sh BaseTools && \
$(MAKEPATH)make -C $(EDK_TOOLS) $(PREBUILT_HOST_TOOLS) -j$(nproc))
mkdir -p $(TARGET_EDK_TOOLS_BIN)
cp -rf $(EDK_TOOLS_BIN)/* $(TARGET_EDK_TOOLS_BIN)
touch $(EDK_TOOLS_PATH_MARK_FILE)
endef
# UEFI UBSAN Configuration
UBSAN_GCC_FLAG_UNDEFINED :=
UBSAN_GCC_FLAG_ALIGNMENT :=
ifeq ($(TARGET_ARCHITECTURE), arm)
LOAD_ADDRESS := 0X8F700000
else
LOAD_ADDRESS := 0X9FA00000
endif
ifeq ($(ENABLE_LE_VARIANT), true)
ENABLE_LE_VARIANT := 1
else
ENABLE_LE_VARIANT := 0
endif
ifeq ($(DISABLE_MULTI_BOOT), true)
DISABLE_MULTI_BOOT := 1
else
DISABLE_MULTI_BOOT := 0
endif
ifeq ($(ENABLE_LV_ATOMIC_AB), 1)
ENABLE_LV_ATOMIC_AB := 1
else
ENABLE_LV_ATOMIC_AB := 0
endif
ifeq ($(EARLY_ETH_ENABLED), 1)
EARLY_ETH_ENABLED := 1
else
EARLY_ETH_ENABLED := 0
endif
ifeq ($(EARLY_ETH_AS_DLKM), 1)
EARLY_ETH_AS_DLKM := 1
else
EARLY_ETH_AS_DLKM := 0
endif
ifeq ($(TARGET_SUPPORTS_EARLY_USB_INIT), 1)
TARGET_SUPPORTS_EARLY_USB_INIT := 1
else
TARGET_SUPPORTS_EARLY_USB_INIT := 0
endif
ifeq ($(BOOTIMAGE_LOAD_VERIFY_IN_PARALLEL), 1)
BOOTIMAGE_LOAD_VERIFY_IN_PARALLEL := 1
else
BOOTIMAGE_LOAD_VERIFY_IN_PARALLEL := 0
endif
ifeq ($(INTEGRITY_LE_IMA), 1)
INTEGRITY_LE_IMA := 1
else
INTEGRITY_LE_IMA := 0
endif
ifeq ($(INTEGRITY_LE_EVM), 1)
INTEGRITY_LE_EVM := 1
else
INTEGRITY_LE_EVM := 0
endif
ifneq "$(INIT_BIN_LE)" ""
INIT_BIN := $(INIT_BIN_LE)
else
INIT_BIN := "/init"
endif
ifneq "$(TARGET_AUDIO_FRAMEWORK)" ""
TARGET_AUDIO_FRAMEWORK := $(TARGET_AUDIO_FRAMEWORK)
else
TARGET_AUDIO_FRAMEWORK := ""
endif
ifeq "$(BASE_ADDRESS)" ""
BASE_ADDRESS := 0x80000000
endif
ifeq "$(TARGET_LINUX_BOOT_CPU_SELECTION)" "true"
LINUX_BOOT_CPU_SELECTION_ENABLED := 1
else
LINUX_BOOT_CPU_SELECTION_ENABLED := 0
endif
ifeq "$(TARGET_LINUX_BOOT_CPU_ID)" ""
TARGET_LINUX_BOOT_CPU_ID := 0
endif
ifneq "$(HIBERNATION_PARTITION_NAME)" ""
HIBERNATION_SWAP_PARTITION_NAME := $(HIBERNATION_PARTITION_NAME)
endif
.PHONY: all cleanall
all: ABL_FV_ELF
cleanall:
@. ./edksetup.sh BaseTools && \
build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc -a $(ARCHITECTURE) -t $(TARGET_TOOLS) -b $(TARGET) -j build_modulepkg.log cleanall
rm -rf $(WORKSPACE)/QcomModulePkg/Bin64
rm -rf $(TARGET_EDK_TOOLS_BIN)
$(EDK_TOOLS_PATH_MARK_FILE): $(EDK_TOOLS_SRC_FILE)
@$(call edk_tools_generate)
ABL_FV_IMG: $(EDK_TOOLS_PATH_MARK_FILE)
@. ./edksetup.sh BaseTools && \
build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc \
-a $(ARCHITECTURE) \
-t $(TARGET_TOOLS) \
-b $(TARGET) \
-n 0 \
-s \
-D ABL_OUT_DIR=$(ABL_OUT) \
-D VERIFIED_BOOT_LE=$(VERIFIED_BOOT_LE) \
-D VERIFIED_BOOT_ENABLED=$(VERIFIED_BOOT_ENABLED) \
-D EARLY_ETH_ENABLED=$(EARLY_ETH_ENABLED) \
-D HIBERNATION_SUPPORT_NO_AES=$(HIBERNATION_SUPPORT_NO_AES) \
-D HIBERNATION_SUPPORT_AES=$(HIBERNATION_SUPPORT_AES) \
-D EARLY_ETH_AS_DLKM=$(EARLY_ETH_AS_DLKM) \
-D BOOTIMAGE_LOAD_VERIFY_IN_PARALLEL=$(BOOTIMAGE_LOAD_VERIFY_IN_PARALLEL) \
-D AB_RETRYCOUNT_DISABLE=$(AB_RETRYCOUNT_DISABLE) \
-D TARGET_BOARD_TYPE_AUTO=$(TARGET_BOARD_TYPE_AUTO) \
-D VERITY_LE=$(VERITY_LE) \
-D INTEGRITY_LE_IMA=$(INTEGRITY_LE_IMA) \
-D INTEGRITY_LE_EVM=$(INTEGRITY_LE_EVM) \
-D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \
-D DISABLE_PARALLEL_DOWNLOAD_FLASH=$(DISABLE_PARALLEL_DOWNLOAD_FLASH) \
-D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \
-D DISABLE_MULTI_BOOT=$(DISABLE_MULTI_BOOT) \
-D ENABLE_LV_ATOMIC_AB=$(ENABLE_LV_ATOMIC_AB) \
-D BUILD_USES_RECOVERY_AS_BOOT=$(BUILD_USES_RECOVERY_AS_BOOT) \
-D INIT_BIN=$(INIT_BIN) \
-D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) \
-D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) \
-D NAND_SQUASHFS_SUPPORT=$(NAND_SQUASHFS_SUPPORT) \
-D BASE_ADDRESS=$(BASE_ADDRESS) \
-D LINUX_BOOT_CPU_SELECTION_ENABLED=$(LINUX_BOOT_CPU_SELECTION_ENABLED) \
-D TARGET_LINUX_BOOT_CPU_ID=$(TARGET_LINUX_BOOT_CPU_ID) \
-D HIBERNATION_SWAP_PARTITION_NAME=$(HIBERNATION_SWAP_PARTITION_NAME) \
-D SUPPORT_AB_BOOT_LXC=$(SUPPORT_AB_BOOT_LXC) \
-D TARGET_SUPPORTS_EARLY_USB_INIT=$(TARGET_SUPPORTS_EARLY_USB_INIT) \
-D TARGET_AUDIO_FRAMEWORK="\"$(TARGET_AUDIO_FRAMEWORK)\"" \
-D ENABLE_EARLY_SERVICES=$(ENABLE_EARLY_SERVICES) \
-D KERNEL_LOAD_ADDRESS=$(KERNEL_LOAD_ADDRESS) \
-D KERNEL_SIZE_RESERVED=$(KERNEL_SIZE_RESERVED) \
-D DISABLE_KERNEL_PROTOCOL=$(DISABLE_KERNEL_PROTOCOL) \
-D NAND_UBI_VOLUME_FLASHING_ENABLED=$(NAND_UBI_VOLUME_FLASHING_ENABLED) \
-D CMDLINE_SHOW_SECURE_BOOT_STATUS=$(CMDLINE_SHOW_SECURE_BOOT_STATUS) \
-D UBUNTU_AB_OTA=$(UBUNTU_AB_OTA) \
-D RW_ROOTFS=$(RW_ROOTFS) \
-j build_modulepkg.log $*
cp $(BUILD_ROOT)/FV/FVMAIN_COMPACT.Fv $(ABL_FV_IMG)
ABL_FV_ELF: ABL_FV_IMG
python3 $(WORKSPACE)/QcomModulePkg/Tools/image_header.py $(ABL_FV_IMG) $(ABL_FV_ELF) $(LOAD_ADDRESS) elf 32 nohash