blob: fe10883dbcbb336e1186e5408d9443849032ca2d [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
bigbiff7df87472022-09-24 16:45:03 -040021 BOARD_VENDOR_SEPOLICY_DIRS += $(call project-path-for,recovery)/sepolicy
Matt Mower66766fe2014-10-06 18:03:39 -050022 endif
23else
bigbiff7df87472022-09-24 16:45:03 -040024 $(warning BOARD_VENDOR_SEPOLICY_DIRS: $(LOCAL_PATH))
Matt Mower66766fe2014-10-06 18:03:39 -050025 ifeq ($(LOCAL_PATH),bootable/recovery)
26 PROJECT_PATH_AGREES := true
bigbiff7df87472022-09-24 16:45:03 -040027 BOARD_VENDOR_SEPOLICY_DIRS += bootable/recovery/sepolicy
28 $(warning BOARD_VENDOR_SEPOLICY_DIRS2: $(BOARD_VENDOR_SEPOLICY_DIRS))
Ethan Yonkerf0a7e592019-04-04 10:06:41 -050029 else
30 ifeq ($(LOCAL_PATH),bootable/recovery-twrp)
31 ifeq ($(RECOVERY_VARIANT),twrp)
32 PROJECT_PATH_AGREES := true
bigbiff7df87472022-09-24 16:45:03 -040033 BOARD_VENDOR_SEPOLICY_DIRS += bootable/recovery-twrp/sepolicy
Ethan Yonkerf0a7e592019-04-04 10:06:41 -050034 endif
35 endif
Matt Mower66766fe2014-10-06 18:03:39 -050036 endif
Matt Mower55c75ca2014-08-31 11:30:15 -050037endif
38
Matt Mower66766fe2014-10-06 18:03:39 -050039ifeq ($(PROJECT_PATH_AGREES),true)
Matt Mower55c75ca2014-08-31 11:30:15 -050040
Michael Bestas0cc23762018-07-13 21:37:56 +030041ifeq ($(CM_PLATFORM_SDK_VERSION),)
42 CM_PLATFORM_SDK_VERSION := 0
43endif
44
Motorhead199175b6f662014-06-12 15:58:33 -070045include $(CLEAR_VARS)
46
Dees_Troy51a0e822012-09-05 15:24:24 -040047TARGET_RECOVERY_GUI := true
Joe Onorato6396e702012-05-31 23:21:46 -070048
bigbiffee7b7ff2020-03-23 15:08:27 -040049LOCAL_STATIC_LIBRARIES :=
50LOCAL_SHARED_LIBRARIES :=
51
bigbiff bigbiff584b9772016-12-08 21:21:17 -050052ifneq ($(TW_DEVICE_VERSION),)
53 LOCAL_CFLAGS += -DTW_DEVICE_VERSION='"-$(TW_DEVICE_VERSION)"'
54else
55 LOCAL_CFLAGS += -DTW_DEVICE_VERSION='"-0"'
56endif
dianlujitao4879b372018-12-03 18:45:47 +080057LOCAL_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
bigbiff bigbiff584b9772016-12-08 21:21:17 -050058
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080059LOCAL_SRC_FILES := \
Dees_Troy2673cec2013-04-02 20:22:16 +000060 twrp.cpp \
Ethan Yonkerb5fab762016-01-28 14:03:33 -060061 fixContexts.cpp \
bigbiff bigbiff9c754052013-01-09 09:09:08 -050062 twrpTar.cpp \
Ethan Yonker3fdcda42016-11-30 12:29:37 -060063 exclude.cpp \
Ethan Yonker1b7a31b2014-07-03 15:09:22 -050064 find_file.cpp \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -040065 infomanager.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040066 data.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040067 partition.cpp \
68 partitionmanager.cpp \
Ethan Yonker472f5062016-02-25 13:47:30 -060069 progresstracking.cpp \
bigbiffdf8436b2020-08-30 16:22:34 -040070 startupArgs.cpp \
Dees_Troy812660f2012-09-20 09:55:17 -040071 twrp-functions.cpp \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -040072 twrpDigestDriver.cpp \
Dees_Troye34c1332013-02-06 19:13:00 +000073 openrecoveryscript.cpp \
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040074 tarWrite.c \
bigbiff32cbabe2020-04-12 19:16:19 -040075 twrpAdbBuFifo.cpp \
bigbiffad58e1b2020-07-06 20:24:34 -040076 twrpRepacker.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040077
bigbiff79924302021-05-02 20:06:09 -040078ifeq ($(TW_EXCLUDE_APEX),)
79 LOCAL_SRC_FILES += twrpApex.cpp
80else
81 LOCAL_CFLAGS += -DTW_EXCLUDE_APEX
82endif
83
nebrassy335d07e2021-11-14 21:09:31 +010084LOCAL_STATIC_LIBRARIES += libavb libtwrpinstall libminadbd_services libinit libsnapshot_nobinder update_metadata-protos
tnakamur217c05e2022-05-13 08:57:04 +090085LOCAL_SHARED_LIBRARIES += libfs_mgr libhardware android.hardware.boot@1.0 android.hardware.boot@1.1 android.hardware.boot@1.2 libprotobuf-cpp-lite liblp libutils libhidlbase
bigbiffad58e1b2020-07-06 20:24:34 -040086LOCAL_C_INCLUDES += \
87 system/core/fs_mgr/libfs_avb/include/ \
88 system/core/fs_mgr/include_fstab/ \
89 system/core/fs_mgr/include/ \
90 system/core/fs_mgr/libdm/include/ \
91 system/core/fs_mgr/liblp/include/ \
92 system/gsid/include/ \
93 system/core/init/ \
bigbiff1f9e4842020-10-31 11:33:15 -040094 system/extras/ext4_utils/include \
bigbiffdf53b6c2022-01-17 19:31:52 -050095 system/vold
bigbiffee7b7ff2020-03-23 15:08:27 -040096
Dees_Troya58bead2012-09-27 09:49:29 -040097ifneq ($(TARGET_RECOVERY_REBOOT_SRC),)
Dees_Troy51a0e822012-09-05 15:24:24 -040098 LOCAL_SRC_FILES += $(TARGET_RECOVERY_REBOOT_SRC)
99endif
100
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800101LOCAL_MODULE := recovery
102
Doug Zongkere08991e2010-02-02 13:09:52 -0800103RECOVERY_API_VERSION := 3
Ken Sumrallf35d1ce2013-02-13 12:59:35 -0800104RECOVERY_FSTAB_VERSION := 2
Doug Zongkerfb2e3af2009-06-17 17:29:40 -0700105LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
bigbiff7ba75002020-04-11 20:47:09 -0400106LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
Tao Bao80e46e02015-06-03 10:49:29 -0700107LOCAL_CLANG := true
Doug Zongkerfb2e3af2009-06-17 17:29:40 -0700108
Dan Albert1ddd3502015-02-18 15:58:15 -0800109LOCAL_C_INCLUDES += \
bigbiffad58e1b2020-07-06 20:24:34 -0400110 bionic \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500111 system/extras \
nebrassy204e36e2021-11-14 23:27:51 +0100112 packages/modules/adb \
bigbiffce8f83c2015-12-12 18:30:21 -0500113 system/core/libsparse \
bigbiffdf53b6c2022-01-17 19:31:52 -0500114 system/vold \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500115 external/zlib \
nebrassy204e36e2021-11-14 23:27:51 +0100116 system/libziparchive/include \
bigbiffd58ba182020-03-23 10:02:29 -0400117 external/freetype/include \
bigbiffad58e1b2020-07-06 20:24:34 -0400118 external/boringssl/include \
119 external/libcxx/include \
120 external/libselinux/include \
bigbiffd81833a2021-01-17 11:06:57 -0500121 external/libpng \
122 $(LOCAL_PATH)/gui/include \
bigbiffd58ba182020-03-23 10:02:29 -0400123 $(LOCAL_PATH)/recovery_ui/include \
124 $(LOCAL_PATH)/otautil/include \
bigbiffad58e1b2020-07-06 20:24:34 -0400125 $(LOCAL_PATH)/install/include \
126 $(LOCAL_PATH)/fuse_sideload/include \
127 $(LOCAL_PATH)/install/include \
bigbiff673c7ae2020-12-02 19:44:56 -0500128 $(LOCAL_PATH)/twrpinstall/include \
bigbiff91bd7a72021-01-03 17:33:01 -0500129 $(LOCAL_PATH)/recovery_utils/include \
bigbiffd81833a2021-01-17 11:06:57 -0500130 $(LOCAL_PATH)/libpixelflinger/include \
131 $(LOCAL_PATH)/minuitwrp/include \
132 $(LOCAL_PATH)/twinstall/include
Dees_Troy51a0e822012-09-05 15:24:24 -0400133
bigbiffdf53b6c2022-01-17 19:31:52 -0500134LOCAL_STATIC_LIBRARIES += libguitwrp libvold
bigbiff673c7ae2020-12-02 19:44:56 -0500135LOCAL_SHARED_LIBRARIES += libz libc libcutils libstdc++ libtar libblkid libminuitwrp libmtdutils libtwadbbu
136LOCAL_SHARED_LIBRARIES += libbootloader_message libcrecovery libtwrpdigest libc++ libaosprecovery libcrypto libbase
bigbiff91bd7a72021-01-03 17:33:01 -0500137LOCAL_SHARED_LIBRARIES += libziparchive libselinux libdl_android.bootstrap
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500138
Dees_Troy4546fe72013-01-10 14:33:27 +0000139ifneq ($(wildcard system/core/libsparse/Android.mk),)
140LOCAL_SHARED_LIBRARIES += libsparse
141endif
142
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500143ifeq ($(TW_OEM_BUILD),true)
144 LOCAL_CFLAGS += -DTW_OEM_BUILD
145 BOARD_HAS_NO_REAL_SDCARD := true
146 TW_USE_TOOLBOX := true
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400147 TW_EXCLUDE_MTP := true
Captain Throwback6443cef2021-01-30 12:26:25 -0500148 TW_EXCLUDE_TZDATA := true
nebrassy50789652021-02-12 23:36:44 +0100149 TW_EXCLUDE_NANO := true
DarthJabba9fba0cee2021-02-20 17:13:09 -0500150 TW_EXCLUDE_BASH := true
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500151endif
Yabin Cui99281df2016-02-17 12:21:52 -0800152
Elliott Hughes01fcbe12016-05-23 17:43:41 -0700153ifeq ($(AB_OTA_UPDATER),true)
154 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
bigbiffe2eae2f2021-03-07 18:47:06 -0500155 TWRP_REQUIRED_MODULES += libhardware android.hardware.boot@1.0-service android.hardware.boot@1.0-service.rc \
tnakamur217c05e2022-05-13 08:57:04 +0900156 android.hardware.boot@1.1-service android.hardware.boot@1.1-service.rc android.hardware.boot@1.1.xml \
157 android.hardware.boot@1.2-service android.hardware.boot@1.2-service.rc android.hardware.boot@1.2.xml
Elliott Hughes01fcbe12016-05-23 17:43:41 -0700158endif
159
bigbiffee7b7ff2020-03-23 15:08:27 -0400160ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
161 LOCAL_CFLAGS += -DPRODUCT_USE_DYNAMIC_PARTITIONS=1
nebrassy9c1709b2021-04-18 23:31:36 +0200162 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 -0400163 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 -0400164 ifeq ($(TW_EXCLUDE_LPDUMP),)
165 TWRP_REQUIRED_MODULES += lpdump lpdumpd.rc
166 endif
Captain Throwbackd15051e2021-11-18 20:30:38 -0500167 ifeq ($(TW_EXCLUDE_LPTOOLS),)
168 TWRP_REQUIRED_MODULES += lptools
169 endif
bigbiffee7b7ff2020-03-23 15:08:27 -0400170endif
171
Captain Throwback2b9ea722021-12-31 21:35:52 -0500172ifneq ($(TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS),)
173 LOCAL_CFLAGS += -DTW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS='"$(TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS)"'
174endif
175
Mohd Faraz9a4ef262020-10-18 23:58:21 +0530176ifeq ($(TW_USES_VENDOR_LIBS),true)
177 LOCAL_CFLAGS += -DUSE_VENDOR_LIBS=1
178endif
179
bigbiff32cbabe2020-04-12 19:16:19 -0400180ifeq ($(TW_NO_BIND_SYSTEM),true)
181 LOCAL_CFLAGS += -DTW_NO_BIND_SYSTEM
182endif
183
Captain Throwback02647a92023-01-11 13:46:30 -0500184ifeq ($(TW_NO_FLASH_CURRENT_TWRP),true)
185 LOCAL_CFLAGS += -DTW_NO_FLASH_CURRENT_TWRP
186endif
187
Darth9bf426652023-02-05 23:41:03 +0000188ifeq ($(TW_PREPARE_DATA_MEDIA_EARLY),true)
189 LOCAL_CFLAGS += -DTW_PREPARE_DATA_MEDIA_EARLY
190endif
191
bigbiffad58e1b2020-07-06 20:24:34 -0400192LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/bin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800193
Ethan Yonker93382822018-11-01 15:25:31 -0500194ifeq ($(TARGET_RECOVERY_TWRP_LIB),)
195 LOCAL_SRC_FILES += BasePartition.cpp
196else
197 LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_TWRP_LIB)
198endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800199
Doug Zongkercc8cd3f2010-09-20 12:16:13 -0700200LOCAL_C_INCLUDES += system/extras/ext4_utils
201
that0e2140e2016-08-10 21:04:26 +0200202tw_git_revision := $(shell git -C $(LOCAL_PATH) rev-parse --short=8 HEAD 2>/dev/null)
203ifeq ($(shell git -C $(LOCAL_PATH) diff --quiet; echo $$?),1)
204 tw_git_revision := $(tw_git_revision)-dirty
205endif
206LOCAL_CFLAGS += -DTW_GIT_REVISION='"$(tw_git_revision)"'
207
mauronofriobabc15e2020-03-16 14:59:39 +0000208ifeq ($(TW_FORCE_USE_BUSYBOX), true)
209 TW_USE_TOOLBOX := false
210else
211 TW_USE_TOOLBOX := true
212endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500213ifeq ($(TW_EXCLUDE_MTP),)
214 LOCAL_SHARED_LIBRARIES += libtwrpmtp-ffs
215endif
Captain Throwbackbc2cfa32021-09-16 10:04:26 -0400216ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
217 LOCAL_CFLAGS += -DBOARD_USES_RECOVERY_AS_BOOT
218endif
219ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE), true)
220 LOCAL_CFLAGS += -DBOARD_BUILD_SYSTEM_ROOT_IMAGE
221endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500222
Dees_Troy51a0e822012-09-05 15:24:24 -0400223#TWRP Build Flags
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400224ifeq ($(TW_EXCLUDE_MTP),)
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400225 LOCAL_CFLAGS += -DTW_HAS_MTP
226endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -0700227ifneq ($(TW_NO_SCREEN_TIMEOUT),)
228 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
229endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400230ifeq ($(BOARD_HAS_NO_REAL_SDCARD), true)
231 LOCAL_CFLAGS += -DBOARD_HAS_NO_REAL_SDCARD
232endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400233ifneq ($(RECOVERY_SDCARD_ON_DATA),)
234 LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
235endif
236ifneq ($(TW_INCLUDE_DUMLOCK),)
237 LOCAL_CFLAGS += -DTW_INCLUDE_DUMLOCK
238endif
239ifneq ($(TW_INTERNAL_STORAGE_PATH),)
240 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_PATH=$(TW_INTERNAL_STORAGE_PATH)
241endif
242ifneq ($(TW_INTERNAL_STORAGE_MOUNT_POINT),)
243 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_MOUNT_POINT=$(TW_INTERNAL_STORAGE_MOUNT_POINT)
244endif
245ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
246 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
247endif
248ifneq ($(TW_EXTERNAL_STORAGE_MOUNT_POINT),)
249 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_MOUNT_POINT=$(TW_EXTERNAL_STORAGE_MOUNT_POINT)
250endif
ChampionSwimmercf33e4d2013-02-03 13:59:22 +0530251ifeq ($(TW_HAS_NO_BOOT_PARTITION), true)
252 LOCAL_CFLAGS += -DTW_HAS_NO_BOOT_PARTITION
253endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400254ifeq ($(TW_NO_REBOOT_BOOTLOADER), true)
255 LOCAL_CFLAGS += -DTW_NO_REBOOT_BOOTLOADER
256endif
257ifeq ($(TW_NO_REBOOT_RECOVERY), true)
258 LOCAL_CFLAGS += -DTW_NO_REBOOT_RECOVERY
259endif
260ifeq ($(TW_NO_BATT_PERCENT), true)
261 LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
262endif
Jenkins1710bf22014-10-02 20:22:21 -0400263ifeq ($(TW_NO_CPU_TEMP), true)
264 LOCAL_CFLAGS += -DTW_NO_CPU_TEMP
265endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400266ifneq ($(TW_CUSTOM_POWER_BUTTON),)
267 LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
268endif
269ifeq ($(TW_ALWAYS_RMRF), true)
270 LOCAL_CFLAGS += -DTW_ALWAYS_RMRF
271endif
272ifeq ($(TW_NEVER_UNMOUNT_SYSTEM), true)
273 LOCAL_CFLAGS += -DTW_NEVER_UNMOUNT_SYSTEM
274endif
275ifeq ($(TW_NO_USB_STORAGE), true)
276 LOCAL_CFLAGS += -DTW_NO_USB_STORAGE
277endif
278ifeq ($(TW_INCLUDE_INJECTTWRP), true)
279 LOCAL_CFLAGS += -DTW_INCLUDE_INJECTTWRP
280endif
281ifeq ($(TW_INCLUDE_BLOBPACK), true)
282 LOCAL_CFLAGS += -DTW_INCLUDE_BLOBPACK
283endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400284ifneq ($(TARGET_USE_CUSTOM_LUN_FILE_PATH),)
285 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(TARGET_USE_CUSTOM_LUN_FILE_PATH)\"
286endif
287ifneq ($(BOARD_UMS_LUNFILE),)
288 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(BOARD_UMS_LUNFILE)\"
289endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400290ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
291 LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
292endif
mauronofrioe9a49ef2018-10-03 13:38:16 +0200293ifeq ($(TW_HAS_EDL_MODE), true)
294 LOCAL_CFLAGS += -DTW_HAS_EDL_MODE
295endif
bigbiff bigbiff87940362013-03-09 09:58:50 -0500296ifeq ($(TW_NO_SCREEN_BLANK), true)
297 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
298endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400299ifeq ($(TW_SDEXT_NO_EXT4), true)
300 LOCAL_CFLAGS += -DTW_SDEXT_NO_EXT4
301endif
Dees_Troyfdf5fcc2012-09-11 10:27:01 -0400302ifeq ($(TW_FORCE_CPUINFO_FOR_DEVICE_ID), true)
303 LOCAL_CFLAGS += -DTW_FORCE_CPUINFO_FOR_DEVICE_ID
304endif
Dees_Troy3f5c4e82013-02-01 15:16:59 +0000305ifeq ($(TW_NO_EXFAT_FUSE), true)
306 LOCAL_CFLAGS += -DTW_NO_EXFAT_FUSE
307endif
bigbiff bigbiff3ed778a2019-03-12 19:28:31 -0400308ifeq ($(TW_NO_HAPTICS), true)
309 LOCAL_CFLAGS += -DTW_NO_HAPTICS
310endif
bigbiff79924302021-05-02 20:06:09 -0400311ifneq ($(TW_ADDITIONAL_APEX_FILES),)
312 LOCAL_CFLAGS += -DTW_ADDITIONAL_APEX_FILES=$(TW_ADDITIONAL_APEX_FILES)
313endif
bigbiff22851b92021-09-01 16:46:57 -0400314ifneq ($(TW_LOAD_VENDOR_MODULES),)
Captain Throwback00f0dcd2022-04-14 20:13:10 -0400315 LOCAL_SRC_FILES += kernel_module_loader.cpp
316 LOCAL_C_INCLUDES += system/core/libmodprobe/include
317 LOCAL_STATIC_LIBRARIES += libmodprobe
bigbiff22851b92021-09-01 16:46:57 -0400318 LOCAL_CFLAGS += -DTW_LOAD_VENDOR_MODULES=$(TW_LOAD_VENDOR_MODULES)
319endif
Ethan Yonker253368a2014-11-25 15:00:52 -0600320ifeq ($(TW_INCLUDE_CRYPTO), true)
Captain Throwbackddb0a402020-11-01 12:52:21 -0500321 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO -DUSE_FSCRYPT -Wno-macro-redefined
bigbiffdf53b6c2022-01-17 19:31:52 -0500322 LOCAL_SHARED_LIBRARIES += libgpt_twrp
bigbiffa957f072021-03-07 18:20:29 -0500323 LOCAL_C_INCLUDES += external/boringssl/src/include bootable/recovery/crypto
bigbiffad58e1b2020-07-06 20:24:34 -0400324 TW_INCLUDE_CRYPTO_FBE := true
325 LOCAL_CFLAGS += -DTW_INCLUDE_FBE
bigbiffdf53b6c2022-01-17 19:31:52 -0500326 LOCAL_SHARED_LIBRARIES += android.frameworks.stats@1.0 android.hardware.authsecret@1.0 \
bigbiff7df87472022-09-24 16:45:03 -0400327 android.security.authorization-ndk \
bigbiffdf53b6c2022-01-17 19:31:52 -0500328 android.hardware.oemlock@1.0 libf2fs_sparseblock libbinder libbinder_ndk \
329 libandroidicu.recovery \
330 android.hardware.gatekeeper@1.0 \
331 android.hardware.weaver@1.0 \
332 android.frameworks.stats@1.0 \
bigbiff7df87472022-09-24 16:45:03 -0400333 android.security.maintenance-ndk \
334 android.system.keystore2-V1-ndk \
bigbiffdf53b6c2022-01-17 19:31:52 -0500335 libkeyutils \
336 liblog \
337 libsqlite.recovery \
338 libkeystoreinfo.recovery \
339 libgatekeeper_aidl
340
341 LOCAL_STATIC_LIBRARIES += libkeymint_support
342
bigbiffad58e1b2020-07-06 20:24:34 -0400343 LOCAL_CFLAGS += -DTW_INCLUDE_FBE_METADATA_DECRYPT
me-cafebabe757105f2022-06-09 16:32:22 +0800344
345 ifeq ($(TARGET_HW_DISK_ENCRYPTION),true)
346 ifeq ($(TARGET_CRYPTFS_HW_PATH),)
347 LOCAL_C_INCLUDES += device/qcom/common/cryptfs_hw
348 else
349 LOCAL_C_INCLUDES += $(TARGET_CRYPTFS_HW_PATH)
350 endif
351 LOCAL_SHARED_LIBRARIES += libcryptfs_hw
352 endif
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600353endif
D. Andrei Măceșb29a5e22016-12-22 06:19:44 -0500354WITH_CRYPTO_UTILS := \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500355 $(if $(wildcard system/core/libcrypto_utils/android_pubkey.c),true)
Anatoly Smaznov10c11f62013-02-12 13:33:40 +0700356ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true)
357 LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
358endif
lambdadroidfc0b16d2017-08-04 17:16:53 +0200359ifeq ($(TW_USE_SERIALNO_PROPERTY_FOR_DEVICE_ID), true)
360 LOCAL_CFLAGS += -DTW_USE_SERIALNO_PROPERTY_FOR_DEVICE_ID
361endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600362ifneq ($(TW_BRIGHTNESS_PATH),)
363 LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=$(TW_BRIGHTNESS_PATH)
364endif
xNUTxe85f02d2014-07-18 01:30:58 +0200365ifneq ($(TW_SECONDARY_BRIGHTNESS_PATH),)
366 LOCAL_CFLAGS += -DTW_SECONDARY_BRIGHTNESS_PATH=$(TW_SECONDARY_BRIGHTNESS_PATH)
367endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600368ifneq ($(TW_MAX_BRIGHTNESS),)
369 LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
370endif
Greg Wallace36ade452015-11-08 13:54:25 -0500371ifneq ($(TW_DEFAULT_BRIGHTNESS),)
372 LOCAL_CFLAGS += -DTW_DEFAULT_BRIGHTNESS=$(TW_DEFAULT_BRIGHTNESS)
373endif
Dees_Troyf33b4902013-03-01 00:51:39 +0000374ifneq ($(TW_CUSTOM_BATTERY_PATH),)
375 LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
376endif
sekaiacg997ff732022-06-24 11:04:49 +0800377ifneq ($(TW_BATTERY_SYSFS_WAIT_SECONDS),)
378 LOCAL_CFLAGS += -DTW_BATTERY_SYSFS_WAIT_SECONDS=$(TW_BATTERY_SYSFS_WAIT_SECONDS)
379else
380 LOCAL_CFLAGS += -DTW_BATTERY_SYSFS_WAIT_SECONDS=3
381endif
Jenkins1710bf22014-10-02 20:22:21 -0400382ifneq ($(TW_CUSTOM_CPU_TEMP_PATH),)
383 LOCAL_CFLAGS += -DTW_CUSTOM_CPU_TEMP_PATH=$(TW_CUSTOM_CPU_TEMP_PATH)
384endif
bigbiffe3742ef2021-08-15 17:24:58 -0400385ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS),)
Dees_Troy83bd4832013-05-04 12:39:56 +0000386 LOCAL_SHARED_LIBRARIES += libopenaes
387else
388 LOCAL_CFLAGS += -DTW_EXCLUDE_ENCRYPTED_BACKUPS
389endif
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100390ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),)
Michael Bestas4a185582017-04-28 15:45:26 +0300391 ifneq ($(filter msm8226 msm8x26 msm8610 msm8974 msm8x74 msm8084 msm8x84 apq8084 msm8909 msm8916 msm8992 msm8994 msm8952 msm8996 msm8937 msm8953 msm8998,$(TARGET_BOARD_PLATFORM)),)
392 LOCAL_CFLAGS += -DQCOM_RTC_FIX
393 else ifeq ($(TARGET_CPU_VARIANT),krait)
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100394 LOCAL_CFLAGS += -DQCOM_RTC_FIX
395 endif
396else ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),true)
397 LOCAL_CFLAGS += -DQCOM_RTC_FIX
398endif
Matt Mower6883d732014-03-20 17:28:13 -0500399ifneq ($(TW_NO_LEGACY_PROPS),)
400 LOCAL_CFLAGS += -DTW_NO_LEGACY_PROPS
401endif
Dees Troy4159aed2014-02-28 17:24:43 +0000402ifneq ($(wildcard bionic/libc/include/sys/capability.h),)
403 LOCAL_CFLAGS += -DHAVE_CAPABILITIES
404endif
Matt Mowerec009e82015-01-30 13:00:49 -0600405ifneq ($(TARGET_RECOVERY_INITRC),)
406 TW_EXCLUDE_DEFAULT_USB_INIT := true
407endif
bigbiffad58e1b2020-07-06 20:24:34 -0400408LOCAL_CFLAGS += -DTW_USE_NEW_MINADBD
Ethan Yonker74db1572015-10-28 12:44:49 -0500409ifneq ($(TW_DEFAULT_LANGUAGE),)
410 LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=$(TW_DEFAULT_LANGUAGE)
411else
412 LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=en
413endif
Captain Throwbackf74fc052022-01-19 13:25:54 -0500414ifneq ($(TW_QCOM_ATS_OFFSET),)
415 LOCAL_CFLAGS += -DTW_QCOM_ATS_OFFSET=$(TW_QCOM_ATS_OFFSET)
416endif
Phoenix591e444d112018-02-03 07:23:54 +0000417ifneq ($(TW_CLOCK_OFFSET),)
418 LOCAL_CFLAGS += -DTW_CLOCK_OFFSET=$(TW_CLOCK_OFFSET)
419endif
Chaosmaster461e39f2020-02-07 01:48:13 +0100420ifneq ($(TW_OVERRIDE_SYSTEM_PROPS),)
421 TW_INCLUDE_LIBRESETPROP := true
422 LOCAL_CFLAGS += -DTW_OVERRIDE_SYSTEM_PROPS=$(TW_OVERRIDE_SYSTEM_PROPS)
423endif
Captain Throwback1483a8e2022-01-03 09:52:06 -0500424ifneq ($(TW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS),)
425 LOCAL_CFLAGS += -DTW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS='"$(TW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS)"'
426endif
Chaosmaster461e39f2020-02-07 01:48:13 +0100427ifneq ($(TW_INCLUDE_LIBRESETPROP),)
bigbiffad58e1b2020-07-06 20:24:34 -0400428 LOCAL_SHARED_LIBRARIES += libresetprop
429 LOCAL_C_INCLUDES += external/magisk-prebuilt/include
430 LOCAL_CFLAGS += -DTW_INCLUDE_LIBRESETPROP
Chaosmaster461e39f2020-02-07 01:48:13 +0100431endif
Captain Throwback16dd81b2021-02-12 19:32:36 -0500432ifeq ($(TW_EXCLUDE_NANO), true)
433 LOCAL_CFLAGS += -DTW_EXCLUDE_NANO
434endif
DarthJabba97cd3abb2021-11-28 01:09:44 +0530435ifneq ($(TARGET_OTA_ASSERT_DEVICE),)
436 LOCAL_CFLAGS += -DTARGET_OTA_ASSERT_DEVICE='"$(TARGET_OTA_ASSERT_DEVICE)"'
437endif
Darth9cc683e72022-08-09 12:54:40 +0100438ifneq ($(TW_BACKUP_EXCLUSIONS),)
439 LOCAL_CFLAGS += -DTW_BACKUP_EXCLUSIONS='"$(TW_BACKUP_EXCLUSIONS)"'
440endif
me-cafebabe97be4322022-08-14 05:57:16 +0800441ifeq ($(TW_INCLUDE_FASTBOOTD), true)
442 LOCAL_CFLAGS += -DTW_INCLUDE_FASTBOOTD
443endif
Chaosmaster461e39f2020-02-07 01:48:13 +0100444
bigbiffa957f072021-03-07 18:20:29 -0500445LOCAL_C_INCLUDES += system/vold \
446
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500447TWRP_REQUIRED_MODULES += \
bigbiffad58e1b2020-07-06 20:24:34 -0400448 relink_libraries \
449 relink_binaries \
bigbiff4740bca2022-07-18 15:55:03 -0400450 relink_vendor_hw_binaries \
bigbiff7ba75002020-04-11 20:47:09 -0400451 twrp_ramdisk \
bigbiffc5012c52021-07-04 13:57:47 -0400452 bc \
Matt Mower031163b2014-11-01 15:13:03 -0500453 dump_image \
454 erase_image \
455 flash_image \
Matt Mower031163b2014-11-01 15:13:03 -0500456 mke2fs.conf \
Matt Mower031163b2014-11-01 15:13:03 -0500457 pigz \
458 teamwin \
Matt Mower031163b2014-11-01 15:13:03 -0500459 twrp \
Matt Mower18794c82015-11-11 16:22:45 -0600460 fsck.fat \
461 fatlabel \
462 mkfs.fat \
HashBanged974bb2016-01-30 14:20:09 -0500463 permissive.sh \
Ethan Yonkerf1179622016-08-25 15:32:21 -0500464 simg2img_twrp \
bigbiffdf8436b2020-08-30 16:22:34 -0400465 libbootloader_message \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500466 init.recovery.hlthchrg.rc \
bigbiff973167a2020-04-06 15:44:20 -0400467 init.recovery.service.rc \
468 init.recovery.ldconfig.rc \
bigbiff7ba75002020-04-11 20:47:09 -0400469 awk \
bigbiffad58e1b2020-07-06 20:24:34 -0400470 toybox \
471 toolbox \
bigbiffdf8436b2020-08-30 16:22:34 -0400472 mkshrc_twrp \
Mohammad Afaneh3150f1e2020-10-16 00:45:03 +0300473 plat_hwservice_contexts \
bigbiff1f9e4842020-10-31 11:33:15 -0400474 vendor_hwservice_contexts \
bigbiff7ed51062020-12-02 13:18:20 -0500475 minadbd \
bigbiff91bd7a72021-01-03 17:33:01 -0500476 twrpbu \
bigbiff98203ce2021-03-03 20:39:52 -0500477 adbd_system_api_recovery \
Captain Throwback7f398f72020-12-30 21:46:17 -0500478 me.twrp.twrpapp.apk \
bigbiffd81833a2021-01-17 11:06:57 -0500479 privapp-permissions-twrpapp.xml \
480 adbd_system_api_recovery \
bigbiffe6d833a2021-10-17 13:54:43 -0400481 libsync.recovery \
Captain Throwback00f0dcd2022-04-14 20:13:10 -0400482 libandroidicu.recovery
bigbiff7ba75002020-04-11 20:47:09 -0400483
Captain Throwback6443cef2021-01-30 12:26:25 -0500484ifneq ($(TW_EXCLUDE_TZDATA), true)
485TWRP_REQUIRED_MODULES += \
486 tzdata_twrp
487endif
488
nebrassy50789652021-02-12 23:36:44 +0100489ifneq ($(TW_EXCLUDE_NANO), true)
490TWRP_REQUIRED_MODULES += \
491 nano_twrp \
492 nano.rc
493endif
494
DarthJabba9fba0cee2021-02-20 17:13:09 -0500495ifneq ($(TW_EXCLUDE_BASH), true)
496 ifneq ($(wildcard external/bash/.),)
497 TWRP_REQUIRED_MODULES += \
498 bash_twrp
499 endif
500endif
501
nebrassy05b54052021-02-24 19:02:42 +0100502ifeq ($(TW_INCLUDE_REPACKTOOLS), true)
503TWRP_REQUIRED_MODULES += \
504 magiskboot
505endif
506
507ifeq ($(TW_INCLUDE_RESETPROP), true)
508TWRP_REQUIRED_MODULES += \
509 resetprop
510endif
nebrassy50789652021-02-12 23:36:44 +0100511
bigbiff7ba75002020-04-11 20:47:09 -0400512TWRP_REQUIRED_MODULES += \
Captain Throwbackddb0a402020-11-01 12:52:21 -0500513 hwservicemanager \
514 hwservicemanager.rc \
bigbiff7ba75002020-04-11 20:47:09 -0400515 vndservicemanager \
Mohd Faraz29cab7f2021-04-17 11:35:09 +0200516 vndservicemanager.rc
517
518ifneq ($(TW_INCLUDE_CRYPTO),)
519TWRP_REQUIRED_MODULES += \
bigbiff7ba75002020-04-11 20:47:09 -0400520 vold_prepare_subdirs \
bigbiffad58e1b2020-07-06 20:24:34 -0400521 task_recovery_profiles.json \
bigbiffdf53b6c2022-01-17 19:31:52 -0500522 fscryptpolicyget.recovery \
523 keystore_auth \
524 keystore2 \
525 android.system.keystore2-service.xml \
526 keystore2.rc \
527 plat_keystore2_key_contexts
528
Captain Throwbackddb0a402020-11-01 12:52:21 -0500529 ifneq ($(TW_INCLUDE_CRYPTO_FBE),)
530 TWRP_REQUIRED_MODULES += \
531 plat_service_contexts \
532 servicemanager \
533 servicemanager.rc
534 endif
bigbiff7ba75002020-04-11 20:47:09 -0400535endif
Matt Mower031163b2014-11-01 15:13:03 -0500536
bigbiff416fe3a2020-03-28 13:46:48 -0400537ifneq ($(wildcard external/zip/Android.mk),)
538 TWRP_REQUIRED_MODULES += zip
539endif
540ifneq ($(wildcard external/unzip/Android.mk),)
541 TWRP_REQUIRED_MODULES += unzip
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600542endif
Matt Mower84057612017-01-08 13:32:18 -0600543
Matt Mower20172792014-11-14 10:54:03 -0600544ifneq ($(TW_NO_EXFAT), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500545 TWRP_REQUIRED_MODULES += mkexfatfs fsckexfat
Ethan Yonker34741d92016-02-06 13:22:45 -0600546 ifneq ($(TW_NO_EXFAT_FUSE), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500547 TWRP_REQUIRED_MODULES += exfat-fuse
Ethan Yonker34741d92016-02-06 13:22:45 -0600548 endif
Matt Mower20172792014-11-14 10:54:03 -0600549endif
Matt Mower031163b2014-11-01 15:13:03 -0500550ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
bigbiffad58e1b2020-07-06 20:24:34 -0400551 TWRP_REQUIRED_MODULES += sgdisk
Matt Mower031163b2014-11-01 15:13:03 -0500552endif
Captain Throwback630fd662022-04-05 17:10:29 -0400553ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS),)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500554 TWRP_REQUIRED_MODULES += openaes openaes_license
Matt Mower031163b2014-11-01 15:13:03 -0500555endif
556ifeq ($(TW_INCLUDE_DUMLOCK), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500557 TWRP_REQUIRED_MODULES += \
Matt Mower031163b2014-11-01 15:13:03 -0500558 htcdumlock htcdumlocksys flash_imagesys dump_imagesys libbmlutils.so \
559 libflashutils.so libmmcutils.so libmtdutils.so HTCDumlock.apk
560endif
Matt Mower031163b2014-11-01 15:13:03 -0500561ifeq ($(TW_INCLUDE_FB2PNG), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500562 TWRP_REQUIRED_MODULES += fb2png
Matt Mower031163b2014-11-01 15:13:03 -0500563endif
564ifneq ($(TW_OEM_BUILD),true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500565 TWRP_REQUIRED_MODULES += orscmd
Matt Mower031163b2014-11-01 15:13:03 -0500566endif
567ifeq ($(BOARD_USES_BML_OVER_MTD),true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500568 TWRP_REQUIRED_MODULES += bml_over_mtd
Matt Mower031163b2014-11-01 15:13:03 -0500569endif
570ifeq ($(TW_INCLUDE_INJECTTWRP), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500571 TWRP_REQUIRED_MODULES += injecttwrp
Matt Mower031163b2014-11-01 15:13:03 -0500572endif
Matt Mowerec009e82015-01-30 13:00:49 -0600573ifneq ($(TW_EXCLUDE_DEFAULT_USB_INIT), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500574 TWRP_REQUIRED_MODULES += init.recovery.usb.rc
Matt Mowerec009e82015-01-30 13:00:49 -0600575endif
Captain Throwback1f127752016-01-19 17:30:20 -0500576ifeq ($(TWRP_INCLUDE_LOGCAT), true)
bigbiffad58e1b2020-07-06 20:24:34 -0400577 TWRP_REQUIRED_MODULES += logcat event-log-tags
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600578 ifeq ($(TARGET_USES_LOGD), true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500579 TWRP_REQUIRED_MODULES += logd libsysutils libnl init.recovery.logd.rc
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600580 endif
Captain Throwback1f127752016-01-19 17:30:20 -0500581endif
Matt Mower031163b2014-11-01 15:13:03 -0500582# Allow devices to specify device-specific recovery dependencies
583ifneq ($(TARGET_RECOVERY_DEVICE_MODULES),)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500584 TWRP_REQUIRED_MODULES += $(TARGET_RECOVERY_DEVICE_MODULES)
Matt Mower031163b2014-11-01 15:13:03 -0500585endif
Ethan Yonkerb81d9052015-07-09 13:20:53 -0500586ifeq ($(TW_INCLUDE_NTFS_3G),true)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -0500587 TWRP_REQUIRED_MODULES += \
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500588 mount.ntfs \
589 fsck.ntfs \
590 mkfs.ntfs
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500591endif
Matt Mower58294912015-12-10 11:54:28 -0600592ifeq ($(TARGET_USERIMAGES_USE_F2FS), true)
Captain Throwback88338682022-05-21 10:44:13 -0400593 TWRP_REQUIRED_MODULES += sload_f2fs \
bigbiffd58ba182020-03-23 10:02:29 -0400594 libfs_mgr \
595 fs_mgr \
nebrassy86c09dc2022-02-06 16:48:41 +0100596 liblz4 \
bigbiffd58ba182020-03-23 10:02:29 -0400597 libinit
Ethan Yonker93382822018-11-01 15:25:31 -0500598endif
Captain Throwback00f0dcd2022-04-14 20:13:10 -0400599ifneq ($(TW_LOAD_VENDOR_MODULES),)
600 TWRP_REQUIRED_MODULES += libmodprobe
601endif
Captain Throwback73ab9722022-08-03 16:47:54 -0400602ifeq ($(TW_INCLUDE_PYTHON),true)
Captain Throwback1ef40fc2022-05-28 20:55:20 -0400603 TWRP_REQUIRED_MODULES += python3_twrp
604endif
bigbiffad58e1b2020-07-06 20:24:34 -0400605
606TWRP_REQUIRED_MODULES += file_contexts_text
607
Daeho Jeong88cf0742021-12-01 15:25:14 -0800608LOCAL_REQUIRED_MODULES += \
609 mkfs.erofs.recovery \
610 dump.erofs.recovery \
bigbifff5ddf352022-10-10 12:31:37 -0400611 fsck.erofs.recovery \
612 task_profiles.json.recovery
Daeho Jeong88cf0742021-12-01 15:25:14 -0800613
Tianjie Xu2b1a4642018-09-06 11:58:55 -0700614# On A/B devices recovery-persist reads the recovery related file from the persist storage and
615# copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist
616# parses the last_install file and reports the embedded update metrics. Also, the last_install file
617# will be deteleted after the report.
618LOCAL_REQUIRED_MODULES += recovery-persist
bigbiffad58e1b2020-07-06 20:24:34 -0400619ifeq ($(BOARD_CACHEIMAGE_PARTITION_SIZE),)
620 TWRP_REQUIRED_MODULES += recovery-persist recovery-refresh
Matt Mower58294912015-12-10 11:54:28 -0600621endif
Matt Mower031163b2014-11-01 15:13:03 -0500622
bigbiffad58e1b2020-07-06 20:24:34 -0400623LOCAL_REQUIRED_MODULES += $(TWRP_REQUIRED_MODULES)
Mark Salyzyn13aca592016-03-09 14:58:16 -0800624
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800625include $(BUILD_EXECUTABLE)
626
Matt Mowerd821c962017-02-15 12:36:18 -0600627# Symlink for file_contexts
628include $(CLEAR_VARS)
629
Captain Throwback3184b2f2017-03-07 12:07:40 -0500630LOCAL_MODULE := file_contexts_text
Matt Mowerd821c962017-02-15 12:36:18 -0600631LOCAL_MODULE_TAGS := optional
bigbiffad58e1b2020-07-06 20:24:34 -0400632LOCAL_REQUIRED_MODULES := file_contexts.bin
633
Matt Mowerd821c962017-02-15 12:36:18 -0600634LOCAL_POST_INSTALL_CMD := \
Ethan Yonker58f21322018-08-24 11:17:36 -0500635 $(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 -0600636
bigbiff416fe3a2020-03-28 13:46:48 -0400637include $(BUILD_PHONY_PACKAGE)
Dees_Troyc04dcf72012-10-02 10:46:37 -0400638
Mark Salyzyn13aca592016-03-09 14:58:16 -0800639# recovery-persist (system partition dynamic executable run after /data mounts)
640# ===============================
bigbiffad58e1b2020-07-06 20:24:34 -0400641include $(CLEAR_VARS)
642LOCAL_SRC_FILES := \
643 recovery-persist.cpp
644LOCAL_MODULE := recovery-persist
bigbiff673c7ae2020-12-02 19:44:56 -0500645LOCAL_SHARED_LIBRARIES := liblog libbase
646LOCAL_STATIC_LIBRARIES := libotautil librecovery_utils
bigbiffad58e1b2020-07-06 20:24:34 -0400647LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
bigbiff673c7ae2020-12-02 19:44:56 -0500648LOCAL_C_INCLUDES += system/core/libstats/include
649LOCAL_C_INCLUDES += $(LOCAL_PATH)/recovery_utils/include
bigbiffad58e1b2020-07-06 20:24:34 -0400650LOCAL_CFLAGS := -Werror
651LOCAL_INIT_RC := recovery-persist.rc
652include $(BUILD_EXECUTABLE)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800653
Mark Salyzyn13aca592016-03-09 14:58:16 -0800654# recovery-refresh (system partition dynamic executable run at init)
655# ===============================
bigbiffad58e1b2020-07-06 20:24:34 -0400656include $(CLEAR_VARS)
657LOCAL_SRC_FILES := \
658 recovery-refresh.cpp
659LOCAL_MODULE := recovery-refresh
660LOCAL_SHARED_LIBRARIES := liblog libbase
bigbiff673c7ae2020-12-02 19:44:56 -0500661LOCAL_STATIC_LIBRARIES := libotautil librecovery_utils
bigbiffad58e1b2020-07-06 20:24:34 -0400662LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
bigbiff673c7ae2020-12-02 19:44:56 -0500663LOCAL_C_INCLUDES += $(LOCAL_PATH)/recovery_utils/include
bigbiffad58e1b2020-07-06 20:24:34 -0400664LOCAL_CFLAGS := -Werror
665LOCAL_INIT_RC := recovery-refresh.rc
666include $(BUILD_EXECUTABLE)
Tao Bao42c45e22018-07-31 09:37:12 -0700667
Elliott Hughes63a31922016-06-09 17:41:22 -0700668# libmounts (static library)
669# ===============================
670include $(CLEAR_VARS)
671LOCAL_SRC_FILES := mounts.cpp
Tao Bao5f85d1f2017-03-28 21:12:36 -0700672LOCAL_CFLAGS := \
673 -Wall \
674 -Werror
Elliott Hughes63a31922016-06-09 17:41:22 -0700675LOCAL_MODULE := libmounts
Tao Bao5f85d1f2017-03-28 21:12:36 -0700676LOCAL_STATIC_LIBRARIES := libbase
Elliott Hughes63a31922016-06-09 17:41:22 -0700677include $(BUILD_STATIC_LIBRARY)
678
Tao Bao62e0bc72017-04-10 16:55:57 -0700679# librecovery (static library)
680# ===============================
681include $(CLEAR_VARS)
682LOCAL_SRC_FILES := \
683 install.cpp
Tao Baob24510c2017-04-20 17:54:27 -0700684LOCAL_CFLAGS := -Wall -Werror
Tao Bao62e0bc72017-04-10 16:55:57 -0700685LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
Tao Bao25dbe172017-04-12 23:52:20 -0700686
687ifeq ($(AB_OTA_UPDATER),true)
688 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
689endif
690
Tao Bao62e0bc72017-04-10 16:55:57 -0700691LOCAL_MODULE := librecovery
692LOCAL_STATIC_LIBRARIES := \
693 libminui \
Tao Baocfe53c22017-10-03 14:37:21 -0700694 libotautil \
bigbiff7ba75002020-04-11 20:47:09 -0400695 libvintf \
Tao Bao62e0bc72017-04-10 16:55:57 -0700696 libcrypto_utils \
nebrassybf9d2252021-11-14 23:26:29 +0100697 libcrypto_static \
Elliott Hughese1bb7a52017-06-28 08:00:17 -0700698 libbase \
699 libziparchive \
Tao Bao62e0bc72017-04-10 16:55:57 -0700700
701include $(BUILD_STATIC_LIBRARY)
702
Dees_Troy51a0e822012-09-05 15:24:24 -0400703commands_recovery_local_path := $(LOCAL_PATH)
Ethan Yonkerecbd3e82017-12-14 14:43:59 -0600704
Yabin Cui2f272c02016-06-24 18:22:02 -0700705include \
bigbiffdf8436b2020-08-30 16:22:34 -0400706 $(commands_TWRP_local_path)/updater/Android.mk
Ethan Yonker58f21322018-08-24 11:17:36 -0500707
bigbiff7ed51062020-12-02 13:18:20 -0500708include $(commands_TWRP_local_path)/mtp/ffs/Android.mk \
bigbiffad58e1b2020-07-06 20:24:34 -0400709 $(commands_TWRP_local_path)/minui/Android.mk
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500710
Dees_Troy51a0e822012-09-05 15:24:24 -0400711#includes for TWRP
Ethan Yonker58f21322018-08-24 11:17:36 -0500712include $(commands_TWRP_local_path)/injecttwrp/Android.mk \
713 $(commands_TWRP_local_path)/htcdumlock/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500714 $(commands_TWRP_local_path)/mmcutils/Android.mk \
715 $(commands_TWRP_local_path)/bmlutils/Android.mk \
716 $(commands_TWRP_local_path)/prebuilt/Android.mk \
717 $(commands_TWRP_local_path)/mtdutils/Android.mk \
718 $(commands_TWRP_local_path)/flashutils/Android.mk \
719 $(commands_TWRP_local_path)/pigz/Android.mk \
720 $(commands_TWRP_local_path)/libtar/Android.mk \
721 $(commands_TWRP_local_path)/libcrecovery/Android.mk \
722 $(commands_TWRP_local_path)/libblkid/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500723 $(commands_TWRP_local_path)/openaes/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500724 $(commands_TWRP_local_path)/twrpTarMain/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500725 $(commands_TWRP_local_path)/minzip/Android.mk \
726 $(commands_TWRP_local_path)/dosfstools/Android.mk \
727 $(commands_TWRP_local_path)/etc/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500728 $(commands_TWRP_local_path)/simg2img/Android.mk \
729 $(commands_TWRP_local_path)/adbbu/Android.mk \
Ethan Yonker58f21322018-08-24 11:17:36 -0500730 $(commands_TWRP_local_path)/twrpDigest/Android.mk \
731 $(commands_TWRP_local_path)/attr/Android.mk
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600732
mauronofrio6d3bf892019-10-26 19:47:55 +0200733ifneq ($(TW_OZIP_DECRYPT_KEY),)
734 TWRP_REQUIRED_MODULES += ozip_decrypt
735 include $(commands_TWRP_local_path)/ozip_decrypt/Android.mk
736endif
737
Ethan Yonker253368a2014-11-25 15:00:52 -0600738ifeq ($(TW_INCLUDE_CRYPTO), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500739 include $(commands_TWRP_local_path)/crypto/scrypt/Android.mk
Ethan Yonker58f21322018-08-24 11:17:36 -0500740 include $(commands_TWRP_local_path)/gpt/Android.mk
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600741endif
Vojtech Bocek7cc278b2013-02-24 01:40:19 +0100742ifeq ($(BUILD_ID), GINGERBREAD)
743 TW_NO_EXFAT := true
744endif
Dees_Troyb05ddee2013-01-28 20:24:50 +0000745ifneq ($(TW_NO_EXFAT), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500746 include $(commands_TWRP_local_path)/exfat/mkfs/Android.mk \
747 $(commands_TWRP_local_path)/exfat/fsck/Android.mk \
748 $(commands_TWRP_local_path)/fuse/Android.mk \
749 $(commands_TWRP_local_path)/exfat/libexfat/Android.mk
Ethan Yonker34741d92016-02-06 13:22:45 -0600750 ifneq ($(TW_NO_EXFAT_FUSE), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500751 include $(commands_TWRP_local_path)/exfat/fuse/Android.mk
Ethan Yonker34741d92016-02-06 13:22:45 -0600752 endif
Captain Throwback6a1acf22014-09-18 12:46:35 -0400753endif
Ethan Yonker03a42f62014-08-08 11:03:51 -0500754ifneq ($(TW_OEM_BUILD),true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500755 include $(commands_TWRP_local_path)/orscmd/Android.mk
Ethan Yonker03a42f62014-08-08 11:03:51 -0500756endif
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500757
Talustus3019a912013-04-06 11:50:07 +0200758# FB2PNG
759ifeq ($(TW_INCLUDE_FB2PNG), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500760 include $(commands_TWRP_local_path)/fb2png/Android.mk
Talustus3019a912013-04-06 11:50:07 +0200761endif
Matt Mower55c75ca2014-08-31 11:30:15 -0500762
Matt Mower55c75ca2014-08-31 11:30:15 -0500763endif
Ethan Yonker58f21322018-08-24 11:17:36 -0500764
765commands_TWRP_local_path :=