blob: b97116ae19c33925e9c785511af39fb08cafdee0 [file] [log] [blame]
Dees_Troy51a0e822012-09-05 15:24:24 -04001LOCAL_PATH := $(call my-dir)
2
3RELINK := $(LOCAL_PATH)/relink.sh
4
5#dummy file to trigger required modules
6include $(CLEAR_VARS)
bigbiffce8f83c2015-12-12 18:30:21 -05007
Dees_Troy51a0e822012-09-05 15:24:24 -04008LOCAL_MODULE := teamwin
theimpulsond95dcd22020-03-23 18:27:29 +00009LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -040010LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
11LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
12
Matt Mowerfb1c4ff2014-04-16 13:43:36 -050013# Manage list
Dees_Troy51a0e822012-09-05 15:24:24 -040014RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/dump_image
15RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/flash_image
16RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/erase_image
bigbiffce8f83c2015-12-12 18:30:21 -050017RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/bu
bigbiff416fe3a2020-03-28 13:46:48 -040018
bigbiff36f088a2020-04-04 19:58:19 -040019ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
bigbiff416fe3a2020-03-28 13:46:48 -040020 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/sh
bigbiff36f088a2020-04-04 19:58:19 -040021else
22 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sh
bigbiff416fe3a2020-03-28 13:46:48 -040023endif
24RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so
25ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 23; echo $$?),0)
26 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
27 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/grep
bigbiffd58ba182020-03-23 10:02:29 -040028 else
bigbiff416fe3a2020-03-28 13:46:48 -040029 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/grep
bigbiffd58ba182020-03-23 10:02:29 -040030 endif
bigbiff416fe3a2020-03-28 13:46:48 -040031 LOCAL_POST_INSTALL_CMD += $(hide) if [ -e "$(TARGET_RECOVERY_ROOT_OUT)/sbin/egrep" ]; then \
32 rm $(TARGET_RECOVERY_ROOT_OUT)/sbin/egrep; fi; ln -s $(TARGET_RECOVERY_ROOT_OUT)/sbin/grep $(TARGET_RECOVERY_ROOT_OUT)/sbin/egrep; \
33 if [ -e "$(TARGET_RECOVERY_ROOT_OUT)/sbin/fgrep" ]; then \
34 rm $(TARGET_RECOVERY_ROOT_OUT)/sbin/fgrep; fi; ln -s $(TARGET_RECOVERY_ROOT_OUT)/sbin/grep $(TARGET_RECOVERY_ROOT_OUT)/sbin/fgrep;
35 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23; echo $$?),0)
36 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
37 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/dd
bigbiffd58ba182020-03-23 10:02:29 -040038 endif
bigbiff416fe3a2020-03-28 13:46:48 -040039 endif
40 ifneq ($(wildcard external/zip/Android.mk),)
41 RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/zip
42 endif
43 ifneq ($(wildcard external/unzip/Android.mk),)
44 RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/unzip
45 endif
46 ifneq ($(wildcard system/core/libziparchive/Android.bp),)
bigbiff4721a5a2020-04-05 10:32:40 -040047 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
48 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/unzip
49 else
50 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/unzip
51 endif
bigbiff416fe3a2020-03-28 13:46:48 -040052 endif
53 ifneq ($(wildcard external/one-true-awk/Android.bp),)
54 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/awk
Ethan Yonker93382822018-11-01 15:25:31 -050055 endif
Ethan Yonker5c933692014-04-04 11:26:32 -050056endif
bigbiff416fe3a2020-03-28 13:46:48 -040057
Dees_Troy51a0e822012-09-05 15:24:24 -040058RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/pigz
Matt Mower18794c82015-11-11 16:22:45 -060059RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fsck.fat
60RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fatlabel
61RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.fat
nkk7135764fd2017-12-19 12:39:08 +020062ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?),0)
bigbiff416fe3a2020-03-28 13:46:48 -040063 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 29; echo $$?),0)
bigbiffd58ba182020-03-23 10:02:29 -040064 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/adbd
65 else
66 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/adbd
67 endif
nkk7135764fd2017-12-19 12:39:08 +020068endif
Dees_Troy51a0e822012-09-05 15:24:24 -040069RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/e2fsck
dianlujitao4879b372018-12-03 18:45:47 +080070ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
71 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/e2fsdroid
72endif
Dees_Troy51a0e822012-09-05 15:24:24 -040073RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mke2fs
74RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/tune2fs
Ethan Yonkera2719152015-05-28 09:44:41 -050075RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/resize2fs
HashBanged974bb2016-01-30 14:20:09 -050076RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/simg2img
Ethan Yonker4f6a9762015-03-09 13:58:54 -050077ifneq ($(TARGET_ARCH), x86_64)
78 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/linker
79endif
80ifeq ($(TARGET_ARCH), x86_64)
81 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/linker64
82endif
Ethan Yonker1902c792014-12-03 16:48:36 -060083ifeq ($(TARGET_ARCH), arm64)
bigbiffd58ba182020-03-23 10:02:29 -040084 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
85 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/linker64
86 else
87 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/linker64
88 endif
Ethan Yonker1902c792014-12-03 16:48:36 -060089endif
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040090#RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/twrpmtp
bigbiffd58ba182020-03-23 10:02:29 -040091ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
92 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libc.so
93 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libdl.so
94 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libm.so
bigbiffd58ba182020-03-23 10:02:29 -040095 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libbootloader_message.so
96 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libfs_mgr.so
97 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libfscrypt.so
98 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libgsi.so
99 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libkeyutils.so
100 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/liblogwrap.so
101 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/liblp.so
102 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libprocessgroup.so
103 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libprocessgroup_setup.so
104 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libadbd.so
105 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libadbd_services.so
106 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libcap.so
107 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libminijail.so
bigbiff63d7add2020-03-31 18:00:59 -0400108 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libunwindstack.so
bigbiff973167a2020-04-06 15:44:20 -0400109 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libasyncio.so
bigbiff63d7add2020-03-31 18:00:59 -0400110 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT)/../system/lib64/libinit.so
bigbiffd58ba182020-03-23 10:02:29 -0400111 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT)/../system/lib64/libdl_android.so
bigbiff63d7add2020-03-31 18:00:59 -0400112 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT)/../system/lib64/libprotobuf-cpp-lite.so
113 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT)/../system/lib64/libbinder.so
bigbiff36f088a2020-04-04 19:58:19 -0400114 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/toybox
bigbiffd58ba182020-03-23 10:02:29 -0400115else
116 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libc.so
117 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libdl.so
118 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libm.so
119endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400120RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcutils.so
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600121RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrecovery.so
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400122RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libusbhost.so
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400123RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libutils.so
Dees_Troy51a0e822012-09-05 15:24:24 -0400124RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_com_err.so
125RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_e2p.so
126RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2fs.so
127RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_profile.so
128RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_uuid.so
Vladimir Oltean47802862018-07-22 13:31:57 +0300129ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?),0)
130 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_misc.so
131endif
Ethan Yonker38c2ff82014-12-09 13:42:10 -0600132ifneq ($(wildcard external/e2fsprogs/lib/quota/Android.mk),)
133 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_quota.so
134endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500135ifneq ($(wildcard external/e2fsprogs/lib/ext2fs/Android.*),)
Ethan Yonkerbcff1462015-01-04 22:01:33 -0600136 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2fs.so
137endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500138ifneq ($(wildcard external/e2fsprogs/lib/blkid/Android.*),)
Ethan Yonkerbcff1462015-01-04 22:01:33 -0600139 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_blkid.so
140endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200141RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpng.so
Dees_Troy51a0e822012-09-05 15:24:24 -0400142RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblog.so
Dees_Troy51a0e822012-09-05 15:24:24 -0400143RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstdc++.so
144RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libz.so
Dees_Troy2673cec2013-04-02 20:22:16 +0000145RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libminuitwrp.so
146RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libminadbd.so
bigbiffd58ba182020-03-23 10:02:29 -0400147ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
148 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libminzip.so
149endif
Dees_Troy2673cec2013-04-02 20:22:16 +0000150RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmtdutils.so
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500151RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtar.so
bigbiffce8f83c2015-12-12 18:30:21 -0500152RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwadbbu.so
bigbiff bigbiff56cf5642016-08-19 17:43:45 -0400153RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwrpdigest.so
bigbiff7b4c7a62015-01-01 19:44:14 -0500154RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libutil-linux.so
Vojtech Bocek7cc278b2013-02-24 01:40:19 +0100155RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libblkid.so
Dees_Troy51a0e822012-09-05 15:24:24 -0400156RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmmcutils.so
157RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbmlutils.so
158RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libflashutils.so
Ethan Yonker67eb72a2014-11-07 10:44:37 -0600159RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libfusesideload.so
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500160RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbootloader_message_twrp.so
161ifeq ($(PLATFORM_SDK_VERSION), 22)
162 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libc++.so
163endif
Ethan Yonker34ae4832016-08-24 15:32:18 -0500164ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500165 # These libraries are no longer present in M
166 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstlport.so
167 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libgccdemangle.so
168endif
Ethan Yonker534d4e02016-08-26 10:05:03 -0500169ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23; echo $$?),0)
D. Andrei Măceșb29a5e22016-12-22 06:19:44 -0500170
171 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so \
172 $(if $(WITH_CRYPTO_UTILS),$(TARGET_OUT_SHARED_LIBRARIES)/libcrypto_utils.so)
Ethan Yonker34ae4832016-08-24 15:32:18 -0500173 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpackagelistparser.so
174 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblzma.so
175endif
mar-v-in41424082015-03-10 19:06:16 +0100176ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22))
Ethan Yonker75bf0412014-11-21 13:54:27 -0600177 # libraries from lollipop
178 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbacktrace.so
179 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind.so
180 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind-ptrace.so
Vojtech Bocek41ae1242015-01-04 21:57:50 +0100181 # Dynamically loaded by lollipop libc and may prevent unmounting system if it is not present in sbin
182 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libnetd_client.so
Ethan Yonker75bf0412014-11-21 13:54:27 -0600183else
Ethan Yonker34ae4832016-08-24 15:32:18 -0500184 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 23; echo $$?),0)
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500185 # Android M libraries
bigbiff63d7add2020-03-31 18:00:59 -0400186 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
187 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libbacktrace.so
188 else
189 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbacktrace.so
190 endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500191 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind.so
192 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbase.so
193 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libc++.so
194 # Dynamically loaded by libc and may prevent unmounting system if it is not present in sbin
195 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libnetd_client.so
196 else
197 # Not available in lollipop
198 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcorkscrew.so
199 endif
Ethan Yonker75bf0412014-11-21 13:54:27 -0600200endif
Ethan Yonkerf1179622016-08-25 15:32:21 -0500201ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
202 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypttwrp.so
203endif
bigbiffd58ba182020-03-23 10:02:29 -0400204ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
205 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/toolbox
206else
207 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/toolbox
208endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500209
Ethan Yonker03a42f62014-08-08 11:03:51 -0500210ifneq ($(TW_OEM_BUILD),true)
211 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/twrp
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400212else
213 TW_EXCLUDE_MTP := true
214endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500215
216ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400217ifneq ($(TW_EXCLUDE_MTP), true)
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500218 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwrpmtp-ffs.so
Ethan Yonker03a42f62014-08-08 11:03:51 -0500219endif
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -0500220else
221ifneq ($(TW_EXCLUDE_MTP), true)
222 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwrpmtp-legacy.so
223endif
224endif
225
Matt Mower87413642017-01-17 21:14:46 -0600226RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext4_utils.so
Dees_Troy2673cec2013-04-02 20:22:16 +0000227RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libaosprecovery.so
Greg Wallaceace76232016-01-27 17:15:51 -0500228ifneq ($(TW_INCLUDE_JPEG),)
229 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libjpeg.so
230endif
Matt Mower87413642017-01-17 21:14:46 -0600231RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libselinux.so
Vojtech Bocek7cc278b2013-02-24 01:40:19 +0100232ifeq ($(BUILD_ID), GINGERBREAD)
233 TW_NO_EXFAT := true
234endif
Dees_Troyb05ddee2013-01-28 20:24:50 +0000235ifneq ($(TW_NO_EXFAT), true)
Dees_Troyb05ddee2013-01-28 20:24:50 +0000236 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkexfatfs
Matt Mower80f7b362015-12-12 15:38:01 -0600237 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fsck.exfat
Ethan Yonkerdc3bc462015-12-08 15:12:40 -0600238 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libexfat_twrp.so
Dees Troyb4bd6972014-10-09 18:47:00 +0000239else
Captain Throwback6a1acf22014-09-18 12:46:35 -0400240 TW_NO_EXFAT_FUSE := true
241endif
242ifneq ($(TW_NO_EXFAT_FUSE), true)
243 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/exfat-fuse
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500244endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400245ifeq ($(TW_INCLUDE_BLOBPACK), true)
246 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/blobpack
247endif
248ifeq ($(TW_INCLUDE_INJECTTWRP), true)
249 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/injecttwrp
250endif
251ifeq ($(TW_INCLUDE_DUMLOCK), true)
252 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/htcdumlock
253endif
254ifeq ($(TW_INCLUDE_CRYPTO), true)
Ethan Yonker98661c12018-10-17 08:39:28 -0500255 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcryptfsfde.so
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600256 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600257 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhardware.so
Ethan Yonker66a19492015-12-10 10:19:45 -0600258 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libgpt_twrp.so
Dees Troyc657cc02015-01-16 22:48:47 +0000259 ifeq ($(TARGET_HW_DISK_ENCRYPTION),true)
Ethan Yonkerdcd9f3f2017-06-05 09:23:34 -0500260 ifeq ($(TARGET_CRYPTFS_HW_PATH),)
261 RELINK_SOURCE_FILES += $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/libcryptfs_hw.so
262 else
263 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcryptfs_hw.so
264 endif
Dees Troyc657cc02015-01-16 22:48:47 +0000265 endif
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600266 # FBE files
267 ifeq ($(TW_INCLUDE_CRYPTO_FBE), true)
268 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libe4crypt.so
269 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libgatekeeper.so
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600270 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_messages.so
271 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeystore_binder.so
272 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbinder.so
273 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-lite.so
274 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsoftkeymasterdevice.so
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500275 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
276 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.gatekeeper@1.0.so
277 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/hwservicemanager
278 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/avbctl
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500279 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/keystore
280 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/keystore_cli
281 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/servicemanager
282 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.system.wifi.keystore@1.0.so
Ethan Yonker31344a32017-11-29 12:13:41 -0600283 ifneq ($(wildcard system/keymaster/keymaster_stl.cpp),)
284 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_portable.so
285 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_staging.so
286 endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500287 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libwifikeystorehal.so
Ethan Yonker31344a32017-11-29 12:13:41 -0600288 ifneq ($(wildcard hardware/interfaces/weaver/Android.bp),)
289 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.weaver@1.0.so
290 endif
Ethan Yonker6b3bdfd2018-12-21 11:54:26 -0600291 ifneq ($(wildcard hardware/interfaces/weaver/1.0/Android.bp),)
292 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.weaver@1.0.so
293 endif
Andreas Schneiderb0a0dbb2018-11-25 16:56:04 +0100294 ifneq ($(wildcard hardware/interfaces/confirmationui/1.0/Android.bp),)
295 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.confirmationui@1.0.so
296 endif
297
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500298 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhardware_legacy.so
299 else
300 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster1.so
301 endif
Ethan Yonker58f21322018-08-24 11:17:36 -0500302 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 28; echo $$?),0)
303 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsoftkeymaster.so
304 endif
Ethan Yonkere9afc3d2018-08-30 15:16:27 -0500305 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
306 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.keymaster@4.0.so
307 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster4support.so
308 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeystore_aidl.so
309 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeystore_parcelables.so
310 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libutilscallstack.so
311 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwindstack.so
312 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libdexfile.so
313 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libservices.so
314 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_portable.so
315 endif
Ethan Yonker93382822018-11-01 15:25:31 -0500316 # lshal can be useful for seeing if you have things like the keymaster working properly, but it isn't needed for TWRP to work
317 #RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/lshal
318 #RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblshal.so
319 #RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libssl.so
320 #RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidl-gen-hash.so
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600321 endif
Ethan Yonker4eca40d2014-11-11 14:52:28 -0600322endif
Ethan Yonker1b190162016-12-05 15:25:19 -0600323ifeq ($(AB_OTA_UPDATER), true)
mauronofriocb163e02020-03-30 16:46:35 +0200324 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/update_engine_sideload
bigbiff bigbiffc630cee2019-01-03 20:14:06 -0500325 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.boot@1.0.so
Ethan Yonker1b190162016-12-05 15:25:19 -0600326 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/bootctl
327 ifneq ($(TW_INCLUDE_CRYPTO), true)
328 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhardware.so
329 endif
330endif
Dees_Troy38bd7602012-09-14 13:33:53 -0400331ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500332 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 28; echo $$?),0)
333 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/make_ext4fs
334 endif
Dees_Troy38bd7602012-09-14 13:33:53 -0400335endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500336ifneq ($(wildcard system/core/libsparse/Android.*),)
Dees_Troy4546fe72013-01-10 14:33:27 +0000337 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsparse.so
338endif
Dees_Troy83bd4832013-05-04 12:39:56 +0000339ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
340 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/openaes
341 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libopenaes.so
342endif
Dees_Troye5017042013-08-29 16:38:55 +0000343ifeq ($(TARGET_USERIMAGES_USE_F2FS), true)
Matt Mower58294912015-12-10 11:54:28 -0600344 ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 4; echo $$?),0)
345 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs
346 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libf2fs.so
nkk7104ec0952017-10-25 14:09:37 +0300347 else ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
bigbiffd58ba182020-03-23 10:02:29 -0400348 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
349 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/make_f2fs
350 else
351 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.f2fs
352 endif
Ethan Yonker93382822018-11-01 15:25:31 -0500353 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
bigbiffd58ba182020-03-23 10:02:29 -0400354 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
355 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sload_f2fs
356 else
357 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/sload.f2fs
358 endif
Ethan Yonker93382822018-11-01 15:25:31 -0500359 endif
TheStrix09e86932017-02-22 04:48:25 +0530360 else ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
361 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs
362 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libf2fs.so
maxwene7c88562017-01-23 18:36:35 +0100363 else ifeq ($(shell test $(PLATFORM_SDK_VERSION) -eq 23; echo $$?),0)
Ethan Yonker5235f552015-10-09 14:46:47 -0500364 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.f2fs
Matt Mower58294912015-12-10 11:54:28 -0600365 else ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22))
366 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT_SBIN)/mkfs.f2fs
Ethan Yonker75bf0412014-11-21 13:54:27 -0600367 else
Matt Mower58294912015-12-10 11:54:28 -0600368 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs
Ethan Yonker75bf0412014-11-21 13:54:27 -0600369 endif
Dees_Troye5017042013-08-29 16:38:55 +0000370 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fsck.f2fs
Dees_Troye5017042013-08-29 16:38:55 +0000371endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500372ifneq ($(wildcard system/core/reboot/Android.*),)
Mohd Faraz784073e2020-05-11 01:16:29 +0530373 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
374 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/reboot
375 else
376 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/reboot
377 endif
Dees Troy0226cd52013-11-04 14:12:35 +0000378endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200379ifneq ($(TW_DISABLE_TTF), true)
380 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libft2.so
381endif
Ethan Yonker0e678372014-11-18 12:17:06 -0600382ifneq ($(TW_RECOVERY_ADDITIONAL_RELINK_FILES),)
383 RELINK_SOURCE_FILES += $(TW_RECOVERY_ADDITIONAL_RELINK_FILES)
384endif
Dees Troye176a652015-01-20 19:35:21 +0000385ifneq ($(wildcard external/pcre/Android.mk),)
386 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcre.so
387endif
Ethan Yonkerb81d9052015-07-09 13:20:53 -0500388ifeq ($(TW_INCLUDE_NTFS_3G),true)
Jason Riordan6c28ee82016-05-12 09:06:57 -0400389ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500390 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mount.ntfs
391 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fsck.ntfs
392 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.ntfs
393 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libntfs-3g.so
bigbiff bigbiff52f868b2019-05-05 16:13:08 -0400394 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
395 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libfuse-lite.so
396 else
397 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libfuse.so
398 endif
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500399else
Ethan Yonkerb81d9052015-07-09 13:20:53 -0500400 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/ntfs-3g
401 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/ntfsfix
402 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkntfs
403endif
Greg Wallaceb39e6c62015-12-29 00:55:26 -0500404endif
Ethan Yonker483e9f42016-01-11 22:21:18 -0600405ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
406 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
407 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sgdisk
408 endif
409endif
Captain Throwback1f127752016-01-19 17:30:20 -0500410ifeq ($(TWRP_INCLUDE_LOGCAT), true)
bigbiff63d7add2020-03-31 18:00:59 -0400411 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
412 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT)/../system/bin/logcat
413 else
414 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/logcat
415 endif
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600416 ifeq ($(TARGET_USES_LOGD), true)
bigbiff63d7add2020-03-31 18:00:59 -0400417 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
418 RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT)/../system/bin/logd
419 else
420 RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/logd
421 endif
Ethan Yonkere5a288c2016-02-15 09:23:57 -0600422 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsysutils.so
423 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libnl.so
424 endif
Ethan Yonker534d4e02016-08-26 10:05:03 -0500425 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
426 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcrecpp.so
427 endif
Ethan Yonkerd9918b72017-09-15 08:17:42 -0500428 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
429 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblogcat.so
430 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcap.so
431 endif
Captain Throwback1f127752016-01-19 17:30:20 -0500432endif
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500433ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
434 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcre2.so
435 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libvndksupport.so
436 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhwbinder.so
437 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidlbase.so
438 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidltransport.so
439 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.keymaster@3.0.so
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500440 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libziparchive.so
Ethan Yonkerc3c0e642017-09-11 21:39:57 -0500441 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_blkid.so
442 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_quota.so
Ethan Yonkerfefe5912017-09-30 22:22:13 -0500443
444 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidl-gen-utils.so
445 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libvintf.so
446 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtinyxml2.so
447 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hidl.token@1.0.so
Ethan Yonker31344a32017-11-29 12:13:41 -0600448 ifneq ($(wildcard system/core/libkeyutils/Android.bp),)
449 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeyutils.so
450 endif
Ethan Yonkeraac05c22017-12-12 07:04:05 -0600451 ifeq ($(wildcard system/libhidl/transport/HidlTransportUtils.cpp),)
452 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hidl.base@1.0.so
453 endif
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500454endif
Ethan Yonker58f21322018-08-24 11:17:36 -0500455ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27; echo $$?),0)
lambdadroideff335d2018-09-26 22:42:05 +0200456 ifeq ($(TARGET_ARCH), arm64)
457 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.ubsan_standalone-aarch64-android.so
458 endif
Simon Shie6825982019-03-09 00:57:04 +0800459 ifeq ($(TARGET_ARCH), arm)
460 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.ubsan_standalone-arm-android.so
461 endif
462 ifeq ($(TARGET_ARCH), x86_64)
463 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.ubsan_standalone-x86_64-android.so
464 endif
465 ifeq ($(TARGET_ARCH), x86)
466 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.ubsan_standalone-i686-android.so
467 endif
468 ifeq ($(TARGET_ARCH), mips)
469 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.ubsan_standalone-mips-android.so
470 endif
471 ifeq ($(TARGET_ARCH), mips64)
472 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.ubsan_standalone-mips64-android.so
473 endif
Ethan Yonker58f21322018-08-24 11:17:36 -0500474 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblogwrap.so
Ethan Yonker93382822018-11-01 15:25:31 -0500475 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_misc.so
Ethan Yonker58f21322018-08-24 11:17:36 -0500476endif
477
bigbiff416fe3a2020-03-28 13:46:48 -0400478#toybox links
479toybox_links := acpi base64 basename bc blockdev cal cat chcon chgrp chmod chown chroot chrt cksum clear \
480 cmp comm cp cpio cut date dd devmem df diff dirname dmesg dos2unix du echo env expand expr fallocate \
481 false file find flock fmt free fsync getconf getenforce groups gunzip gzip head hostname hwclock i2cdetect \
482 i2cdump i2cget i2cset iconv id ifconfig inotifyd insmod install ionice iorenice kill killall ln load_policy \
483 log logname losetup ls lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod mkswap mktemp modinfo modprobe \
484 more mount mountpoint mv nc netcat netstat nice nl nohup nproc nsenter od paste patch pgrep pidof pkill pmap \
485 printenv printf ps pwd readlink realpath renice restorecon rm rmdir rmmod runcon sed sendevent seq setenforce \
486 setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort split start stat stop strings stty \
bigbiff36f088a2020-04-04 19:58:19 -0400487 swapoff swapon sync sysctl tac tail tar taskset tee time timeout top touch tr true truncate tty ulimit \
bigbiff416fe3a2020-03-28 13:46:48 -0400488 umount uname uniq unix2dos unlink unshare uptime usleep uudecode uuencode uuidgen vmstat watch wc which whoami \
489 xargs xxd yes zcat
490TOYBOX_LINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/system/bin/, $(toybox_links))
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500491
bigbiff416fe3a2020-03-28 13:46:48 -0400492#relink recovery executables linker to /sbin and move symlinks
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500493include $(CLEAR_VARS)
bigbiffd58ba182020-03-23 10:02:29 -0400494LOCAL_MODULE := relink
495LOCAL_MODULE_TAGS := optional
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500496LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
497LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
bigbiff416fe3a2020-03-28 13:46:48 -0400498LOCAL_POST_INSTALL_CMD += $(RELINK) $(TARGET_RECOVERY_ROOT_OUT)/sbin $(RELINK_SOURCE_FILES) && \
499 mv $(TOYBOX_LINKS) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
bigbiffbb5d6682020-05-19 14:45:24 -0400500LOCAL_REQUIRED_MODULES := linker adbd libdl_android toybox libtar
bigbiffd58ba182020-03-23 10:02:29 -0400501include $(BUILD_PHONY_PACKAGE)
502
503#relink init
504include $(CLEAR_VARS)
505LOCAL_MODULE := relink_init
506LOCAL_MODULE_TAGS := optional
507LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
508LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)
509RELINK_INIT := $(TARGET_RECOVERY_ROOT_OUT)/system/bin/init
bigbiff973167a2020-04-06 15:44:20 -0400510LOCAL_POST_INSTALL_CMD += $(RELINK) $(TARGET_RECOVERY_ROOT_OUT)/ $(RELINK_INIT) && \
511 mv $(TARGET_RECOVERY_ROOT_OUT)/system/bin/ueventd $(TARGET_RECOVERY_ROOT_OUT)/sbin/ && \
512 ln -sf /init $(TARGET_RECOVERY_ROOT_OUT)/sbin/init && \
513 ln -sf /init $(TARGET_RECOVERY_ROOT_OUT)/system/bin/init
Mohd Faraz784073e2020-05-11 01:16:29 +0530514LOCAL_REQUIRED_MODULES := init_second_stage.recovery reboot.recovery
bigbiffd58ba182020-03-23 10:02:29 -0400515include $(BUILD_PHONY_PACKAGE)
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500516
Dees_Troy51a0e822012-09-05 15:24:24 -0400517#mke2fs.conf
Michael Bestas9bb7c222018-07-13 23:12:29 +0300518ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
519 include $(CLEAR_VARS)
520 LOCAL_MODULE := mke2fs.conf
theimpulsond95dcd22020-03-23 18:27:29 +0000521 LOCAL_MODULE_TAGS := optional
Michael Bestas9bb7c222018-07-13 23:12:29 +0300522 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
523 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/etc
524 LOCAL_SRC_FILES := $(LOCAL_MODULE)
525 include $(BUILD_PREBUILT)
526endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400527
528ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
Ethan Yonker483e9f42016-01-11 22:21:18 -0600529 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
530 #prebuilt, static sgdisk
531 include $(CLEAR_VARS)
532 LOCAL_MODULE := sgdisk_static
533 LOCAL_MODULE_STEM := sgdisk
theimpulsond95dcd22020-03-23 18:27:29 +0000534 LOCAL_MODULE_TAGS := optional
Ethan Yonker483e9f42016-01-11 22:21:18 -0600535 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
536 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
537 LOCAL_SRC_FILES := $(LOCAL_MODULE)
538 include $(BUILD_PREBUILT)
539 endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400540 #parted
Ethan Yonker483e9f42016-01-11 22:21:18 -0600541 #include $(CLEAR_VARS)
542 #LOCAL_MODULE := parted
theimpulsond95dcd22020-03-23 18:27:29 +0000543 #LOCAL_MODULE_TAGS := optional
Ethan Yonker483e9f42016-01-11 22:21:18 -0600544 #LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
545 #LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
546 #LOCAL_SRC_FILES := $(LOCAL_MODULE)
547 #include $(BUILD_PREBUILT)
Dees_Troy51a0e822012-09-05 15:24:24 -0400548endif
549
Dees_Troy83bd4832013-05-04 12:39:56 +0000550# copy license file for OpenAES
551ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
552 include $(CLEAR_VARS)
Ethan Yonker34ae4832016-08-24 15:32:18 -0500553 LOCAL_MODULE := openaes_license
theimpulsond95dcd22020-03-23 18:27:29 +0000554 LOCAL_MODULE_TAGS := optional
Dees_Troy83bd4832013-05-04 12:39:56 +0000555 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
556 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/license/openaes
Ethan Yonker34ae4832016-08-24 15:32:18 -0500557 LOCAL_SRC_FILES := ../openaes/LICENSE
Dees_Troy83bd4832013-05-04 12:39:56 +0000558 include $(BUILD_PREBUILT)
559endif
560
Dees_Troy51a0e822012-09-05 15:24:24 -0400561ifeq ($(TW_INCLUDE_DUMLOCK), true)
562 #htcdumlock for /system for dumlock
563 include $(CLEAR_VARS)
564 LOCAL_MODULE := htcdumlocksys
theimpulsond95dcd22020-03-23 18:27:29 +0000565 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400566 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000567 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400568 LOCAL_SRC_FILES := $(LOCAL_MODULE)
569 include $(BUILD_PREBUILT)
570
571 #flash_image for /system for dumlock
572 include $(CLEAR_VARS)
573 LOCAL_MODULE := flash_imagesys
theimpulsond95dcd22020-03-23 18:27:29 +0000574 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400575 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000576 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400577 LOCAL_SRC_FILES := $(LOCAL_MODULE)
578 include $(BUILD_PREBUILT)
579
580 #dump_image for /system for dumlock
581 include $(CLEAR_VARS)
582 LOCAL_MODULE := dump_imagesys
theimpulsond95dcd22020-03-23 18:27:29 +0000583 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400584 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000585 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400586 LOCAL_SRC_FILES := $(LOCAL_MODULE)
587 include $(BUILD_PREBUILT)
588
589 #libbmlutils for /system for dumlock
590 include $(CLEAR_VARS)
591 LOCAL_MODULE := libbmlutils.so
theimpulsond95dcd22020-03-23 18:27:29 +0000592 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400593 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000594 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400595 LOCAL_SRC_FILES := $(LOCAL_MODULE)
596 include $(BUILD_PREBUILT)
597
598 #libflashutils for /system for dumlock
599 include $(CLEAR_VARS)
600 LOCAL_MODULE := libflashutils.so
theimpulsond95dcd22020-03-23 18:27:29 +0000601 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400602 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000603 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400604 LOCAL_SRC_FILES := $(LOCAL_MODULE)
605 include $(BUILD_PREBUILT)
606
607 #libmmcutils for /system for dumlock
608 include $(CLEAR_VARS)
609 LOCAL_MODULE := libmmcutils.so
theimpulsond95dcd22020-03-23 18:27:29 +0000610 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400611 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000612 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400613 LOCAL_SRC_FILES := $(LOCAL_MODULE)
614 include $(BUILD_PREBUILT)
615
616 #libmtdutils for /system for dumlock
617 include $(CLEAR_VARS)
618 LOCAL_MODULE := libmtdutils.so
theimpulsond95dcd22020-03-23 18:27:29 +0000619 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400620 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000621 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400622 LOCAL_SRC_FILES := $(LOCAL_MODULE)
623 include $(BUILD_PREBUILT)
624
625 #HTCDumlock.apk
626 include $(CLEAR_VARS)
627 LOCAL_MODULE := HTCDumlock.apk
theimpulsond95dcd22020-03-23 18:27:29 +0000628 LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400629 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000630 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400631 LOCAL_SRC_FILES := $(LOCAL_MODULE)
632 include $(BUILD_PREBUILT)
633endif
Dees_Troy6ef66352013-02-21 08:26:57 -0600634
bigbiff416fe3a2020-03-28 13:46:48 -0400635ifeq ($(TW_USE_TOOLBOX), true)
636 include $(CLEAR_VARS)
637 LOCAL_MODULE := mkshrc_twrp
638 LOCAL_MODULE_STEM := mkshrc
639 LOCAL_MODULE_TAGS := optional
640 LOCAL_MODULE_CLASS := ETC
641 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/etc
642 LOCAL_SRC_FILES := $(LOCAL_MODULE)
643 include $(BUILD_PREBUILT)
644endif
Captain Throwback5ab59642019-02-07 17:22:49 -0500645
Ethan Yonkerb4bff5e2016-12-16 07:47:58 -0600646#TWRP App "placeholder"
647include $(CLEAR_VARS)
648LOCAL_MODULE := me.twrp.twrpapp.apk
theimpulsond95dcd22020-03-23 18:27:29 +0000649LOCAL_MODULE_TAGS := optional
Ethan Yonkerb4bff5e2016-12-16 07:47:58 -0600650LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
651LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
652LOCAL_SRC_FILES := $(LOCAL_MODULE)
653include $(BUILD_PREBUILT)
nijel82c821a82018-12-29 04:56:41 -0500654
Stefan Tauner6ad14572020-01-11 22:28:53 +0100655#TWRP App permissions for Android 9+
656include $(CLEAR_VARS)
657LOCAL_MODULE := privapp-permissions-twrpapp.xml
658LOCAL_MODULE_TAGS := eng
659LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
660LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
661LOCAL_SRC_FILES := $(LOCAL_MODULE)
662include $(BUILD_PREBUILT)
663
nijel82c821a82018-12-29 04:56:41 -0500664ifeq ($(TW_INCLUDE_CRYPTO), true)
665 ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),)
666 ifneq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
667 # Prebuilt vdc_pie for pre-Pie SDK Platforms
668 include $(CLEAR_VARS)
669 LOCAL_MODULE := vdc_pie
theimpulsond95dcd22020-03-23 18:27:29 +0000670 LOCAL_MODULE_TAGS := optional
nijel82c821a82018-12-29 04:56:41 -0500671 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
672 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
673 LOCAL_SRC_FILES := vdc_pie-$(TARGET_ARCH)
674 include $(BUILD_PREBUILT)
675 endif
676 endif
677endif
Ethan Yonker53796e72019-01-11 22:49:52 -0600678
Chaosmaster461e39f2020-02-07 01:48:13 +0100679ifneq (,$(filter $(TW_INCLUDE_REPACKTOOLS) $(TW_INCLUDE_RESETPROP) $(TW_INCLUDE_LIBRESETPROP), true))
Ethan Yonker53796e72019-01-11 22:49:52 -0600680 ifeq ($(wildcard external/magisk-prebuilt/Android.mk),)
mauronofrio76ef9f32019-12-23 20:29:24 +0100681 $(warning Magisk prebuilt tools not found!)
Ethan Yonker53796e72019-01-11 22:49:52 -0600682 $(warning Please place https://github.com/TeamWin/external_magisk-prebuilt)
683 $(warning into external/magisk-prebuilt)
684 $(error magiskboot prebuilts not present; exiting)
685 endif
686endif