blob: 6880ed2c26f7314a16a42331ab3ed4cb0df5d5bf [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)
16
Matt Mower66766fe2014-10-06 18:03:39 -050017ifdef project-path-for
18 ifeq ($(LOCAL_PATH),$(call project-path-for,recovery))
19 PROJECT_PATH_AGREES := true
Andrea Mennillof591c872015-11-03 20:58:11 +010020 BOARD_SEPOLICY_DIRS += $(call project-path-for,recovery)/sepolicy
Matt Mower66766fe2014-10-06 18:03:39 -050021 endif
22else
23 ifeq ($(LOCAL_PATH),bootable/recovery)
24 PROJECT_PATH_AGREES := true
Ethan Yonker11309e92015-07-01 07:58:56 -050025 BOARD_SEPOLICY_DIRS += bootable/recovery/sepolicy
Matt Mower66766fe2014-10-06 18:03:39 -050026 endif
Matt Mower55c75ca2014-08-31 11:30:15 -050027endif
28
Matt Mower66766fe2014-10-06 18:03:39 -050029ifeq ($(PROJECT_PATH_AGREES),true)
Matt Mower55c75ca2014-08-31 11:30:15 -050030
Matt Mower047723c2015-12-10 01:31:15 -060031ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22))
Ethan Yonker11309e92015-07-01 07:58:56 -050032# Make recovery domain permissive for TWRP
that8e213fd2015-10-17 00:17:53 +020033 BOARD_SEPOLICY_UNION += twrp.te
34endif
Ethan Yonker11309e92015-07-01 07:58:56 -050035
Motorhead199175b6f662014-06-12 15:58:33 -070036include $(CLEAR_VARS)
37
Matt Mower1777cdc2015-09-26 15:56:56 -050038TWRES_PATH := /twres/
Dees Troy3454ade2015-01-20 19:21:04 +000039TWHTCD_PATH := $(TWRES_PATH)htcd/
40
Dees_Troy51a0e822012-09-05 15:24:24 -040041TARGET_RECOVERY_GUI := true
Joe Onorato6396e702012-05-31 23:21:46 -070042
bigbiff bigbiff584b9772016-12-08 21:21:17 -050043ifneq ($(TW_DEVICE_VERSION),)
44 LOCAL_CFLAGS += -DTW_DEVICE_VERSION='"-$(TW_DEVICE_VERSION)"'
45else
46 LOCAL_CFLAGS += -DTW_DEVICE_VERSION='"-0"'
47endif
48
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080049LOCAL_SRC_FILES := \
Dees_Troy2673cec2013-04-02 20:22:16 +000050 twrp.cpp \
Ethan Yonkerb5fab762016-01-28 14:03:33 -060051 fixContexts.cpp \
bigbiff bigbiff9c754052013-01-09 09:09:08 -050052 twrpTar.cpp \
Ethan Yonker3fdcda42016-11-30 12:29:37 -060053 exclude.cpp \
Ethan Yonker1b7a31b2014-07-03 15:09:22 -050054 find_file.cpp \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -040055 infomanager.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040056 data.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040057 partition.cpp \
58 partitionmanager.cpp \
Ethan Yonker472f5062016-02-25 13:47:30 -060059 progresstracking.cpp \
Dees_Troy32c8eb82012-09-11 15:28:06 -040060 twinstall.cpp \
Dees_Troy812660f2012-09-20 09:55:17 -040061 twrp-functions.cpp \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -040062 twrpDigestDriver.cpp \
Dees_Troye34c1332013-02-06 19:13:00 +000063 openrecoveryscript.cpp \
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040064 tarWrite.c \
65 twrpAdbBuFifo.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040066
Dees_Troya58bead2012-09-27 09:49:29 -040067ifneq ($(TARGET_RECOVERY_REBOOT_SRC),)
Dees_Troy51a0e822012-09-05 15:24:24 -040068 LOCAL_SRC_FILES += $(TARGET_RECOVERY_REBOOT_SRC)
69endif
70
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080071LOCAL_MODULE := recovery
72
Dees_Troy51a0e822012-09-05 15:24:24 -040073#LOCAL_FORCE_STATIC_EXECUTABLE := true
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080074
Ethan Yonker34ae4832016-08-24 15:32:18 -050075#ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
Ethan Yonkera1674162014-11-06 08:35:10 -060076#ifeq ($(HOST_OS),linux)
77#LOCAL_REQUIRED_MODULES := mkfs.f2fs
78#endif
Ethan Yonker34ae4832016-08-24 15:32:18 -050079#endif
JP Abgrall37aedb32014-06-16 19:07:39 -070080
Doug Zongkere08991e2010-02-02 13:09:52 -080081RECOVERY_API_VERSION := 3
Ken Sumrallf35d1ce2013-02-13 12:59:35 -080082RECOVERY_FSTAB_VERSION := 2
Doug Zongkerfb2e3af2009-06-17 17:29:40 -070083LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
Doug Zongker0d32f252014-02-13 15:07:56 -080084LOCAL_CFLAGS += -Wno-unused-parameter
Tao Bao80e46e02015-06-03 10:49:29 -070085LOCAL_CLANG := true
Doug Zongkerfb2e3af2009-06-17 17:29:40 -070086
Dees_Troy51a0e822012-09-05 15:24:24 -040087#LOCAL_STATIC_LIBRARIES := \
Dees_Troy1669f892013-09-04 18:35:08 +000088# libext4_utils_static \
89# libsparse_static \
Dees_Troy51a0e822012-09-05 15:24:24 -040090# libminzip \
Dees_Troy1669f892013-09-04 18:35:08 +000091# libz \
Dees_Troy51a0e822012-09-05 15:24:24 -040092# libmtdutils \
93# libmincrypt \
94# libminadbd \
Dees_Troy1669f892013-09-04 18:35:08 +000095# libminui \
96# libpixelflinger_static \
97# libpng \
98# libfs_mgr \
99# libcutils \
100# liblog \
101# libselinux \
102# libstdc++ \
103# libm \
104# libc
Dees_Troy51a0e822012-09-05 15:24:24 -0400105
Dan Albert1ddd3502015-02-18 15:58:15 -0800106LOCAL_C_INCLUDES += \
107 system/vold \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500108 system/extras \
Dan Albert1ddd3502015-02-18 15:58:15 -0800109 system/core/adb \
bigbiffce8f83c2015-12-12 18:30:21 -0500110 system/core/libsparse \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500111 external/zlib \
112 $(LOCAL_PATH)/bootloader_message_twrp/include
Adrien Grassein3cd669f2014-11-06 14:53:50 +0100113
bigbiff bigbiff56cf5642016-08-19 17:43:45 -0400114LOCAL_C_INCLUDES += bionic
Xing0af1ac12015-11-27 11:19:37 -0800115ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
bigbiff bigbiff56cf5642016-08-19 17:43:45 -0400116 LOCAL_C_INCLUDES += external/stlport/stlport external/openssl/include
117else
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500118 LOCAL_C_INCLUDES += external/boringssl/include external/libcxx/include
Xing0af1ac12015-11-27 11:19:37 -0800119endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400120
121LOCAL_STATIC_LIBRARIES :=
122LOCAL_SHARED_LIBRARIES :=
123
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600124LOCAL_STATIC_LIBRARIES += libguitwrp
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500125LOCAL_SHARED_LIBRARIES += libaosprecovery libz libc libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libtwadbbu libbootloader_message_twrp
126LOCAL_SHARED_LIBRARIES += libcrecovery libtwadbbu libtwrpdigest libc++
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500127
Xing0af1ac12015-11-27 11:19:37 -0800128ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
Ethan Yonker534d4e02016-08-26 10:05:03 -0500129 LOCAL_SHARED_LIBRARIES += libstlport
bigbiff bigbiff56cf5642016-08-19 17:43:45 -0400130 LOCAL_CFLAGS += -DTW_NO_SHA2_LIBRARY
Ethan Yonker534d4e02016-08-26 10:05:03 -0500131endif
132ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
133 LOCAL_SHARED_LIBRARIES += libmincrypttwrp
Ethan Yonkerf1179622016-08-25 15:32:21 -0500134 LOCAL_C_INCLUDES += $(LOCAL_PATH)/libmincrypt/includes
135 LOCAL_CFLAGS += -DUSE_OLD_VERIFIER
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500136else
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500137 LOCAL_SHARED_LIBRARIES += libcrypto
Ethan Yonkerf1179622016-08-25 15:32:21 -0500138endif
139
140ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
141 LOCAL_SHARED_LIBRARIES += libbase
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500142endif
Doug Zongker49c73a72010-06-29 17:36:28 -0700143
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500144ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
145 LOCAL_SHARED_LIBRARIES += libziparchive
146else
147 LOCAL_SHARED_LIBRARIES += libminzip
148 LOCAL_CFLAGS += -DUSE_MINZIP
149endif
150
Dees_Troy4546fe72013-01-10 14:33:27 +0000151ifneq ($(wildcard system/core/libsparse/Android.mk),)
152LOCAL_SHARED_LIBRARIES += libsparse
153endif
154
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500155ifeq ($(TW_OEM_BUILD),true)
156 LOCAL_CFLAGS += -DTW_OEM_BUILD
157 BOARD_HAS_NO_REAL_SDCARD := true
158 TW_USE_TOOLBOX := true
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400159 TW_EXCLUDE_MTP := true
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500160endif
Yabin Cui99281df2016-02-17 12:21:52 -0800161
Doug Zongker49c73a72010-06-29 17:36:28 -0700162ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
Joe Onorato6396e702012-05-31 23:21:46 -0700163 LOCAL_CFLAGS += -DUSE_EXT4
164 LOCAL_C_INCLUDES += system/extras/ext4_utils
Dees_Troya95f55c2013-08-17 13:14:43 +0000165 LOCAL_SHARED_LIBRARIES += libext4_utils
Tom Marshall56fe5e72015-04-17 05:23:00 -0700166 ifneq ($(wildcard external/lz4/Android.mk),)
Humberto Borba443af212016-08-30 18:06:30 -0300167 #LOCAL_STATIC_LIBRARIES += liblz4
Tom Marshall56fe5e72015-04-17 05:23:00 -0700168 endif
Doug Zongker49c73a72010-06-29 17:36:28 -0700169endif
Matt Mower87413642017-01-17 21:14:46 -0600170LOCAL_C_INCLUDES += external/libselinux/include
171LOCAL_SHARED_LIBRARIES += libselinux
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500172#ifneq ($(TARGET_USERIMAGES_USE_EXT4), true)
173# LOCAL_CFLAGS += -DUSE_EXT4
174# LOCAL_C_INCLUDES += system/extras/ext4_utils
175# LOCAL_SHARED_LIBRARIES += libext4_utils
176# ifneq ($(wildcard external/lz4/Android.mk),)
177# LOCAL_STATIC_LIBRARIES += liblz4
178# endif
179#endif
Doug Zongker49c73a72010-06-29 17:36:28 -0700180
Elliott Hughes01fcbe12016-05-23 17:43:41 -0700181ifeq ($(AB_OTA_UPDATER),true)
182 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
Ethan Yonker1b190162016-12-05 15:25:19 -0600183 LOCAL_SHARED_LIBRARIES += libhardware
184 LOCAL_ADDITIONAL_DEPENDENCIES += libhardware
Elliott Hughes01fcbe12016-05-23 17:43:41 -0700185endif
186
Ying Wang5a50b1b2015-03-10 11:56:56 -0700187LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800188
Dees_Troy1669f892013-09-04 18:35:08 +0000189#ifeq ($(TARGET_RECOVERY_UI_LIB),)
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500190# LOCAL_SRC_FILES += default_device.cpp
Dees_Troy1669f892013-09-04 18:35:08 +0000191#else
192# LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UI_LIB)
193#endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800194
Doug Zongkercc8cd3f2010-09-20 12:16:13 -0700195LOCAL_C_INCLUDES += system/extras/ext4_utils
196
that0e2140e2016-08-10 21:04:26 +0200197tw_git_revision := $(shell git -C $(LOCAL_PATH) rev-parse --short=8 HEAD 2>/dev/null)
198ifeq ($(shell git -C $(LOCAL_PATH) diff --quiet; echo $$?),1)
199 tw_git_revision := $(tw_git_revision)-dirty
200endif
201LOCAL_CFLAGS += -DTW_GIT_REVISION='"$(tw_git_revision)"'
202
Dees_Troy51a0e822012-09-05 15:24:24 -0400203#TWRP Build Flags
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400204ifeq ($(TW_EXCLUDE_MTP),)
205 LOCAL_SHARED_LIBRARIES += libtwrpmtp
206 LOCAL_CFLAGS += -DTW_HAS_MTP
207endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -0700208ifneq ($(TW_NO_SCREEN_TIMEOUT),)
209 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
210endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400211ifeq ($(BOARD_HAS_NO_REAL_SDCARD), true)
212 LOCAL_CFLAGS += -DBOARD_HAS_NO_REAL_SDCARD
213endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400214ifneq ($(RECOVERY_SDCARD_ON_DATA),)
215 LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
216endif
217ifneq ($(TW_INCLUDE_DUMLOCK),)
218 LOCAL_CFLAGS += -DTW_INCLUDE_DUMLOCK
219endif
220ifneq ($(TW_INTERNAL_STORAGE_PATH),)
221 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_PATH=$(TW_INTERNAL_STORAGE_PATH)
222endif
223ifneq ($(TW_INTERNAL_STORAGE_MOUNT_POINT),)
224 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_MOUNT_POINT=$(TW_INTERNAL_STORAGE_MOUNT_POINT)
225endif
226ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
227 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
228endif
229ifneq ($(TW_EXTERNAL_STORAGE_MOUNT_POINT),)
230 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_MOUNT_POINT=$(TW_EXTERNAL_STORAGE_MOUNT_POINT)
231endif
ChampionSwimmercf33e4d2013-02-03 13:59:22 +0530232ifeq ($(TW_HAS_NO_BOOT_PARTITION), true)
233 LOCAL_CFLAGS += -DTW_HAS_NO_BOOT_PARTITION
234endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400235ifeq ($(TW_NO_REBOOT_BOOTLOADER), true)
236 LOCAL_CFLAGS += -DTW_NO_REBOOT_BOOTLOADER
237endif
238ifeq ($(TW_NO_REBOOT_RECOVERY), true)
239 LOCAL_CFLAGS += -DTW_NO_REBOOT_RECOVERY
240endif
241ifeq ($(TW_NO_BATT_PERCENT), true)
242 LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
243endif
Jenkins1710bf22014-10-02 20:22:21 -0400244ifeq ($(TW_NO_CPU_TEMP), true)
245 LOCAL_CFLAGS += -DTW_NO_CPU_TEMP
246endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400247ifneq ($(TW_CUSTOM_POWER_BUTTON),)
248 LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
249endif
250ifeq ($(TW_ALWAYS_RMRF), true)
251 LOCAL_CFLAGS += -DTW_ALWAYS_RMRF
252endif
253ifeq ($(TW_NEVER_UNMOUNT_SYSTEM), true)
254 LOCAL_CFLAGS += -DTW_NEVER_UNMOUNT_SYSTEM
255endif
256ifeq ($(TW_NO_USB_STORAGE), true)
257 LOCAL_CFLAGS += -DTW_NO_USB_STORAGE
258endif
259ifeq ($(TW_INCLUDE_INJECTTWRP), true)
260 LOCAL_CFLAGS += -DTW_INCLUDE_INJECTTWRP
261endif
262ifeq ($(TW_INCLUDE_BLOBPACK), true)
263 LOCAL_CFLAGS += -DTW_INCLUDE_BLOBPACK
264endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400265ifneq ($(TARGET_USE_CUSTOM_LUN_FILE_PATH),)
266 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(TARGET_USE_CUSTOM_LUN_FILE_PATH)\"
267endif
268ifneq ($(BOARD_UMS_LUNFILE),)
269 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(BOARD_UMS_LUNFILE)\"
270endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400271ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
272 LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
273endif
bigbiff bigbiff87940362013-03-09 09:58:50 -0500274ifeq ($(TW_NO_SCREEN_BLANK), true)
275 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
276endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400277ifeq ($(TW_SDEXT_NO_EXT4), true)
278 LOCAL_CFLAGS += -DTW_SDEXT_NO_EXT4
279endif
Dees_Troyfdf5fcc2012-09-11 10:27:01 -0400280ifeq ($(TW_FORCE_CPUINFO_FOR_DEVICE_ID), true)
281 LOCAL_CFLAGS += -DTW_FORCE_CPUINFO_FOR_DEVICE_ID
282endif
Dees_Troy3f5c4e82013-02-01 15:16:59 +0000283ifeq ($(TW_NO_EXFAT_FUSE), true)
284 LOCAL_CFLAGS += -DTW_NO_EXFAT_FUSE
285endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400286ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
Ethan Yonker253368a2014-11-25 15:00:52 -0600287 TW_INCLUDE_CRYPTO := true
Dees_Troy51a0e822012-09-05 15:24:24 -0400288endif
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600289ifeq ($(TW_INCLUDE_L_CRYPTO), true)
Ethan Yonker253368a2014-11-25 15:00:52 -0600290 TW_INCLUDE_CRYPTO := true
291endif
292ifeq ($(TW_INCLUDE_CRYPTO), true)
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600293 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
Ethan Yonker66a19492015-12-10 10:19:45 -0600294 LOCAL_SHARED_LIBRARIES += libcryptfslollipop libgpt_twrp
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500295 LOCAL_C_INCLUDES += external/boringssl/src/include
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600296 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
297 TW_INCLUDE_CRYPTO_FBE := true
298 LOCAL_CFLAGS += -DTW_INCLUDE_FBE
299 LOCAL_SHARED_LIBRARIES += libe4crypt
300 endif
nkk7171c6c502017-01-05 23:55:05 +0200301 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),)
302 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),false)
303 LOCAL_CFLAGS += -DTW_CRYPTO_USE_SYSTEM_VOLD
304 LOCAL_STATIC_LIBRARIES += libvolddecrypt
305 endif
306 endif
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600307endif
D. Andrei Măceșb29a5e22016-12-22 06:19:44 -0500308WITH_CRYPTO_UTILS := \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500309 $(if $(wildcard system/core/libcrypto_utils/android_pubkey.c),true)
Anatoly Smaznov10c11f62013-02-12 13:33:40 +0700310ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true)
311 LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
312endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600313ifneq ($(TW_BRIGHTNESS_PATH),)
314 LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=$(TW_BRIGHTNESS_PATH)
315endif
xNUTxe85f02d2014-07-18 01:30:58 +0200316ifneq ($(TW_SECONDARY_BRIGHTNESS_PATH),)
317 LOCAL_CFLAGS += -DTW_SECONDARY_BRIGHTNESS_PATH=$(TW_SECONDARY_BRIGHTNESS_PATH)
318endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600319ifneq ($(TW_MAX_BRIGHTNESS),)
320 LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
321endif
Greg Wallace36ade452015-11-08 13:54:25 -0500322ifneq ($(TW_DEFAULT_BRIGHTNESS),)
323 LOCAL_CFLAGS += -DTW_DEFAULT_BRIGHTNESS=$(TW_DEFAULT_BRIGHTNESS)
324endif
Dees_Troyf33b4902013-03-01 00:51:39 +0000325ifneq ($(TW_CUSTOM_BATTERY_PATH),)
326 LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
327endif
Jenkins1710bf22014-10-02 20:22:21 -0400328ifneq ($(TW_CUSTOM_CPU_TEMP_PATH),)
329 LOCAL_CFLAGS += -DTW_CUSTOM_CPU_TEMP_PATH=$(TW_CUSTOM_CPU_TEMP_PATH)
330endif
Dees_Troy83bd4832013-05-04 12:39:56 +0000331ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
332 LOCAL_SHARED_LIBRARIES += libopenaes
333else
334 LOCAL_CFLAGS += -DTW_EXCLUDE_ENCRYPTED_BACKUPS
335endif
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100336ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),)
Michael Bestas4a185582017-04-28 15:45:26 +0300337 ifneq ($(filter msm8226 msm8x26 msm8610 msm8974 msm8x74 msm8084 msm8x84 apq8084 msm8909 msm8916 msm8992 msm8994 msm8952 msm8996 msm8937 msm8953 msm8998,$(TARGET_BOARD_PLATFORM)),)
338 LOCAL_CFLAGS += -DQCOM_RTC_FIX
339 else ifeq ($(TARGET_CPU_VARIANT),krait)
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100340 LOCAL_CFLAGS += -DQCOM_RTC_FIX
341 endif
342else ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),true)
343 LOCAL_CFLAGS += -DQCOM_RTC_FIX
344endif
Matt Mower6883d732014-03-20 17:28:13 -0500345ifneq ($(TW_NO_LEGACY_PROPS),)
346 LOCAL_CFLAGS += -DTW_NO_LEGACY_PROPS
347endif
Dees Troy4159aed2014-02-28 17:24:43 +0000348ifneq ($(wildcard bionic/libc/include/sys/capability.h),)
349 LOCAL_CFLAGS += -DHAVE_CAPABILITIES
350endif
Matt Mowerec009e82015-01-30 13:00:49 -0600351ifneq ($(TARGET_RECOVERY_INITRC),)
352 TW_EXCLUDE_DEFAULT_USB_INIT := true
353endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500354ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
355 LOCAL_CFLAGS += -DTW_USE_NEW_MINADBD
356endif
Ethan Yonker74db1572015-10-28 12:44:49 -0500357ifneq ($(TW_DEFAULT_LANGUAGE),)
358 LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=$(TW_DEFAULT_LANGUAGE)
359else
360 LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=en
361endif
Phoenix591e444d112018-02-03 07:23:54 +0000362ifneq ($(TW_CLOCK_OFFSET),)
363 LOCAL_CFLAGS += -DTW_CLOCK_OFFSET=$(TW_CLOCK_OFFSET)
364endif
Ethan Yonker1b190162016-12-05 15:25:19 -0600365LOCAL_ADDITIONAL_DEPENDENCIES += \
Matt Mower031163b2014-11-01 15:13:03 -0500366 dump_image \
367 erase_image \
368 flash_image \
Matt Mower031163b2014-11-01 15:13:03 -0500369 mke2fs.conf \
Matt Mower031163b2014-11-01 15:13:03 -0500370 pigz \
371 teamwin \
Ethan Yonkerf1179622016-08-25 15:32:21 -0500372 toolbox_symlinks \
Matt Mower031163b2014-11-01 15:13:03 -0500373 twrp \
Matt Mower18794c82015-11-11 16:22:45 -0600374 fsck.fat \
375 fatlabel \
376 mkfs.fat \
HashBanged974bb2016-01-30 14:20:09 -0500377 permissive.sh \
Ethan Yonkerf1179622016-08-25 15:32:21 -0500378 simg2img_twrp \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500379 libbootloader_message_twrp \
380 init.recovery.hlthchrg.rc \
Ethan Yonkerf1179622016-08-25 15:32:21 -0500381 init.recovery.service.rc
Matt Mower031163b2014-11-01 15:13:03 -0500382
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600383ifneq ($(TARGET_ARCH), arm64)
Ethan Yonker4f6a9762015-03-09 13:58:54 -0500384 ifneq ($(TARGET_ARCH), x86_64)
385 LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker
386 else
387 LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
388 endif
Ethan Yonker1902c792014-12-03 16:48:36 -0600389else
390 LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600391endif
392ifneq ($(TW_USE_TOOLBOX), true)
393 LOCAL_ADDITIONAL_DEPENDENCIES += busybox_symlinks
Matt Mower84057612017-01-08 13:32:18 -0600394 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
395 LOCAL_POST_INSTALL_CMD := \
396 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin && \
397 ln -sf /sbin/busybox $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
398 endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500399else
400 ifneq ($(wildcard external/toybox/Android.mk),)
401 LOCAL_ADDITIONAL_DEPENDENCIES += toybox_symlinks
402 endif
dianlujitaoce608ab2015-12-28 23:51:19 +0800403 ifneq ($(wildcard external/zip/Android.mk),)
404 LOCAL_ADDITIONAL_DEPENDENCIES += zip
405 endif
406 ifneq ($(wildcard external/unzip/Android.mk),)
407 LOCAL_ADDITIONAL_DEPENDENCIES += unzip
408 endif
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600409endif
Matt Mower84057612017-01-08 13:32:18 -0600410
Matt Mower20172792014-11-14 10:54:03 -0600411ifneq ($(TW_NO_EXFAT), true)
Matt Mower80f7b362015-12-12 15:38:01 -0600412 LOCAL_ADDITIONAL_DEPENDENCIES += mkexfatfs fsckexfat
Ethan Yonker34741d92016-02-06 13:22:45 -0600413 ifneq ($(TW_NO_EXFAT_FUSE), true)
414 LOCAL_ADDITIONAL_DEPENDENCIES += exfat-fuse
415 endif
Matt Mower20172792014-11-14 10:54:03 -0600416endif
Matt Mower031163b2014-11-01 15:13:03 -0500417ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
Ethan Yonker483e9f42016-01-11 22:21:18 -0600418 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
419 LOCAL_ADDITIONAL_DEPENDENCIES += sgdisk
420 else
421 LOCAL_ADDITIONAL_DEPENDENCIES += sgdisk_static
422 endif
Matt Mower031163b2014-11-01 15:13:03 -0500423endif
424ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
Ethan Yonker34ae4832016-08-24 15:32:18 -0500425 LOCAL_ADDITIONAL_DEPENDENCIES += openaes openaes_license
Matt Mower031163b2014-11-01 15:13:03 -0500426endif
427ifeq ($(TW_INCLUDE_DUMLOCK), true)
428 LOCAL_ADDITIONAL_DEPENDENCIES += \
429 htcdumlock htcdumlocksys flash_imagesys dump_imagesys libbmlutils.so \
430 libflashutils.so libmmcutils.so libmtdutils.so HTCDumlock.apk
431endif
Matt Mower031163b2014-11-01 15:13:03 -0500432ifeq ($(TW_INCLUDE_FB2PNG), true)
433 LOCAL_ADDITIONAL_DEPENDENCIES += fb2png
434endif
435ifneq ($(TW_OEM_BUILD),true)
436 LOCAL_ADDITIONAL_DEPENDENCIES += orscmd
437endif
438ifeq ($(BOARD_USES_BML_OVER_MTD),true)
439 LOCAL_ADDITIONAL_DEPENDENCIES += bml_over_mtd
440endif
441ifeq ($(TW_INCLUDE_INJECTTWRP), true)
442 LOCAL_ADDITIONAL_DEPENDENCIES += injecttwrp
443endif
Matt Mowerec009e82015-01-30 13:00:49 -0600444ifneq ($(TW_EXCLUDE_DEFAULT_USB_INIT), true)
445 LOCAL_ADDITIONAL_DEPENDENCIES += init.recovery.usb.rc
446endif
Captain Throwback1f127752016-01-19 17:30:20 -0500447ifeq ($(TWRP_INCLUDE_LOGCAT), true)
448 LOCAL_ADDITIONAL_DEPENDENCIES += logcat
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600449 ifeq ($(TARGET_USES_LOGD), true)
450 LOCAL_ADDITIONAL_DEPENDENCIES += logd libsysutils libnl init.recovery.logd.rc
451 endif
Captain Throwback1f127752016-01-19 17:30:20 -0500452endif
Matt Mower031163b2014-11-01 15:13:03 -0500453# Allow devices to specify device-specific recovery dependencies
454ifneq ($(TARGET_RECOVERY_DEVICE_MODULES),)
455 LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_RECOVERY_DEVICE_MODULES)
456endif
Dees Troy3454ade2015-01-20 19:21:04 +0000457LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
458LOCAL_CFLAGS += -DTWHTCD_PATH=\"$(TWHTCD_PATH)\"
Ethan Yonkerb81d9052015-07-09 13:20:53 -0500459ifeq ($(TW_INCLUDE_NTFS_3G),true)
Jason Riordan6c28ee82016-05-12 09:06:57 -0400460ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500461 LOCAL_ADDITIONAL_DEPENDENCIES += \
462 mount.ntfs \
463 fsck.ntfs \
464 mkfs.ntfs
465else
Ethan Yonkerb81d9052015-07-09 13:20:53 -0500466 LOCAL_ADDITIONAL_DEPENDENCIES += \
467 ntfs-3g \
468 ntfsfix \
469 mkntfs
470endif
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500471endif
Matt Mower58294912015-12-10 11:54:28 -0600472ifeq ($(TARGET_USERIMAGES_USE_F2FS), true)
473ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 3; echo $$?),0)
474 LOCAL_ADDITIONAL_DEPENDENCIES += \
475 fsck.f2fs \
476 mkfs.f2fs
477endif
478endif
Matt Mower031163b2014-11-01 15:13:03 -0500479
Matt Mowerd821c962017-02-15 12:36:18 -0600480ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 25; echo $$?),0)
Captain Throwback3184b2f2017-03-07 12:07:40 -0500481 LOCAL_ADDITIONAL_DEPENDENCIES += file_contexts_text
Matt Mowerd821c962017-02-15 12:36:18 -0600482endif
483
Mark Salyzyn13aca592016-03-09 14:58:16 -0800484ifeq ($(BOARD_CACHEIMAGE_PARTITION_SIZE),)
485LOCAL_REQUIRED_MODULES := recovery-persist recovery-refresh
486endif
487
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800488include $(BUILD_EXECUTABLE)
489
Matt Mowerd821c962017-02-15 12:36:18 -0600490# Symlink for file_contexts
491include $(CLEAR_VARS)
492
Captain Throwback3184b2f2017-03-07 12:07:40 -0500493LOCAL_MODULE := file_contexts_text
Matt Mowerd821c962017-02-15 12:36:18 -0600494LOCAL_MODULE_TAGS := optional
Captain Throwback3184b2f2017-03-07 12:07:40 -0500495LOCAL_REQUIRED_MODULES := file_contexts.bin
Matt Mowerd821c962017-02-15 12:36:18 -0600496LOCAL_POST_INSTALL_CMD := \
Captain Throwback3184b2f2017-03-07 12:07:40 -0500497 $(hide) cp -f $(OUT)/obj/ETC/file_contexts.bin_intermediates/file_contexts.concat.tmp $(TARGET_RECOVERY_ROOT_OUT)/file_contexts
Matt Mowerd821c962017-02-15 12:36:18 -0600498
499include $(BUILD_PHONY_PACKAGE)
500
Ethan Yonker5c933692014-04-04 11:26:32 -0500501ifneq ($(TW_USE_TOOLBOX), true)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800502include $(CLEAR_VARS)
Dees_Troyc04dcf72012-10-02 10:46:37 -0400503# Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead
504BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links)
Matt Mower18794c82015-11-11 16:22:45 -0600505exclude := tune2fs mke2fs mkdosfs mkfs.vfat gzip gunzip
Matt Mower81742fb2014-09-01 14:40:52 -0500506
Ethan Yonkera60c7862016-02-25 15:32:06 -0600507# Having /sbin/modprobe present on 32 bit devices with can cause a massive
508# performance problem if the kernel has CONFIG_MODULES=y
509ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
510 ifneq ($(TARGET_ARCH), arm64)
511 ifneq ($(TARGET_ARCH), x86_64)
512 exclude += modprobe
513 endif
514 endif
515endif
516
Matt Mower81742fb2014-09-01 14:40:52 -0500517# If busybox does not have restorecon, assume it does not have SELinux support.
518# Then, let toolbox provide 'ls' so -Z is available to list SELinux contexts.
Matt Mower87413642017-01-17 21:14:46 -0600519ifeq ($(filter restorecon, $(notdir $(BUSYBOX_LINKS))),)
520 exclude += ls
Dees Troy8d66f8b2013-10-08 14:04:55 +0000521endif
Matt Mower81742fb2014-09-01 14:40:52 -0500522
523RECOVERY_BUSYBOX_TOOLS := $(filter-out $(exclude), $(notdir $(BUSYBOX_LINKS)))
524RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/, $(RECOVERY_BUSYBOX_TOOLS))
Dees_Troyc04dcf72012-10-02 10:46:37 -0400525$(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox
526$(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
527 @echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
528 @mkdir -p $(dir $@)
529 @rm -rf $@
530 $(hide) ln -sf $(BUSYBOX_BINARY) $@
531
Matt Mower031163b2014-11-01 15:13:03 -0500532include $(CLEAR_VARS)
533LOCAL_MODULE := busybox_symlinks
534LOCAL_MODULE_TAGS := optional
535LOCAL_ADDITIONAL_DEPENDENCIES := $(RECOVERY_BUSYBOX_SYMLINKS)
Dees Troyb47f28b2014-12-11 17:20:59 +0000536ifneq (,$(filter $(PLATFORM_SDK_VERSION),16 17 18))
537ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
538endif
Matt Mower031163b2014-11-01 15:13:03 -0500539include $(BUILD_PHONY_PACKAGE)
540RECOVERY_BUSYBOX_SYMLINKS :=
541endif # !TW_USE_TOOLBOX
Dees_Troyc04dcf72012-10-02 10:46:37 -0400542
Mark Salyzyn13aca592016-03-09 14:58:16 -0800543# recovery-persist (system partition dynamic executable run after /data mounts)
544# ===============================
Ethan Yonkerf1179622016-08-25 15:32:21 -0500545ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
546 include $(CLEAR_VARS)
Ethan Yonkerd9918b72017-09-15 08:17:42 -0500547 LOCAL_SRC_FILES := \
548 recovery-persist.cpp \
549 rotate_logs.cpp
Ethan Yonkerf1179622016-08-25 15:32:21 -0500550 LOCAL_MODULE := recovery-persist
551 LOCAL_SHARED_LIBRARIES := liblog libbase
552 LOCAL_CFLAGS := -Werror
553 LOCAL_INIT_RC := recovery-persist.rc
554 include $(BUILD_EXECUTABLE)
555endif
Doug Zongker73ae31c2009-12-09 17:01:45 -0800556
Mark Salyzyn13aca592016-03-09 14:58:16 -0800557# recovery-refresh (system partition dynamic executable run at init)
558# ===============================
Ethan Yonkerf1179622016-08-25 15:32:21 -0500559ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
560 include $(CLEAR_VARS)
Ethan Yonkerd9918b72017-09-15 08:17:42 -0500561 LOCAL_SRC_FILES := \
562 recovery-refresh.cpp \
563 rotate_logs.cpp
Ethan Yonkerf1179622016-08-25 15:32:21 -0500564 LOCAL_MODULE := recovery-refresh
Ethan Yonkerd9918b72017-09-15 08:17:42 -0500565 LOCAL_SHARED_LIBRARIES := liblog libbase
Ethan Yonkerf1179622016-08-25 15:32:21 -0500566 LOCAL_CFLAGS := -Werror
567 LOCAL_INIT_RC := recovery-refresh.rc
568 include $(BUILD_EXECUTABLE)
569endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800570
Ethan Yonker34ae4832016-08-24 15:32:18 -0500571# shared libfusesideload
572# ===============================
573include $(CLEAR_VARS)
574LOCAL_SRC_FILES := fuse_sideload.cpp
575LOCAL_CLANG := true
Tao Bao20126e12017-04-26 12:30:46 -0700576LOCAL_CFLAGS := -Wall -Werror
Ethan Yonker34ae4832016-08-24 15:32:18 -0500577LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
578
579LOCAL_MODULE_TAGS := optional
580LOCAL_MODULE := libfusesideload
Ethan Yonkerf1179622016-08-25 15:32:21 -0500581LOCAL_SHARED_LIBRARIES := libcutils libc
Ethan Yonker99af7662016-09-15 14:48:29 -0500582ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
Ethan Yonkerf1179622016-08-25 15:32:21 -0500583 LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
584 LOCAL_SHARED_LIBRARIES += libmincrypttwrp
585 LOCAL_CFLAGS += -DUSE_MINCRYPT
586else
587 LOCAL_SHARED_LIBRARIES += libcrypto
588endif
Ethan Yonker34ae4832016-08-24 15:32:18 -0500589include $(BUILD_SHARED_LIBRARY)
590
Ethan Yonkerecbd3e82017-12-14 14:43:59 -0600591# static libfusesideload
592# =============================== (required to fix build errors in 8.1 due to use by tests)
593include $(CLEAR_VARS)
594LOCAL_SRC_FILES := fuse_sideload.cpp
595LOCAL_CLANG := true
596LOCAL_CFLAGS := -Wall -Werror
597LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
598
599LOCAL_MODULE_TAGS := optional
600LOCAL_MODULE := libfusesideload
601LOCAL_SHARED_LIBRARIES := libcutils libc
602ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
603 LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
604 LOCAL_STATIC_LIBRARIES += libmincrypttwrp
605 LOCAL_CFLAGS += -DUSE_MINCRYPT
606else
607 LOCAL_STATIC_LIBRARIES += libcrypto_static
608endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800609include $(BUILD_STATIC_LIBRARY)
610
Elliott Hughes63a31922016-06-09 17:41:22 -0700611# libmounts (static library)
612# ===============================
613include $(CLEAR_VARS)
614LOCAL_SRC_FILES := mounts.cpp
Tao Bao5f85d1f2017-03-28 21:12:36 -0700615LOCAL_CFLAGS := \
616 -Wall \
617 -Werror
Elliott Hughes63a31922016-06-09 17:41:22 -0700618LOCAL_MODULE := libmounts
Tao Bao5f85d1f2017-03-28 21:12:36 -0700619LOCAL_STATIC_LIBRARIES := libbase
Elliott Hughes63a31922016-06-09 17:41:22 -0700620include $(BUILD_STATIC_LIBRARY)
621
Tao Bao62e0bc72017-04-10 16:55:57 -0700622# librecovery (static library)
623# ===============================
624include $(CLEAR_VARS)
625LOCAL_SRC_FILES := \
626 install.cpp
Tao Baob24510c2017-04-20 17:54:27 -0700627LOCAL_CFLAGS := -Wall -Werror
Tao Bao62e0bc72017-04-10 16:55:57 -0700628LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
Tao Bao25dbe172017-04-12 23:52:20 -0700629
630ifeq ($(AB_OTA_UPDATER),true)
631 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
632endif
633
Tao Bao62e0bc72017-04-10 16:55:57 -0700634LOCAL_MODULE := librecovery
635LOCAL_STATIC_LIBRARIES := \
636 libminui \
Tao Baoda320ac2017-04-10 16:55:57 -0700637 libvintf_recovery \
Tao Bao62e0bc72017-04-10 16:55:57 -0700638 libcrypto_utils \
639 libcrypto \
Elliott Hughese1bb7a52017-06-28 08:00:17 -0700640 libbase \
641 libziparchive \
Tao Bao62e0bc72017-04-10 16:55:57 -0700642
643include $(BUILD_STATIC_LIBRARY)
644
Ethan Yonker34ae4832016-08-24 15:32:18 -0500645# shared libaosprecovery for Apache code
646# ===============================
Dees_Troy2673cec2013-04-02 20:22:16 +0000647include $(CLEAR_VARS)
648
649LOCAL_MODULE := libaosprecovery
Matt Mowerdb220442014-10-31 22:43:59 -0500650LOCAL_MODULE_TAGS := eng optional
Ethan Yonkerf1179622016-08-25 15:32:21 -0500651LOCAL_CFLAGS := -std=gnu++0x
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500652LOCAL_SRC_FILES := adb_install.cpp legacy_property_service.cpp set_metadata.cpp tw_atomic.cpp installcommand.cpp zipwrap.cpp
Ethan Yonker941a8992016-12-05 09:04:30 -0600653LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils libfusesideload libselinux libminzip
654LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
Ethan Yonkerf1179622016-08-25 15:32:21 -0500655ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
Ethan Yonker534d4e02016-08-26 10:05:03 -0500656 LOCAL_SHARED_LIBRARIES += libstdc++ libstlport
Ethan Yonker941a8992016-12-05 09:04:30 -0600657 LOCAL_C_INCLUDES += bionic external/stlport/stlport
Ethan Yonker534d4e02016-08-26 10:05:03 -0500658else
659 LOCAL_SHARED_LIBRARIES += libc++
660endif
661ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
662 LOCAL_SHARED_LIBRARIES += libmincrypttwrp
Ethan Yonker941a8992016-12-05 09:04:30 -0600663 LOCAL_C_INCLUDES += $(LOCAL_PATH)/libmincrypt/includes
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500664 LOCAL_SRC_FILES += verifier24/verifier.cpp verifier24/asn1_decoder.cpp
Ethan Yonkerf1179622016-08-25 15:32:21 -0500665 LOCAL_CFLAGS += -DUSE_OLD_VERIFIER
666else
Ethan Yonker941a8992016-12-05 09:04:30 -0600667 LOCAL_SHARED_LIBRARIES += libcrypto libbase
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500668 LOCAL_SRC_FILES += verifier.cpp asn1_decoder.cpp
Ethan Yonkerf1179622016-08-25 15:32:21 -0500669endif
Tao Baoa92d8fb2017-06-20 18:11:21 -0700670
Ethan Yonker941a8992016-12-05 09:04:30 -0600671ifeq ($(AB_OTA_UPDATER),true)
672 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
673endif
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500674ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
675 LOCAL_SRC_FILES += otautil/ZipUtil.cpp otautil/SysUtil.cpp
676 LOCAL_SHARED_LIBRARIES += libziparchive libext4_utils libcrypto libcrypto_utils
677 LOCAL_STATIC_LIBRARIES += libvintf_recovery libfs_mgr liblogwrap libavb libvintf libtinyxml2 libz
678 LOCAL_WHOLE_STATIC_LIBRARIES +=
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800679else
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500680 LOCAL_CFLAGS += -DUSE_MINZIP
Doug Zongker73ae31c2009-12-09 17:01:45 -0800681endif
Dees_Troy2673cec2013-04-02 20:22:16 +0000682
683include $(BUILD_SHARED_LIBRARY)
684
Kenny Root7a4adb52013-10-09 10:14:35 -0700685# All the APIs for testing
686include $(CLEAR_VARS)
Tao Bao80e46e02015-06-03 10:49:29 -0700687LOCAL_CLANG := true
Kenny Root7a4adb52013-10-09 10:14:35 -0700688LOCAL_MODULE := libverifier
Kenny Root7a4adb52013-10-09 10:14:35 -0700689LOCAL_SRC_FILES := \
Kenny Root7a4adb52013-10-09 10:14:35 -0700690 asn1_decoder.cpp \
Doug Zongker73ae31c2009-12-09 17:01:45 -0800691 verifier.cpp \
692 ui.cpp
Hashcode57332152016-12-20 01:30:49 +0100693LOCAL_STATIC_LIBRARIES := libcrypto_static
Jed Estep43291862016-02-03 17:02:09 -0800694include $(BUILD_STATIC_LIBRARY)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800695
Tao Bao016120f2017-08-02 17:11:04 -0700696# Wear default device
697# ===============================
698include $(CLEAR_VARS)
699LOCAL_SRC_FILES := wear_device.cpp
700
701# Should match TARGET_RECOVERY_UI_LIB in BoardConfig.mk.
702LOCAL_MODULE := librecovery_ui_wear
703
704include $(BUILD_STATIC_LIBRARY)
705
Luke Songa44dba72017-06-12 16:08:33 -0700706# vr headset default device
707# ===============================
708include $(CLEAR_VARS)
709
710LOCAL_SRC_FILES := vr_device.cpp
711
712# should match TARGET_RECOVERY_UI_LIB set in BoardConfig.mk
713LOCAL_MODULE := librecovery_ui_vr
714
715include $(BUILD_STATIC_LIBRARY)
716
Dees_Troy51a0e822012-09-05 15:24:24 -0400717commands_recovery_local_path := $(LOCAL_PATH)
Ethan Yonkerecbd3e82017-12-14 14:43:59 -0600718
Yabin Cui2f272c02016-06-24 18:22:02 -0700719include \
720 $(LOCAL_PATH)/applypatch/Android.mk \
Alex Deymofb00d822016-11-08 15:46:07 -0800721 $(LOCAL_PATH)/boot_control/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700722 $(LOCAL_PATH)/edify/Android.mk \
Jed Estepf1fc48c2015-12-15 16:04:53 -0800723 $(LOCAL_PATH)/otafault/Android.mk \
Kenny Root7a4adb52013-10-09 10:14:35 -0700724 $(LOCAL_PATH)/tests/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700725 $(LOCAL_PATH)/tools/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700726 $(LOCAL_PATH)/updater/Android.mk \
Tao Bao1171d3a2015-12-05 21:21:27 -0800727 $(LOCAL_PATH)/update_verifier/Android.mk \
Ethan Yonkerecbd3e82017-12-14 14:43:59 -0600728 $(LOCAL_PATH)/bootloader_message/Android.mk \
729 $(LOCAL_PATH)/bootloader_message_twrp/Android.mk
Dees_Troy51a0e822012-09-05 15:24:24 -0400730
Matt Mowerf746dbb2015-05-13 22:56:31 -0500731ifeq ($(wildcard system/core/uncrypt/Android.mk),)
732 include $(commands_recovery_local_path)/uncrypt/Android.mk
733endif
734
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500735ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500736 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
737 TARGET_GLOBAL_CFLAGS += -DTW_USE_MINUI_WITH_DATA
738 CLANG_TARGET_GLOBAL_CFLAGS += -DTW_USE_MINUI_WITH_DATA
739 endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500740 include $(commands_recovery_local_path)/minadbd/Android.mk \
741 $(commands_recovery_local_path)/minui/Android.mk
742else
Ethan Yonker84d61ce2017-05-10 16:11:35 -0500743 TARGET_GLOBAL_CFLAGS += -DTW_USE_MINUI_21
744 include $(commands_recovery_local_path)/minadbd21/Android.mk \
745 $(commands_recovery_local_path)/minui21/Android.mk
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500746endif
747
Dees_Troy51a0e822012-09-05 15:24:24 -0400748#includes for TWRP
Dees_Troy930bf012013-08-10 22:19:03 +0000749include $(commands_recovery_local_path)/injecttwrp/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400750 $(commands_recovery_local_path)/htcdumlock/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400751 $(commands_recovery_local_path)/gui/Android.mk \
752 $(commands_recovery_local_path)/mmcutils/Android.mk \
753 $(commands_recovery_local_path)/bmlutils/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400754 $(commands_recovery_local_path)/prebuilt/Android.mk \
755 $(commands_recovery_local_path)/mtdutils/Android.mk \
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500756 $(commands_recovery_local_path)/flashutils/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400757 $(commands_recovery_local_path)/pigz/Android.mk \
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500758 $(commands_recovery_local_path)/libtar/Android.mk \
Dees_Troyb9d88ac2012-09-14 14:34:19 -0400759 $(commands_recovery_local_path)/libcrecovery/Android.mk \
Dees_Troy2673cec2013-04-02 20:22:16 +0000760 $(commands_recovery_local_path)/libblkid/Android.mk \
Dees_Troy83bd4832013-05-04 12:39:56 +0000761 $(commands_recovery_local_path)/minuitwrp/Android.mk \
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500762 $(commands_recovery_local_path)/otautil/Android.mk \
Dees Troy8d66f8b2013-10-08 14:04:55 +0000763 $(commands_recovery_local_path)/openaes/Android.mk \
Ethan Yonkerf1179622016-08-25 15:32:21 -0500764 $(commands_recovery_local_path)/toolbox/Android.mk \
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400765 $(commands_recovery_local_path)/twrpTarMain/Android.mk \
Ethan Yonker738be7a2014-12-10 11:40:43 -0600766 $(commands_recovery_local_path)/mtp/Android.mk \
Ethan Yonker2d11d492014-12-12 11:43:21 -0600767 $(commands_recovery_local_path)/minzip/Android.mk \
Matt Mowerec009e82015-01-30 13:00:49 -0600768 $(commands_recovery_local_path)/dosfstools/Android.mk \
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500769 $(commands_recovery_local_path)/etc/Android.mk \
770 $(commands_recovery_local_path)/toybox/Android.mk \
HashBanged974bb2016-01-30 14:20:09 -0500771 $(commands_recovery_local_path)/simg2img/Android.mk \
bigbiffce8f83c2015-12-12 18:30:21 -0500772 $(commands_recovery_local_path)/adbbu/Android.mk \
Ethan Yonker91758442017-02-03 13:24:31 -0600773 $(commands_recovery_local_path)/libpixelflinger/Android.mk \
bigbiff bigbiff56cf5642016-08-19 17:43:45 -0400774 $(commands_recovery_local_path)/twrpDigest/Android.mk \
Ethan Yonker91758442017-02-03 13:24:31 -0600775 $(commands_recovery_local_path)/attr/Android.mk
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600776
Ethan Yonker534d4e02016-08-26 10:05:03 -0500777ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
Ethan Yonkerf1179622016-08-25 15:32:21 -0500778 include $(commands_recovery_local_path)/libmincrypt/Android.mk
779endif
780
Ethan Yonker253368a2014-11-25 15:00:52 -0600781ifeq ($(TW_INCLUDE_CRYPTO), true)
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600782 include $(commands_recovery_local_path)/crypto/lollipop/Android.mk
Ethan Yonker253368a2014-11-25 15:00:52 -0600783 include $(commands_recovery_local_path)/crypto/scrypt/Android.mk
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600784 ifeq ($(TW_INCLUDE_CRYPTO_FBE), true)
785 include $(commands_recovery_local_path)/crypto/ext4crypt/Android.mk
786 endif
nkk7171c6c502017-01-05 23:55:05 +0200787 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),)
788 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),false)
789 include $(commands_recovery_local_path)/crypto/vold_decrypt/Android.mk
790 endif
791 endif
Ethan Yonker66a19492015-12-10 10:19:45 -0600792 include $(commands_recovery_local_path)/gpt/Android.mk
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600793endif
Vojtech Bocek7cc278b2013-02-24 01:40:19 +0100794ifeq ($(BUILD_ID), GINGERBREAD)
795 TW_NO_EXFAT := true
796endif
Dees_Troyb05ddee2013-01-28 20:24:50 +0000797ifneq ($(TW_NO_EXFAT), true)
Captain Throwback6a1acf22014-09-18 12:46:35 -0400798 include $(commands_recovery_local_path)/exfat/mkfs/Android.mk \
Matt Mower80f7b362015-12-12 15:38:01 -0600799 $(commands_recovery_local_path)/exfat/fsck/Android.mk \
Dees_Troyb05ddee2013-01-28 20:24:50 +0000800 $(commands_recovery_local_path)/fuse/Android.mk \
801 $(commands_recovery_local_path)/exfat/libexfat/Android.mk
Ethan Yonker34741d92016-02-06 13:22:45 -0600802 ifneq ($(TW_NO_EXFAT_FUSE), true)
803 include $(commands_recovery_local_path)/exfat/fuse/Android.mk
804 endif
Captain Throwback6a1acf22014-09-18 12:46:35 -0400805endif
Ethan Yonker03a42f62014-08-08 11:03:51 -0500806ifneq ($(TW_OEM_BUILD),true)
807 include $(commands_recovery_local_path)/orscmd/Android.mk
808endif
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500809
Talustus3019a912013-04-06 11:50:07 +0200810# FB2PNG
811ifeq ($(TW_INCLUDE_FB2PNG), true)
812 include $(commands_recovery_local_path)/fb2png/Android.mk
813endif
Matt Mower55c75ca2014-08-31 11:30:15 -0500814
815commands_recovery_local_path :=
816
817endif