blob: 67e7d4cc81782e944d667eefb0cef2feb897bba2 [file] [log] [blame]
Joe Onorato6396e702012-05-31 23:21:46 -07001# Copyright (C) 2007 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080014
Joe Onorato6396e702012-05-31 23:21:46 -070015LOCAL_PATH := $(call my-dir)
Ethan Yonker58f21322018-08-24 11:17:36 -050016commands_TWRP_local_path := $(LOCAL_PATH)
Joe Onorato6396e702012-05-31 23:21:46 -070017
Ethan Yonker66bcd492018-12-20 09:03:17 -060018ifneq ($(project-path-for),)
Matt Mower66766fe2014-10-06 18:03:39 -050019 ifeq ($(LOCAL_PATH),$(call project-path-for,recovery))
20 PROJECT_PATH_AGREES := true
Andrea Mennillof591c872015-11-03 20:58:11 +010021 BOARD_SEPOLICY_DIRS += $(call project-path-for,recovery)/sepolicy
Matt Mower66766fe2014-10-06 18:03:39 -050022 endif
23else
24 ifeq ($(LOCAL_PATH),bootable/recovery)
25 PROJECT_PATH_AGREES := true
Ethan Yonker11309e92015-07-01 07:58:56 -050026 BOARD_SEPOLICY_DIRS += bootable/recovery/sepolicy
Ethan Yonkerf0a7e592019-04-04 10:06:41 -050027 else
28 ifeq ($(LOCAL_PATH),bootable/recovery-twrp)
29 ifeq ($(RECOVERY_VARIANT),twrp)
30 PROJECT_PATH_AGREES := true
31 BOARD_SEPOLICY_DIRS += bootable/recovery-twrp/sepolicy
32 endif
33 endif
Matt Mower66766fe2014-10-06 18:03:39 -050034 endif
Matt Mower55c75ca2014-08-31 11:30:15 -050035endif
36
Matt Mower66766fe2014-10-06 18:03:39 -050037ifeq ($(PROJECT_PATH_AGREES),true)
Matt Mower55c75ca2014-08-31 11:30:15 -050038
Michael Bestas0cc23762018-07-13 21:37:56 +030039ifeq ($(CM_PLATFORM_SDK_VERSION),)
40 CM_PLATFORM_SDK_VERSION := 0
41endif
42
Motorhead199175b6f662014-06-12 15:58:33 -070043include $(CLEAR_VARS)
44
Dees_Troy51a0e822012-09-05 15:24:24 -040045TARGET_RECOVERY_GUI := true
Joe Onorato6396e702012-05-31 23:21:46 -070046
bigbiffee7b7ff2020-03-23 15:08:27 -040047LOCAL_STATIC_LIBRARIES :=
48LOCAL_SHARED_LIBRARIES :=
49
bigbiff bigbiff584b9772016-12-08 21:21:17 -050050ifneq ($(TW_DEVICE_VERSION),)
51 LOCAL_CFLAGS += -DTW_DEVICE_VERSION='"-$(TW_DEVICE_VERSION)"'
52else
53 LOCAL_CFLAGS += -DTW_DEVICE_VERSION='"-0"'
54endif
dianlujitao4879b372018-12-03 18:45:47 +080055LOCAL_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
bigbiff bigbiff584b9772016-12-08 21:21:17 -050056
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080057LOCAL_SRC_FILES := \
Dees_Troy2673cec2013-04-02 20:22:16 +000058 twrp.cpp \
Ethan Yonkerb5fab762016-01-28 14:03:33 -060059 fixContexts.cpp \
bigbiff bigbiff9c754052013-01-09 09:09:08 -050060 twrpTar.cpp \
Ethan Yonker3fdcda42016-11-30 12:29:37 -060061 exclude.cpp \
Ethan Yonker1b7a31b2014-07-03 15:09:22 -050062 find_file.cpp \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -040063 infomanager.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040064 data.cpp \
bigbiff22851b92021-09-01 16:46:57 -040065 kernel_module_loader.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040066 partition.cpp \
67 partitionmanager.cpp \
Ethan Yonker472f5062016-02-25 13:47:30 -060068 progresstracking.cpp \
bigbiffdf8436b2020-08-30 16:22:34 -040069 startupArgs.cpp \
Dees_Troy812660f2012-09-20 09:55:17 -040070 twrp-functions.cpp \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -040071 twrpDigestDriver.cpp \
Dees_Troye34c1332013-02-06 19:13:00 +000072 openrecoveryscript.cpp \
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040073 tarWrite.c \
bigbiff32cbabe2020-04-12 19:16:19 -040074 twrpAdbBuFifo.cpp \
bigbiffad58e1b2020-07-06 20:24:34 -040075 twrpRepacker.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040076
bigbiff79924302021-05-02 20:06:09 -040077ifeq ($(TW_EXCLUDE_APEX),)
78 LOCAL_SRC_FILES += twrpApex.cpp
79else
80 LOCAL_CFLAGS += -DTW_EXCLUDE_APEX
81endif
82
bigbiffcfa875c2021-06-20 16:20:27 -040083LOCAL_STATIC_LIBRARIES += libavb libtwrpinstall libminadbd_services libinit libsnapshot_nobinder
84LOCAL_SHARED_LIBRARIES += libfs_mgr libhardware android.hardware.boot@1.0 android.hardware.boot@1.1 libprotobuf-cpp-lite liblp libutils libhidlbase
bigbiffad58e1b2020-07-06 20:24:34 -040085LOCAL_C_INCLUDES += \
86 system/core/fs_mgr/libfs_avb/include/ \
87 system/core/fs_mgr/include_fstab/ \
88 system/core/fs_mgr/include/ \
89 system/core/fs_mgr/libdm/include/ \
90 system/core/fs_mgr/liblp/include/ \
91 system/gsid/include/ \
92 system/core/init/ \
bigbiff1f9e4842020-10-31 11:33:15 -040093 system/extras/ext4_utils/include \
bigbiffee7b7ff2020-03-23 15:08:27 -040094
Dees_Troya58bead2012-09-27 09:49:29 -040095ifneq ($(TARGET_RECOVERY_REBOOT_SRC),)
Dees_Troy51a0e822012-09-05 15:24:24 -040096 LOCAL_SRC_FILES += $(TARGET_RECOVERY_REBOOT_SRC)
97endif
98
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080099LOCAL_MODULE := recovery
100
Doug Zongkere08991e2010-02-02 13:09:52 -0800101RECOVERY_API_VERSION := 3
Ken Sumrallf35d1ce2013-02-13 12:59:35 -0800102RECOVERY_FSTAB_VERSION := 2
Doug Zongkerfb2e3af2009-06-17 17:29:40 -0700103LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
bigbiff7ba75002020-04-11 20:47:09 -0400104LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
Tao Bao80e46e02015-06-03 10:49:29 -0700105LOCAL_CLANG := true
Doug Zongkerfb2e3af2009-06-17 17:29:40 -0700106
Dan Albert1ddd3502015-02-18 15:58:15 -0800107LOCAL_C_INCLUDES += \
bigbiffad58e1b2020-07-06 20:24:34 -0400108 bionic \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500109 system/extras \
Dan Albert1ddd3502015-02-18 15:58:15 -0800110 system/core/adb \
bigbiffd04f8e02021-09-30 18:56:42 -0400111 system/core/libmodprobe/include \
bigbiffce8f83c2015-12-12 18:30:21 -0500112 system/core/libsparse \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500113 external/zlib \
bigbiffad58e1b2020-07-06 20:24:34 -0400114 system/core/libziparchive/include \
bigbiffd58ba182020-03-23 10:02:29 -0400115 external/freetype/include \
bigbiffad58e1b2020-07-06 20:24:34 -0400116 external/boringssl/include \
117 external/libcxx/include \
118 external/libselinux/include \
bigbiffd81833a2021-01-17 11:06:57 -0500119 external/libpng \
120 $(LOCAL_PATH)/gui/include \
bigbiffd58ba182020-03-23 10:02:29 -0400121 $(LOCAL_PATH)/recovery_ui/include \
122 $(LOCAL_PATH)/otautil/include \
bigbiffad58e1b2020-07-06 20:24:34 -0400123 $(LOCAL_PATH)/install/include \
124 $(LOCAL_PATH)/fuse_sideload/include \
125 $(LOCAL_PATH)/install/include \
bigbiff673c7ae2020-12-02 19:44:56 -0500126 $(LOCAL_PATH)/twrpinstall/include \
bigbiff91bd7a72021-01-03 17:33:01 -0500127 $(LOCAL_PATH)/recovery_utils/include \
bigbiffd81833a2021-01-17 11:06:57 -0500128 $(LOCAL_PATH)/libpixelflinger/include \
129 $(LOCAL_PATH)/minuitwrp/include \
130 $(LOCAL_PATH)/twinstall/include
Dees_Troy51a0e822012-09-05 15:24:24 -0400131
bigbiffe6d833a2021-10-17 13:54:43 -0400132LOCAL_STATIC_LIBRARIES += libguitwrp libmodprobe
bigbiff673c7ae2020-12-02 19:44:56 -0500133LOCAL_SHARED_LIBRARIES += libz libc libcutils libstdc++ libtar libblkid libminuitwrp libmtdutils libtwadbbu
134LOCAL_SHARED_LIBRARIES += libbootloader_message libcrecovery libtwrpdigest libc++ libaosprecovery libcrypto libbase
bigbiff91bd7a72021-01-03 17:33:01 -0500135LOCAL_SHARED_LIBRARIES += libziparchive libselinux libdl_android.bootstrap
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500136
Dees_Troy4546fe72013-01-10 14:33:27 +0000137ifneq ($(wildcard system/core/libsparse/Android.mk),)
138LOCAL_SHARED_LIBRARIES += libsparse
139endif
140
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500141ifeq ($(TW_OEM_BUILD),true)
142 LOCAL_CFLAGS += -DTW_OEM_BUILD
143 BOARD_HAS_NO_REAL_SDCARD := true
144 TW_USE_TOOLBOX := true
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400145 TW_EXCLUDE_MTP := true
Captain Throwback6443cef2021-01-30 12:26:25 -0500146 TW_EXCLUDE_TZDATA := true
nebrassy50789652021-02-12 23:36:44 +0100147 TW_EXCLUDE_NANO := true
DarthJabba9fba0cee2021-02-20 17:13:09 -0500148 TW_EXCLUDE_BASH := true
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500149endif
Yabin Cui99281df2016-02-17 12:21:52 -0800150
Elliott Hughes01fcbe12016-05-23 17:43:41 -0700151ifeq ($(AB_OTA_UPDATER),true)
152 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
bigbiffe2eae2f2021-03-07 18:47:06 -0500153 TWRP_REQUIRED_MODULES += libhardware android.hardware.boot@1.0-service android.hardware.boot@1.0-service.rc \
154 android.hardware.boot@1.1-service android.hardware.boot@1.1-service.rc android.hardware.boot@1.1.xml
Elliott Hughes01fcbe12016-05-23 17:43:41 -0700155endif
156
bigbiffee7b7ff2020-03-23 15:08:27 -0400157ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
158 LOCAL_CFLAGS += -DPRODUCT_USE_DYNAMIC_PARTITIONS=1
nebrassy9c1709b2021-04-18 23:31:36 +0200159 TWRP_REQUIRED_MODULES += android.hardware.health@2.1-service android.hardware.health@2.1-impl.recovery android.hardware.health@2.1-service.rc android.hardware.health@2.1.xml
bigbiff22851b92021-09-01 16:46:57 -0400160 TWRP_REQUIRED_MODULES += android.hardware.health@2.0-service android.hardware.health@2.0-impl.recovery android.hardware.health@2.0-service.rc
bigbiff5c083cc2021-06-10 19:55:18 -0400161 ifeq ($(TW_EXCLUDE_LPDUMP),)
162 TWRP_REQUIRED_MODULES += lpdump lpdumpd.rc
163 endif
Captain Throwback4f19caa2021-11-18 20:30:38 -0500164 ifeq ($(TW_EXCLUDE_LPTOOLS),)
165 TWRP_REQUIRED_MODULES += lptools
166 endif
bigbiffee7b7ff2020-03-23 15:08:27 -0400167endif
168
Captain Throwbacka1852522021-12-31 21:35:52 -0500169ifneq ($(TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS),)
170 LOCAL_CFLAGS += -DTW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS='"$(TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS)"'
171endif
172
Mohd Faraz9a4ef262020-10-18 23:58:21 +0530173ifeq ($(TW_USES_VENDOR_LIBS),true)
174 LOCAL_CFLAGS += -DUSE_VENDOR_LIBS=1
175endif
176
bigbiff32cbabe2020-04-12 19:16:19 -0400177ifeq ($(TW_NO_BIND_SYSTEM),true)
178 LOCAL_CFLAGS += -DTW_NO_BIND_SYSTEM
179endif
180
bigbiffad58e1b2020-07-06 20:24:34 -0400181LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/bin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800182
Ethan Yonker93382822018-11-01 15:25:31 -0500183ifeq ($(TARGET_RECOVERY_TWRP_LIB),)
184 LOCAL_SRC_FILES += BasePartition.cpp
185else
186 LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_TWRP_LIB)
187endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800188
Doug Zongkercc8cd3f2010-09-20 12:16:13 -0700189LOCAL_C_INCLUDES += system/extras/ext4_utils
190
that0e2140e2016-08-10 21:04:26 +0200191tw_git_revision := $(shell git -C $(LOCAL_PATH) rev-parse --short=8 HEAD 2>/dev/null)
192ifeq ($(shell git -C $(LOCAL_PATH) diff --quiet; echo $$?),1)
193 tw_git_revision := $(tw_git_revision)-dirty
194endif
195LOCAL_CFLAGS += -DTW_GIT_REVISION='"$(tw_git_revision)"'
196
mauronofriobabc15e2020-03-16 14:59:39 +0000197ifeq ($(TW_FORCE_USE_BUSYBOX), true)
198 TW_USE_TOOLBOX := false
199else
200 TW_USE_TOOLBOX := true
201endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500202ifeq ($(TW_EXCLUDE_MTP),)
203 LOCAL_SHARED_LIBRARIES += libtwrpmtp-ffs
204endif
Captain Throwbackbc2cfa32021-09-16 10:04:26 -0400205ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
206 LOCAL_CFLAGS += -DBOARD_USES_RECOVERY_AS_BOOT
207endif
208ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE), true)
209 LOCAL_CFLAGS += -DBOARD_BUILD_SYSTEM_ROOT_IMAGE
210endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500211
Dees_Troy51a0e822012-09-05 15:24:24 -0400212#TWRP Build Flags
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400213ifeq ($(TW_EXCLUDE_MTP),)
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400214 LOCAL_CFLAGS += -DTW_HAS_MTP
215endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -0700216ifneq ($(TW_NO_SCREEN_TIMEOUT),)
217 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
218endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400219ifeq ($(BOARD_HAS_NO_REAL_SDCARD), true)
220 LOCAL_CFLAGS += -DBOARD_HAS_NO_REAL_SDCARD
221endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400222ifneq ($(RECOVERY_SDCARD_ON_DATA),)
223 LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
224endif
225ifneq ($(TW_INCLUDE_DUMLOCK),)
226 LOCAL_CFLAGS += -DTW_INCLUDE_DUMLOCK
227endif
228ifneq ($(TW_INTERNAL_STORAGE_PATH),)
229 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_PATH=$(TW_INTERNAL_STORAGE_PATH)
230endif
231ifneq ($(TW_INTERNAL_STORAGE_MOUNT_POINT),)
232 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_MOUNT_POINT=$(TW_INTERNAL_STORAGE_MOUNT_POINT)
233endif
234ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
235 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
236endif
237ifneq ($(TW_EXTERNAL_STORAGE_MOUNT_POINT),)
238 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_MOUNT_POINT=$(TW_EXTERNAL_STORAGE_MOUNT_POINT)
239endif
ChampionSwimmercf33e4d2013-02-03 13:59:22 +0530240ifeq ($(TW_HAS_NO_BOOT_PARTITION), true)
241 LOCAL_CFLAGS += -DTW_HAS_NO_BOOT_PARTITION
242endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400243ifeq ($(TW_NO_REBOOT_BOOTLOADER), true)
244 LOCAL_CFLAGS += -DTW_NO_REBOOT_BOOTLOADER
245endif
246ifeq ($(TW_NO_REBOOT_RECOVERY), true)
247 LOCAL_CFLAGS += -DTW_NO_REBOOT_RECOVERY
248endif
249ifeq ($(TW_NO_BATT_PERCENT), true)
250 LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
251endif
Jenkins1710bf22014-10-02 20:22:21 -0400252ifeq ($(TW_NO_CPU_TEMP), true)
253 LOCAL_CFLAGS += -DTW_NO_CPU_TEMP
254endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400255ifneq ($(TW_CUSTOM_POWER_BUTTON),)
256 LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
257endif
258ifeq ($(TW_ALWAYS_RMRF), true)
259 LOCAL_CFLAGS += -DTW_ALWAYS_RMRF
260endif
261ifeq ($(TW_NEVER_UNMOUNT_SYSTEM), true)
262 LOCAL_CFLAGS += -DTW_NEVER_UNMOUNT_SYSTEM
263endif
264ifeq ($(TW_NO_USB_STORAGE), true)
265 LOCAL_CFLAGS += -DTW_NO_USB_STORAGE
266endif
267ifeq ($(TW_INCLUDE_INJECTTWRP), true)
268 LOCAL_CFLAGS += -DTW_INCLUDE_INJECTTWRP
269endif
270ifeq ($(TW_INCLUDE_BLOBPACK), true)
271 LOCAL_CFLAGS += -DTW_INCLUDE_BLOBPACK
272endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400273ifneq ($(TARGET_USE_CUSTOM_LUN_FILE_PATH),)
274 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(TARGET_USE_CUSTOM_LUN_FILE_PATH)\"
275endif
276ifneq ($(BOARD_UMS_LUNFILE),)
277 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(BOARD_UMS_LUNFILE)\"
278endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400279ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
280 LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
281endif
mauronofrioe9a49ef2018-10-03 13:38:16 +0200282ifeq ($(TW_HAS_EDL_MODE), true)
283 LOCAL_CFLAGS += -DTW_HAS_EDL_MODE
284endif
bigbiff bigbiff87940362013-03-09 09:58:50 -0500285ifeq ($(TW_NO_SCREEN_BLANK), true)
286 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
287endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400288ifeq ($(TW_SDEXT_NO_EXT4), true)
289 LOCAL_CFLAGS += -DTW_SDEXT_NO_EXT4
290endif
Dees_Troyfdf5fcc2012-09-11 10:27:01 -0400291ifeq ($(TW_FORCE_CPUINFO_FOR_DEVICE_ID), true)
292 LOCAL_CFLAGS += -DTW_FORCE_CPUINFO_FOR_DEVICE_ID
293endif
Dees_Troy3f5c4e82013-02-01 15:16:59 +0000294ifeq ($(TW_NO_EXFAT_FUSE), true)
295 LOCAL_CFLAGS += -DTW_NO_EXFAT_FUSE
296endif
bigbiff bigbiff3ed778a2019-03-12 19:28:31 -0400297ifeq ($(TW_NO_HAPTICS), true)
298 LOCAL_CFLAGS += -DTW_NO_HAPTICS
299endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400300ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
Ethan Yonker253368a2014-11-25 15:00:52 -0600301 TW_INCLUDE_CRYPTO := true
Dees_Troy51a0e822012-09-05 15:24:24 -0400302endif
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600303ifeq ($(TW_INCLUDE_L_CRYPTO), true)
Ethan Yonker253368a2014-11-25 15:00:52 -0600304 TW_INCLUDE_CRYPTO := true
305endif
bigbiff79924302021-05-02 20:06:09 -0400306ifneq ($(TW_ADDITIONAL_APEX_FILES),)
307 LOCAL_CFLAGS += -DTW_ADDITIONAL_APEX_FILES=$(TW_ADDITIONAL_APEX_FILES)
308endif
bigbiff22851b92021-09-01 16:46:57 -0400309ifneq ($(TW_LOAD_VENDOR_MODULES),)
310 LOCAL_CFLAGS += -DTW_LOAD_VENDOR_MODULES=$(TW_LOAD_VENDOR_MODULES)
311endif
Ethan Yonker253368a2014-11-25 15:00:52 -0600312ifeq ($(TW_INCLUDE_CRYPTO), true)
Captain Throwbackddb0a402020-11-01 12:52:21 -0500313 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO -DUSE_FSCRYPT -Wno-macro-redefined
bigbiffa957f072021-03-07 18:20:29 -0500314 LOCAL_SHARED_LIBRARIES += libcryptfsfde
315 LOCAL_SHARED_LIBRARIES += libgpt_twrp libstatssocket.recovery
316 LOCAL_C_INCLUDES += external/boringssl/src/include bootable/recovery/crypto
317 LOCAL_C_INCLUDES += $(commands_TWRP_local_path)/crypto/fscrypt
bigbiffad58e1b2020-07-06 20:24:34 -0400318 TW_INCLUDE_CRYPTO_FBE := true
319 LOCAL_CFLAGS += -DTW_INCLUDE_FBE
320 LOCAL_SHARED_LIBRARIES += libtwrpfscrypt android.frameworks.stats@1.0 android.hardware.authsecret@1.0 \
321 android.hardware.oemlock@1.0
322 LOCAL_CFLAGS += -DTW_INCLUDE_FBE_METADATA_DECRYPT
nkk7171c6c502017-01-05 23:55:05 +0200323 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),)
324 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),false)
bigbiffad58e1b2020-07-06 20:24:34 -0400325 TW_INCLUDE_LIBRESETPROP := true
nkk7171c6c502017-01-05 23:55:05 +0200326 LOCAL_CFLAGS += -DTW_CRYPTO_USE_SYSTEM_VOLD
327 LOCAL_STATIC_LIBRARIES += libvolddecrypt
328 endif
329 endif
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600330endif
D. Andrei Măceșb29a5e22016-12-22 06:19:44 -0500331WITH_CRYPTO_UTILS := \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500332 $(if $(wildcard system/core/libcrypto_utils/android_pubkey.c),true)
Anatoly Smaznov10c11f62013-02-12 13:33:40 +0700333ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true)
334 LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
335endif
lambdadroidfc0b16d2017-08-04 17:16:53 +0200336ifeq ($(TW_USE_SERIALNO_PROPERTY_FOR_DEVICE_ID), true)
337 LOCAL_CFLAGS += -DTW_USE_SERIALNO_PROPERTY_FOR_DEVICE_ID
338endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600339ifneq ($(TW_BRIGHTNESS_PATH),)
340 LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=$(TW_BRIGHTNESS_PATH)
341endif
xNUTxe85f02d2014-07-18 01:30:58 +0200342ifneq ($(TW_SECONDARY_BRIGHTNESS_PATH),)
343 LOCAL_CFLAGS += -DTW_SECONDARY_BRIGHTNESS_PATH=$(TW_SECONDARY_BRIGHTNESS_PATH)
344endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600345ifneq ($(TW_MAX_BRIGHTNESS),)
346 LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
347endif
Greg Wallace36ade452015-11-08 13:54:25 -0500348ifneq ($(TW_DEFAULT_BRIGHTNESS),)
349 LOCAL_CFLAGS += -DTW_DEFAULT_BRIGHTNESS=$(TW_DEFAULT_BRIGHTNESS)
350endif
Dees_Troyf33b4902013-03-01 00:51:39 +0000351ifneq ($(TW_CUSTOM_BATTERY_PATH),)
352 LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
353endif
Jenkins1710bf22014-10-02 20:22:21 -0400354ifneq ($(TW_CUSTOM_CPU_TEMP_PATH),)
355 LOCAL_CFLAGS += -DTW_CUSTOM_CPU_TEMP_PATH=$(TW_CUSTOM_CPU_TEMP_PATH)
356endif
bigbiffe3742ef2021-08-15 17:24:58 -0400357ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS),)
Dees_Troy83bd4832013-05-04 12:39:56 +0000358 LOCAL_SHARED_LIBRARIES += libopenaes
359else
360 LOCAL_CFLAGS += -DTW_EXCLUDE_ENCRYPTED_BACKUPS
361endif
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100362ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),)
Michael Bestas4a185582017-04-28 15:45:26 +0300363 ifneq ($(filter msm8226 msm8x26 msm8610 msm8974 msm8x74 msm8084 msm8x84 apq8084 msm8909 msm8916 msm8992 msm8994 msm8952 msm8996 msm8937 msm8953 msm8998,$(TARGET_BOARD_PLATFORM)),)
364 LOCAL_CFLAGS += -DQCOM_RTC_FIX
365 else ifeq ($(TARGET_CPU_VARIANT),krait)
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100366 LOCAL_CFLAGS += -DQCOM_RTC_FIX
367 endif
368else ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),true)
369 LOCAL_CFLAGS += -DQCOM_RTC_FIX
370endif
Matt Mower6883d732014-03-20 17:28:13 -0500371ifneq ($(TW_NO_LEGACY_PROPS),)
372 LOCAL_CFLAGS += -DTW_NO_LEGACY_PROPS
373endif
Dees Troy4159aed2014-02-28 17:24:43 +0000374ifneq ($(wildcard bionic/libc/include/sys/capability.h),)
375 LOCAL_CFLAGS += -DHAVE_CAPABILITIES
376endif
Matt Mowerec009e82015-01-30 13:00:49 -0600377ifneq ($(TARGET_RECOVERY_INITRC),)
378 TW_EXCLUDE_DEFAULT_USB_INIT := true
379endif
bigbiffad58e1b2020-07-06 20:24:34 -0400380LOCAL_CFLAGS += -DTW_USE_NEW_MINADBD
Ethan Yonker74db1572015-10-28 12:44:49 -0500381ifneq ($(TW_DEFAULT_LANGUAGE),)
382 LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=$(TW_DEFAULT_LANGUAGE)
383else
384 LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=en
385endif
Captain Throwback550a1992022-01-19 13:25:54 -0500386ifneq ($(TW_QCOM_ATS_OFFSET),)
387 LOCAL_CFLAGS += -DTW_QCOM_ATS_OFFSET=$(TW_QCOM_ATS_OFFSET)
388endif
Phoenix591e444d112018-02-03 07:23:54 +0000389ifneq ($(TW_CLOCK_OFFSET),)
390 LOCAL_CFLAGS += -DTW_CLOCK_OFFSET=$(TW_CLOCK_OFFSET)
391endif
Chaosmaster461e39f2020-02-07 01:48:13 +0100392ifneq ($(TW_OVERRIDE_SYSTEM_PROPS),)
393 TW_INCLUDE_LIBRESETPROP := true
394 LOCAL_CFLAGS += -DTW_OVERRIDE_SYSTEM_PROPS=$(TW_OVERRIDE_SYSTEM_PROPS)
395endif
396ifneq ($(TW_INCLUDE_LIBRESETPROP),)
bigbiffad58e1b2020-07-06 20:24:34 -0400397 LOCAL_SHARED_LIBRARIES += libresetprop
398 LOCAL_C_INCLUDES += external/magisk-prebuilt/include
399 LOCAL_CFLAGS += -DTW_INCLUDE_LIBRESETPROP
Chaosmaster461e39f2020-02-07 01:48:13 +0100400endif
Captain Throwback16dd81b2021-02-12 19:32:36 -0500401ifeq ($(TW_EXCLUDE_NANO), true)
402 LOCAL_CFLAGS += -DTW_EXCLUDE_NANO
403endif
Chaosmaster461e39f2020-02-07 01:48:13 +0100404
bigbiffa957f072021-03-07 18:20:29 -0500405LOCAL_C_INCLUDES += system/vold \
406
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500407TWRP_REQUIRED_MODULES += \
bigbiffad58e1b2020-07-06 20:24:34 -0400408 relink_libraries \
409 relink_binaries \
bigbiff7ba75002020-04-11 20:47:09 -0400410 twrp_ramdisk \
bigbiffc5012c52021-07-04 13:57:47 -0400411 bc \
Matt Mower031163b2014-11-01 15:13:03 -0500412 dump_image \
413 erase_image \
414 flash_image \
Matt Mower031163b2014-11-01 15:13:03 -0500415 mke2fs.conf \
Matt Mower031163b2014-11-01 15:13:03 -0500416 pigz \
417 teamwin \
Matt Mower031163b2014-11-01 15:13:03 -0500418 twrp \
Matt Mower18794c82015-11-11 16:22:45 -0600419 fsck.fat \
420 fatlabel \
421 mkfs.fat \
HashBanged974bb2016-01-30 14:20:09 -0500422 permissive.sh \
Ethan Yonkerf1179622016-08-25 15:32:21 -0500423 simg2img_twrp \
bigbiffdf8436b2020-08-30 16:22:34 -0400424 libbootloader_message \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500425 init.recovery.hlthchrg.rc \
bigbiff973167a2020-04-06 15:44:20 -0400426 init.recovery.service.rc \
427 init.recovery.ldconfig.rc \
bigbiff7ba75002020-04-11 20:47:09 -0400428 awk \
bigbiffad58e1b2020-07-06 20:24:34 -0400429 toybox \
430 toolbox \
bigbiffdf8436b2020-08-30 16:22:34 -0400431 mkshrc_twrp \
Mohammad Afaneh3150f1e2020-10-16 00:45:03 +0300432 plat_hwservice_contexts \
bigbiff1f9e4842020-10-31 11:33:15 -0400433 vendor_hwservice_contexts \
bigbiff7ed51062020-12-02 13:18:20 -0500434 minadbd \
bigbiff91bd7a72021-01-03 17:33:01 -0500435 twrpbu \
bigbiff98203ce2021-03-03 20:39:52 -0500436 adbd_system_api_recovery \
Captain Throwback7f398f72020-12-30 21:46:17 -0500437 me.twrp.twrpapp.apk \
bigbiffd81833a2021-01-17 11:06:57 -0500438 privapp-permissions-twrpapp.xml \
439 adbd_system_api_recovery \
bigbiffe6d833a2021-10-17 13:54:43 -0400440 libsync.recovery \
441 libmodprobe
bigbiff7ba75002020-04-11 20:47:09 -0400442
Captain Throwback6443cef2021-01-30 12:26:25 -0500443ifneq ($(TW_EXCLUDE_TZDATA), true)
444TWRP_REQUIRED_MODULES += \
445 tzdata_twrp
446endif
447
nebrassy50789652021-02-12 23:36:44 +0100448ifneq ($(TW_EXCLUDE_NANO), true)
449TWRP_REQUIRED_MODULES += \
450 nano_twrp \
451 nano.rc
452endif
453
DarthJabba9fba0cee2021-02-20 17:13:09 -0500454ifneq ($(TW_EXCLUDE_BASH), true)
455 ifneq ($(wildcard external/bash/.),)
456 TWRP_REQUIRED_MODULES += \
457 bash_twrp
458 endif
459endif
460
nebrassy05b54052021-02-24 19:02:42 +0100461ifeq ($(TW_INCLUDE_REPACKTOOLS), true)
462TWRP_REQUIRED_MODULES += \
463 magiskboot
464endif
465
466ifeq ($(TW_INCLUDE_RESETPROP), true)
467TWRP_REQUIRED_MODULES += \
468 resetprop
469endif
nebrassy50789652021-02-12 23:36:44 +0100470
bigbiff7ba75002020-04-11 20:47:09 -0400471TWRP_REQUIRED_MODULES += \
Captain Throwbackddb0a402020-11-01 12:52:21 -0500472 hwservicemanager \
473 hwservicemanager.rc \
bigbiff7ba75002020-04-11 20:47:09 -0400474 vndservicemanager \
Mohd Faraz29cab7f2021-04-17 11:35:09 +0200475 vndservicemanager.rc
476
477ifneq ($(TW_INCLUDE_CRYPTO),)
478TWRP_REQUIRED_MODULES += \
bigbiff7ba75002020-04-11 20:47:09 -0400479 vold_prepare_subdirs \
bigbiffad58e1b2020-07-06 20:24:34 -0400480 task_recovery_profiles.json \
bigbiff7ba75002020-04-11 20:47:09 -0400481 fscryptpolicyget
Captain Throwbackddb0a402020-11-01 12:52:21 -0500482 ifneq ($(TW_INCLUDE_CRYPTO_FBE),)
483 TWRP_REQUIRED_MODULES += \
484 plat_service_contexts \
485 servicemanager \
486 servicemanager.rc
487 endif
bigbiff7ba75002020-04-11 20:47:09 -0400488endif
Matt Mower031163b2014-11-01 15:13:03 -0500489
bigbiff416fe3a2020-03-28 13:46:48 -0400490ifneq ($(wildcard external/zip/Android.mk),)
491 TWRP_REQUIRED_MODULES += zip
492endif
493ifneq ($(wildcard external/unzip/Android.mk),)
494 TWRP_REQUIRED_MODULES += unzip
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600495endif
Matt Mower84057612017-01-08 13:32:18 -0600496
Matt Mower20172792014-11-14 10:54:03 -0600497ifneq ($(TW_NO_EXFAT), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500498 TWRP_REQUIRED_MODULES += mkexfatfs fsckexfat
Ethan Yonker34741d92016-02-06 13:22:45 -0600499 ifneq ($(TW_NO_EXFAT_FUSE), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500500 TWRP_REQUIRED_MODULES += exfat-fuse
Ethan Yonker34741d92016-02-06 13:22:45 -0600501 endif
Matt Mower20172792014-11-14 10:54:03 -0600502endif
Matt Mower031163b2014-11-01 15:13:03 -0500503ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
bigbiffad58e1b2020-07-06 20:24:34 -0400504 TWRP_REQUIRED_MODULES += sgdisk
Matt Mower031163b2014-11-01 15:13:03 -0500505endif
506ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500507 TWRP_REQUIRED_MODULES += openaes openaes_license
Matt Mower031163b2014-11-01 15:13:03 -0500508endif
509ifeq ($(TW_INCLUDE_DUMLOCK), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500510 TWRP_REQUIRED_MODULES += \
Matt Mower031163b2014-11-01 15:13:03 -0500511 htcdumlock htcdumlocksys flash_imagesys dump_imagesys libbmlutils.so \
512 libflashutils.so libmmcutils.so libmtdutils.so HTCDumlock.apk
513endif
Matt Mower031163b2014-11-01 15:13:03 -0500514ifeq ($(TW_INCLUDE_FB2PNG), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500515 TWRP_REQUIRED_MODULES += fb2png
Matt Mower031163b2014-11-01 15:13:03 -0500516endif
517ifneq ($(TW_OEM_BUILD),true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500518 TWRP_REQUIRED_MODULES += orscmd
Matt Mower031163b2014-11-01 15:13:03 -0500519endif
520ifeq ($(BOARD_USES_BML_OVER_MTD),true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500521 TWRP_REQUIRED_MODULES += bml_over_mtd
Matt Mower031163b2014-11-01 15:13:03 -0500522endif
523ifeq ($(TW_INCLUDE_INJECTTWRP), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500524 TWRP_REQUIRED_MODULES += injecttwrp
Matt Mower031163b2014-11-01 15:13:03 -0500525endif
Matt Mowerec009e82015-01-30 13:00:49 -0600526ifneq ($(TW_EXCLUDE_DEFAULT_USB_INIT), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500527 TWRP_REQUIRED_MODULES += init.recovery.usb.rc
Matt Mowerec009e82015-01-30 13:00:49 -0600528endif
Captain Throwback1f127752016-01-19 17:30:20 -0500529ifeq ($(TWRP_INCLUDE_LOGCAT), true)
bigbiffad58e1b2020-07-06 20:24:34 -0400530 TWRP_REQUIRED_MODULES += logcat event-log-tags
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600531 ifeq ($(TARGET_USES_LOGD), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500532 TWRP_REQUIRED_MODULES += logd libsysutils libnl init.recovery.logd.rc
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600533 endif
Captain Throwback1f127752016-01-19 17:30:20 -0500534endif
Matt Mower031163b2014-11-01 15:13:03 -0500535# Allow devices to specify device-specific recovery dependencies
536ifneq ($(TARGET_RECOVERY_DEVICE_MODULES),)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500537 TWRP_REQUIRED_MODULES += $(TARGET_RECOVERY_DEVICE_MODULES)
Matt Mower031163b2014-11-01 15:13:03 -0500538endif
Ethan Yonkerb81d9052015-07-09 13:20:53 -0500539ifeq ($(TW_INCLUDE_NTFS_3G),true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500540 TWRP_REQUIRED_MODULES += \
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500541 mount.ntfs \
542 fsck.ntfs \
543 mkfs.ntfs
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500544endif
Matt Mower58294912015-12-10 11:54:28 -0600545ifeq ($(TARGET_USERIMAGES_USE_F2FS), true)
bigbiffd58ba182020-03-23 10:02:29 -0400546 TWRP_REQUIRED_MODULES += sload.f2fs \
547 libfs_mgr \
548 fs_mgr \
549 libinit
Ethan Yonker93382822018-11-01 15:25:31 -0500550endif
bigbiffad58e1b2020-07-06 20:24:34 -0400551
552TWRP_REQUIRED_MODULES += file_contexts_text
553
554ifeq ($(BOARD_CACHEIMAGE_PARTITION_SIZE),)
555 TWRP_REQUIRED_MODULES += recovery-persist recovery-refresh
Matt Mower58294912015-12-10 11:54:28 -0600556endif
Matt Mower031163b2014-11-01 15:13:03 -0500557
bigbiffad58e1b2020-07-06 20:24:34 -0400558LOCAL_REQUIRED_MODULES += $(TWRP_REQUIRED_MODULES)
Mark Salyzyn13aca592016-03-09 14:58:16 -0800559
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800560include $(BUILD_EXECUTABLE)
561
Matt Mowerd821c962017-02-15 12:36:18 -0600562# Symlink for file_contexts
563include $(CLEAR_VARS)
564
Captain Throwback3184b2f2017-03-07 12:07:40 -0500565LOCAL_MODULE := file_contexts_text
Matt Mowerd821c962017-02-15 12:36:18 -0600566LOCAL_MODULE_TAGS := optional
bigbiffad58e1b2020-07-06 20:24:34 -0400567LOCAL_REQUIRED_MODULES := file_contexts.bin
568
Matt Mowerd821c962017-02-15 12:36:18 -0600569LOCAL_POST_INSTALL_CMD := \
Ethan Yonker58f21322018-08-24 11:17:36 -0500570 $(hide) cp -f $(PRODUCT_OUT)/obj/ETC/file_contexts.bin_intermediates/file_contexts.concat.tmp $(TARGET_RECOVERY_ROOT_OUT)/file_contexts
Matt Mowerd821c962017-02-15 12:36:18 -0600571
bigbiff416fe3a2020-03-28 13:46:48 -0400572include $(BUILD_PHONY_PACKAGE)
Dees_Troyc04dcf72012-10-02 10:46:37 -0400573
Mark Salyzyn13aca592016-03-09 14:58:16 -0800574# recovery-persist (system partition dynamic executable run after /data mounts)
575# ===============================
bigbiffad58e1b2020-07-06 20:24:34 -0400576include $(CLEAR_VARS)
577LOCAL_SRC_FILES := \
578 recovery-persist.cpp
579LOCAL_MODULE := recovery-persist
bigbiff673c7ae2020-12-02 19:44:56 -0500580LOCAL_SHARED_LIBRARIES := liblog libbase
581LOCAL_STATIC_LIBRARIES := libotautil librecovery_utils
bigbiffad58e1b2020-07-06 20:24:34 -0400582LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
bigbiff673c7ae2020-12-02 19:44:56 -0500583LOCAL_C_INCLUDES += system/core/libstats/include
584LOCAL_C_INCLUDES += $(LOCAL_PATH)/recovery_utils/include
bigbiffad58e1b2020-07-06 20:24:34 -0400585LOCAL_CFLAGS := -Werror
586LOCAL_INIT_RC := recovery-persist.rc
587include $(BUILD_EXECUTABLE)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800588
Mark Salyzyn13aca592016-03-09 14:58:16 -0800589# recovery-refresh (system partition dynamic executable run at init)
590# ===============================
bigbiffad58e1b2020-07-06 20:24:34 -0400591include $(CLEAR_VARS)
592LOCAL_SRC_FILES := \
593 recovery-refresh.cpp
594LOCAL_MODULE := recovery-refresh
595LOCAL_SHARED_LIBRARIES := liblog libbase
bigbiff673c7ae2020-12-02 19:44:56 -0500596LOCAL_STATIC_LIBRARIES := libotautil librecovery_utils
bigbiffad58e1b2020-07-06 20:24:34 -0400597LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
bigbiff673c7ae2020-12-02 19:44:56 -0500598LOCAL_C_INCLUDES += $(LOCAL_PATH)/recovery_utils/include
bigbiffad58e1b2020-07-06 20:24:34 -0400599LOCAL_CFLAGS := -Werror
600LOCAL_INIT_RC := recovery-refresh.rc
601include $(BUILD_EXECUTABLE)
Tao Bao42c45e22018-07-31 09:37:12 -0700602
Elliott Hughes63a31922016-06-09 17:41:22 -0700603# libmounts (static library)
604# ===============================
605include $(CLEAR_VARS)
606LOCAL_SRC_FILES := mounts.cpp
Tao Bao5f85d1f2017-03-28 21:12:36 -0700607LOCAL_CFLAGS := \
608 -Wall \
609 -Werror
Elliott Hughes63a31922016-06-09 17:41:22 -0700610LOCAL_MODULE := libmounts
Tao Bao5f85d1f2017-03-28 21:12:36 -0700611LOCAL_STATIC_LIBRARIES := libbase
Elliott Hughes63a31922016-06-09 17:41:22 -0700612include $(BUILD_STATIC_LIBRARY)
613
Tao Bao62e0bc72017-04-10 16:55:57 -0700614# librecovery (static library)
615# ===============================
616include $(CLEAR_VARS)
617LOCAL_SRC_FILES := \
618 install.cpp
Tao Baob24510c2017-04-20 17:54:27 -0700619LOCAL_CFLAGS := -Wall -Werror
Tao Bao62e0bc72017-04-10 16:55:57 -0700620LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
Tao Bao25dbe172017-04-12 23:52:20 -0700621
622ifeq ($(AB_OTA_UPDATER),true)
623 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
624endif
625
Tao Bao62e0bc72017-04-10 16:55:57 -0700626LOCAL_MODULE := librecovery
627LOCAL_STATIC_LIBRARIES := \
628 libminui \
Tao Baocfe53c22017-10-03 14:37:21 -0700629 libotautil \
bigbiff7ba75002020-04-11 20:47:09 -0400630 libvintf \
Tao Bao62e0bc72017-04-10 16:55:57 -0700631 libcrypto_utils \
632 libcrypto \
Elliott Hughese1bb7a52017-06-28 08:00:17 -0700633 libbase \
634 libziparchive \
Tao Bao62e0bc72017-04-10 16:55:57 -0700635
636include $(BUILD_STATIC_LIBRARY)
637
Dees_Troy51a0e822012-09-05 15:24:24 -0400638commands_recovery_local_path := $(LOCAL_PATH)
Ethan Yonkerecbd3e82017-12-14 14:43:59 -0600639
Yabin Cui2f272c02016-06-24 18:22:02 -0700640include \
bigbiffdf8436b2020-08-30 16:22:34 -0400641 $(commands_TWRP_local_path)/updater/Android.mk
Ethan Yonker58f21322018-08-24 11:17:36 -0500642
bigbiff7ed51062020-12-02 13:18:20 -0500643include $(commands_TWRP_local_path)/mtp/ffs/Android.mk \
bigbiffad58e1b2020-07-06 20:24:34 -0400644 $(commands_TWRP_local_path)/minui/Android.mk
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500645
Dees_Troy51a0e822012-09-05 15:24:24 -0400646#includes for TWRP
Ethan Yonker58f21322018-08-24 11:17:36 -0500647include $(commands_TWRP_local_path)/injecttwrp/Android.mk \
648 $(commands_TWRP_local_path)/htcdumlock/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500649 $(commands_TWRP_local_path)/mmcutils/Android.mk \
650 $(commands_TWRP_local_path)/bmlutils/Android.mk \
651 $(commands_TWRP_local_path)/prebuilt/Android.mk \
652 $(commands_TWRP_local_path)/mtdutils/Android.mk \
653 $(commands_TWRP_local_path)/flashutils/Android.mk \
654 $(commands_TWRP_local_path)/pigz/Android.mk \
655 $(commands_TWRP_local_path)/libtar/Android.mk \
656 $(commands_TWRP_local_path)/libcrecovery/Android.mk \
657 $(commands_TWRP_local_path)/libblkid/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500658 $(commands_TWRP_local_path)/openaes/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500659 $(commands_TWRP_local_path)/twrpTarMain/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500660 $(commands_TWRP_local_path)/minzip/Android.mk \
661 $(commands_TWRP_local_path)/dosfstools/Android.mk \
662 $(commands_TWRP_local_path)/etc/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500663 $(commands_TWRP_local_path)/simg2img/Android.mk \
664 $(commands_TWRP_local_path)/adbbu/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500665 $(commands_TWRP_local_path)/twrpDigest/Android.mk \
666 $(commands_TWRP_local_path)/attr/Android.mk
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600667
mauronofrio6d3bf892019-10-26 19:47:55 +0200668ifneq ($(TW_OZIP_DECRYPT_KEY),)
669 TWRP_REQUIRED_MODULES += ozip_decrypt
670 include $(commands_TWRP_local_path)/ozip_decrypt/Android.mk
671endif
672
Ethan Yonker253368a2014-11-25 15:00:52 -0600673ifeq ($(TW_INCLUDE_CRYPTO), true)
bigbiffa957f072021-03-07 18:20:29 -0500674 include $(commands_TWRP_local_path)/crypto/fde/Android.mk
Ethan Yonker58f21322018-08-24 11:17:36 -0500675 include $(commands_TWRP_local_path)/crypto/scrypt/Android.mk
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600676 ifeq ($(TW_INCLUDE_CRYPTO_FBE), true)
bigbiffad58e1b2020-07-06 20:24:34 -0400677 include $(commands_TWRP_local_path)/crypto/fscrypt/Android.mk
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600678 endif
nkk7171c6c502017-01-05 23:55:05 +0200679 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),)
680 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),false)
Ethan Yonker58f21322018-08-24 11:17:36 -0500681 include $(commands_TWRP_local_path)/crypto/vold_decrypt/Android.mk
nkk7171c6c502017-01-05 23:55:05 +0200682 endif
683 endif
Ethan Yonker58f21322018-08-24 11:17:36 -0500684 include $(commands_TWRP_local_path)/gpt/Android.mk
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600685endif
Vojtech Bocek7cc278b2013-02-24 01:40:19 +0100686ifeq ($(BUILD_ID), GINGERBREAD)
687 TW_NO_EXFAT := true
688endif
Dees_Troyb05ddee2013-01-28 20:24:50 +0000689ifneq ($(TW_NO_EXFAT), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500690 include $(commands_TWRP_local_path)/exfat/mkfs/Android.mk \
691 $(commands_TWRP_local_path)/exfat/fsck/Android.mk \
692 $(commands_TWRP_local_path)/fuse/Android.mk \
693 $(commands_TWRP_local_path)/exfat/libexfat/Android.mk
Ethan Yonker34741d92016-02-06 13:22:45 -0600694 ifneq ($(TW_NO_EXFAT_FUSE), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500695 include $(commands_TWRP_local_path)/exfat/fuse/Android.mk
Ethan Yonker34741d92016-02-06 13:22:45 -0600696 endif
Captain Throwback6a1acf22014-09-18 12:46:35 -0400697endif
Ethan Yonker03a42f62014-08-08 11:03:51 -0500698ifneq ($(TW_OEM_BUILD),true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500699 include $(commands_TWRP_local_path)/orscmd/Android.mk
Ethan Yonker03a42f62014-08-08 11:03:51 -0500700endif
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500701
Talustus3019a912013-04-06 11:50:07 +0200702# FB2PNG
703ifeq ($(TW_INCLUDE_FB2PNG), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500704 include $(commands_TWRP_local_path)/fb2png/Android.mk
Talustus3019a912013-04-06 11:50:07 +0200705endif
Matt Mower55c75ca2014-08-31 11:30:15 -0500706
Matt Mower55c75ca2014-08-31 11:30:15 -0500707endif
Ethan Yonker58f21322018-08-24 11:17:36 -0500708
709commands_TWRP_local_path :=