blob: 4cc8b419d3035c08f8aa00aa38d8606a87946d41 [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
20 endif
21else
22 ifeq ($(LOCAL_PATH),bootable/recovery)
23 PROJECT_PATH_AGREES := true
24 endif
Matt Mower55c75ca2014-08-31 11:30:15 -050025endif
26
Matt Mower66766fe2014-10-06 18:03:39 -050027ifeq ($(PROJECT_PATH_AGREES),true)
Matt Mower55c75ca2014-08-31 11:30:15 -050028
Motorhead199175b6f662014-06-12 15:58:33 -070029include $(CLEAR_VARS)
30
Dees_Troy51a0e822012-09-05 15:24:24 -040031TARGET_RECOVERY_GUI := true
Joe Onorato6396e702012-05-31 23:21:46 -070032
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080033LOCAL_SRC_FILES := \
Dees_Troy2673cec2013-04-02 20:22:16 +000034 twrp.cpp \
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040035 fixPermissions.cpp \
bigbiff bigbiff9c754052013-01-09 09:09:08 -050036 twrpTar.cpp \
bigbiff bigbiff34684ff2013-12-01 21:03:45 -050037 twrpDU.cpp \
bigbiff bigbiffcdcfee42013-02-27 21:11:26 -050038 twrpDigest.cpp \
Ethan Yonker1b7a31b2014-07-03 15:09:22 -050039 find_file.cpp \
40 infomanager.cpp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080041
Dees_Troy51a0e822012-09-05 15:24:24 -040042LOCAL_SRC_FILES += \
Dees_Troy51a0e822012-09-05 15:24:24 -040043 data.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040044 partition.cpp \
45 partitionmanager.cpp \
Dees_Troy32c8eb82012-09-11 15:28:06 -040046 twinstall.cpp \
Dees_Troy812660f2012-09-20 09:55:17 -040047 twrp-functions.cpp \
Dees_Troye34c1332013-02-06 19:13:00 +000048 openrecoveryscript.cpp \
49 tarWrite.c
Dees_Troy51a0e822012-09-05 15:24:24 -040050
Dees_Troya58bead2012-09-27 09:49:29 -040051ifneq ($(TARGET_RECOVERY_REBOOT_SRC),)
Dees_Troy51a0e822012-09-05 15:24:24 -040052 LOCAL_SRC_FILES += $(TARGET_RECOVERY_REBOOT_SRC)
53endif
54
Doug Zongker18a78e02014-07-10 07:31:46 -070055include $(CLEAR_VARS)
56
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080057LOCAL_SRC_FILES := \
58 recovery.cpp \
59 bootloader.cpp \
60 install.cpp \
61 roots.cpp \
62 ui.cpp \
63 screen_ui.cpp \
Kenny Root7a4adb52013-10-09 10:14:35 -070064 asn1_decoder.cpp \
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080065 verifier.cpp \
Doug Zongker945fc682014-07-10 10:50:39 -070066 adb_install.cpp \
67 fuse_sdcard_provider.c
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080068
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080069LOCAL_MODULE := recovery
70
Dees_Troy51a0e822012-09-05 15:24:24 -040071#LOCAL_FORCE_STATIC_EXECUTABLE := true
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080072
Ethan Yonkera1674162014-11-06 08:35:10 -060073#ifeq ($(HOST_OS),linux)
74#LOCAL_REQUIRED_MODULES := mkfs.f2fs
75#endif
JP Abgrall37aedb32014-06-16 19:07:39 -070076
Doug Zongkere08991e2010-02-02 13:09:52 -080077RECOVERY_API_VERSION := 3
Ken Sumrallf35d1ce2013-02-13 12:59:35 -080078RECOVERY_FSTAB_VERSION := 2
Doug Zongkerfb2e3af2009-06-17 17:29:40 -070079LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
Doug Zongker0d32f252014-02-13 15:07:56 -080080LOCAL_CFLAGS += -Wno-unused-parameter
Doug Zongkerfb2e3af2009-06-17 17:29:40 -070081
Dees_Troy51a0e822012-09-05 15:24:24 -040082#LOCAL_STATIC_LIBRARIES := \
Dees_Troy1669f892013-09-04 18:35:08 +000083# libext4_utils_static \
84# libsparse_static \
Dees_Troy51a0e822012-09-05 15:24:24 -040085# libminzip \
Dees_Troy1669f892013-09-04 18:35:08 +000086# libz \
Dees_Troy51a0e822012-09-05 15:24:24 -040087# libmtdutils \
88# libmincrypt \
89# libminadbd \
Dees_Troy1669f892013-09-04 18:35:08 +000090# libminui \
91# libpixelflinger_static \
92# libpng \
93# libfs_mgr \
94# libcutils \
95# liblog \
96# libselinux \
97# libstdc++ \
98# libm \
99# libc
Dees_Troy51a0e822012-09-05 15:24:24 -0400100
101LOCAL_C_INCLUDES += bionic external/stlport/stlport
102
103LOCAL_STATIC_LIBRARIES :=
104LOCAL_SHARED_LIBRARIES :=
105
Dees_Troy2673cec2013-04-02 20:22:16 +0000106LOCAL_STATIC_LIBRARIES += libcrecovery libguitwrp
Ethan Yonker1702eb42014-11-06 09:16:16 -0600107LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libminzip libaosprecovery
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400108LOCAL_SHARED_LIBRARIES += libgccdemangle
Doug Zongker49c73a72010-06-29 17:36:28 -0700109
Dees_Troy4546fe72013-01-10 14:33:27 +0000110ifneq ($(wildcard system/core/libsparse/Android.mk),)
111LOCAL_SHARED_LIBRARIES += libsparse
112endif
113
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500114ifeq ($(TW_OEM_BUILD),true)
115 LOCAL_CFLAGS += -DTW_OEM_BUILD
116 BOARD_HAS_NO_REAL_SDCARD := true
117 TW_USE_TOOLBOX := true
118 TW_EXCLUDE_SUPERSU := true
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400119 TW_EXCLUDE_MTP := true
Ethan Yonker7af51ce2014-04-04 13:33:30 -0500120endif
Doug Zongker49c73a72010-06-29 17:36:28 -0700121ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
Joe Onorato6396e702012-05-31 23:21:46 -0700122 LOCAL_CFLAGS += -DUSE_EXT4
123 LOCAL_C_INCLUDES += system/extras/ext4_utils
Dees_Troya95f55c2013-08-17 13:14:43 +0000124 LOCAL_SHARED_LIBRARIES += libext4_utils
Doug Zongker49c73a72010-06-29 17:36:28 -0700125endif
Dees Troy4bf3b0d2013-09-11 19:12:49 +0000126ifneq ($(wildcard external/libselinux/Android.mk),)
127 TWHAVE_SELINUX := true
128endif
129ifeq ($(TWHAVE_SELINUX), true)
Dees_Troy2673cec2013-04-02 20:22:16 +0000130 #LOCAL_C_INCLUDES += external/libselinux/include
131 #LOCAL_STATIC_LIBRARIES += libselinux
132 #LOCAL_CFLAGS += -DHAVE_SELINUX -g
Stephen Smalley1a114492012-01-13 07:59:51 -0500133endif # HAVE_SELINUX
Dees Troy4bf3b0d2013-09-11 19:12:49 +0000134ifeq ($(TWHAVE_SELINUX), true)
Dees_Troyf2280ff2013-08-06 18:01:12 +0000135 LOCAL_C_INCLUDES += external/libselinux/include
Dees_Troya95f55c2013-08-17 13:14:43 +0000136 LOCAL_SHARED_LIBRARIES += libselinux
Dees_Troyf2280ff2013-08-06 18:01:12 +0000137 LOCAL_CFLAGS += -DHAVE_SELINUX -g
Dees_Troya95f55c2013-08-17 13:14:43 +0000138 ifneq ($(TARGET_USERIMAGES_USE_EXT4), true)
139 LOCAL_CFLAGS += -DUSE_EXT4
140 LOCAL_C_INCLUDES += system/extras/ext4_utils
141 LOCAL_SHARED_LIBRARIES += libext4_utils
142 endif
Dees_Troyf2280ff2013-08-06 18:01:12 +0000143endif
Doug Zongker49c73a72010-06-29 17:36:28 -0700144
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800145# This binary is in the recovery ramdisk, which is otherwise a copy of root.
146# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
147# a (redundant) copy of the binary in /system/bin for user builds.
148# TODO: Build the ramdisk image in a more principled way.
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800149LOCAL_MODULE_TAGS := eng
150
Dees_Troy1669f892013-09-04 18:35:08 +0000151#ifeq ($(TARGET_RECOVERY_UI_LIB),)
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700152 LOCAL_SRC_FILES += default_device.cpp
Dees_Troy1669f892013-09-04 18:35:08 +0000153#else
154# LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UI_LIB)
155#endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800156
Doug Zongkercc8cd3f2010-09-20 12:16:13 -0700157LOCAL_C_INCLUDES += system/extras/ext4_utils
158
Dees_Troy51a0e822012-09-05 15:24:24 -0400159#TWRP Build Flags
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400160ifeq ($(TW_EXCLUDE_MTP),)
161 LOCAL_SHARED_LIBRARIES += libtwrpmtp
162 LOCAL_CFLAGS += -DTW_HAS_MTP
163endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -0700164ifneq ($(TW_NO_SCREEN_TIMEOUT),)
165 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
166endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400167ifeq ($(BOARD_HAS_NO_REAL_SDCARD), true)
168 LOCAL_CFLAGS += -DBOARD_HAS_NO_REAL_SDCARD
169endif
170ifneq ($(SP1_NAME),)
171 LOCAL_CFLAGS += -DSP1_NAME=$(SP1_NAME) -DSP1_BACKUP_METHOD=$(SP1_BACKUP_METHOD) -DSP1_MOUNTABLE=$(SP1_MOUNTABLE)
172endif
173ifneq ($(SP1_DISPLAY_NAME),)
174 LOCAL_CFLAGS += -DSP1_DISPLAY_NAME=$(SP1_DISPLAY_NAME)
175endif
176ifneq ($(SP2_NAME),)
177 LOCAL_CFLAGS += -DSP2_NAME=$(SP2_NAME) -DSP2_BACKUP_METHOD=$(SP2_BACKUP_METHOD) -DSP2_MOUNTABLE=$(SP2_MOUNTABLE)
178endif
179ifneq ($(SP2_DISPLAY_NAME),)
180 LOCAL_CFLAGS += -DSP2_DISPLAY_NAME=$(SP2_DISPLAY_NAME)
181endif
182ifneq ($(SP3_NAME),)
183 LOCAL_CFLAGS += -DSP3_NAME=$(SP3_NAME) -DSP3_BACKUP_METHOD=$(SP3_BACKUP_METHOD) -DSP3_MOUNTABLE=$(SP3_MOUNTABLE)
184endif
185ifneq ($(SP3_DISPLAY_NAME),)
186 LOCAL_CFLAGS += -DSP3_DISPLAY_NAME=$(SP3_DISPLAY_NAME)
187endif
188ifneq ($(RECOVERY_SDCARD_ON_DATA),)
189 LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
190endif
191ifneq ($(TW_INCLUDE_DUMLOCK),)
192 LOCAL_CFLAGS += -DTW_INCLUDE_DUMLOCK
193endif
194ifneq ($(TW_INTERNAL_STORAGE_PATH),)
195 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_PATH=$(TW_INTERNAL_STORAGE_PATH)
196endif
197ifneq ($(TW_INTERNAL_STORAGE_MOUNT_POINT),)
198 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_MOUNT_POINT=$(TW_INTERNAL_STORAGE_MOUNT_POINT)
199endif
200ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
201 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
202endif
203ifneq ($(TW_EXTERNAL_STORAGE_MOUNT_POINT),)
204 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_MOUNT_POINT=$(TW_EXTERNAL_STORAGE_MOUNT_POINT)
205endif
206ifeq ($(TW_HAS_NO_RECOVERY_PARTITION), true)
207 LOCAL_CFLAGS += -DTW_HAS_NO_RECOVERY_PARTITION
208endif
ChampionSwimmercf33e4d2013-02-03 13:59:22 +0530209ifeq ($(TW_HAS_NO_BOOT_PARTITION), true)
210 LOCAL_CFLAGS += -DTW_HAS_NO_BOOT_PARTITION
211endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400212ifeq ($(TW_NO_REBOOT_BOOTLOADER), true)
213 LOCAL_CFLAGS += -DTW_NO_REBOOT_BOOTLOADER
214endif
215ifeq ($(TW_NO_REBOOT_RECOVERY), true)
216 LOCAL_CFLAGS += -DTW_NO_REBOOT_RECOVERY
217endif
218ifeq ($(TW_NO_BATT_PERCENT), true)
219 LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
220endif
Jenkins1710bf22014-10-02 20:22:21 -0400221ifeq ($(TW_NO_CPU_TEMP), true)
222 LOCAL_CFLAGS += -DTW_NO_CPU_TEMP
223endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400224ifneq ($(TW_CUSTOM_POWER_BUTTON),)
225 LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
226endif
227ifeq ($(TW_ALWAYS_RMRF), true)
228 LOCAL_CFLAGS += -DTW_ALWAYS_RMRF
229endif
230ifeq ($(TW_NEVER_UNMOUNT_SYSTEM), true)
231 LOCAL_CFLAGS += -DTW_NEVER_UNMOUNT_SYSTEM
232endif
233ifeq ($(TW_NO_USB_STORAGE), true)
234 LOCAL_CFLAGS += -DTW_NO_USB_STORAGE
235endif
236ifeq ($(TW_INCLUDE_INJECTTWRP), true)
237 LOCAL_CFLAGS += -DTW_INCLUDE_INJECTTWRP
238endif
239ifeq ($(TW_INCLUDE_BLOBPACK), true)
240 LOCAL_CFLAGS += -DTW_INCLUDE_BLOBPACK
241endif
242ifeq ($(TW_DEFAULT_EXTERNAL_STORAGE), true)
243 LOCAL_CFLAGS += -DTW_DEFAULT_EXTERNAL_STORAGE
244endif
245ifneq ($(TARGET_USE_CUSTOM_LUN_FILE_PATH),)
246 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(TARGET_USE_CUSTOM_LUN_FILE_PATH)\"
247endif
248ifneq ($(BOARD_UMS_LUNFILE),)
249 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(BOARD_UMS_LUNFILE)\"
250endif
251#ifeq ($(TW_FLASH_FROM_STORAGE), true) Making this the default behavior
252 LOCAL_CFLAGS += -DTW_FLASH_FROM_STORAGE
253#endif
254ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
255 LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
256endif
bigbiff bigbiff87940362013-03-09 09:58:50 -0500257ifeq ($(TW_NO_SCREEN_BLANK), true)
258 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
259endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400260ifeq ($(TW_SDEXT_NO_EXT4), true)
261 LOCAL_CFLAGS += -DTW_SDEXT_NO_EXT4
262endif
Dees_Troyfdf5fcc2012-09-11 10:27:01 -0400263ifeq ($(TW_FORCE_CPUINFO_FOR_DEVICE_ID), true)
264 LOCAL_CFLAGS += -DTW_FORCE_CPUINFO_FOR_DEVICE_ID
265endif
Dees_Troy3f5c4e82013-02-01 15:16:59 +0000266ifeq ($(TW_NO_EXFAT_FUSE), true)
267 LOCAL_CFLAGS += -DTW_NO_EXFAT_FUSE
268endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400269ifeq ($(TW_INCLUDE_CRYPTO), true)
270 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
271 LOCAL_CFLAGS += -DCRYPTO_FS_TYPE=\"$(TW_CRYPTO_FS_TYPE)\"
272 LOCAL_CFLAGS += -DCRYPTO_REAL_BLKDEV=\"$(TW_CRYPTO_REAL_BLKDEV)\"
273 LOCAL_CFLAGS += -DCRYPTO_MNT_POINT=\"$(TW_CRYPTO_MNT_POINT)\"
274 LOCAL_CFLAGS += -DCRYPTO_FS_OPTIONS=\"$(TW_CRYPTO_FS_OPTIONS)\"
275 LOCAL_CFLAGS += -DCRYPTO_FS_FLAGS=\"$(TW_CRYPTO_FS_FLAGS)\"
276 LOCAL_CFLAGS += -DCRYPTO_KEY_LOC=\"$(TW_CRYPTO_KEY_LOC)\"
a39552696ff55ce2013-01-08 16:14:56 +0000277ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
278 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO_SAMSUNG=\"$(TW_INCLUDE_CRYPTO_SAMSUNG)\"
279 ifdef TW_CRYPTO_SD_REAL_BLKDEV
280 LOCAL_CFLAGS += -DCRYPTO_SD_REAL_BLKDEV=\"$(TW_CRYPTO_SD_REAL_BLKDEV)\"
281 LOCAL_CFLAGS += -DCRYPTO_SD_FS_TYPE=\"$(TW_CRYPTO_SD_FS_TYPE)\"
282 endif
283 #LOCAL_LDFLAGS += -L$(TARGET_OUT_SHARED_LIBRARIES) -lsec_km
284 LOCAL_LDFLAGS += -ldl
285 LOCAL_STATIC_LIBRARIES += libcrypt_samsung
286endif
Dees_Troy2673cec2013-04-02 20:22:16 +0000287 LOCAL_SHARED_LIBRARIES += libcryptfsics
288 #LOCAL_SRC_FILES += crypto/ics/cryptfs.c
289 #LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
Dees_Troy51a0e822012-09-05 15:24:24 -0400290endif
291ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
292 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
293 LOCAL_CFLAGS += -DTW_INCLUDE_JB_CRYPTO
Dees_Troy2673cec2013-04-02 20:22:16 +0000294 LOCAL_SHARED_LIBRARIES += libcryptfsjb
295 #LOCAL_SRC_FILES += crypto/jb/cryptfs.c
296 #LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
Dees_Troy51a0e822012-09-05 15:24:24 -0400297endif
Anatoly Smaznov10c11f62013-02-12 13:33:40 +0700298ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true)
299 LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
300endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600301ifneq ($(TW_BRIGHTNESS_PATH),)
302 LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=$(TW_BRIGHTNESS_PATH)
303endif
xNUTxe85f02d2014-07-18 01:30:58 +0200304ifneq ($(TW_SECONDARY_BRIGHTNESS_PATH),)
305 LOCAL_CFLAGS += -DTW_SECONDARY_BRIGHTNESS_PATH=$(TW_SECONDARY_BRIGHTNESS_PATH)
306endif
Dees_Troy2f9117a2013-02-17 19:52:09 -0600307ifneq ($(TW_MAX_BRIGHTNESS),)
308 LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
309endif
Dees_Troyf33b4902013-03-01 00:51:39 +0000310ifneq ($(TW_CUSTOM_BATTERY_PATH),)
311 LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
312endif
Jenkins1710bf22014-10-02 20:22:21 -0400313ifneq ($(TW_CUSTOM_CPU_TEMP_PATH),)
314 LOCAL_CFLAGS += -DTW_CUSTOM_CPU_TEMP_PATH=$(TW_CUSTOM_CPU_TEMP_PATH)
315endif
316ifneq ($(TW_NO_CPU_TEMP),)
317 LOCAL_CFLAGS += -DTW_NO_CPU_TEMP=$(TW_NO_CPU_TEMP)
318endif
Dees_Troy83bd4832013-05-04 12:39:56 +0000319ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
320 LOCAL_SHARED_LIBRARIES += libopenaes
321else
322 LOCAL_CFLAGS += -DTW_EXCLUDE_ENCRYPTED_BACKUPS
323endif
Vojtech Bocekd0e38bc2014-02-03 23:36:57 +0100324ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),)
325 ifeq ($(TARGET_CPU_VARIANT),krait)
326 LOCAL_CFLAGS += -DQCOM_RTC_FIX
327 endif
328else ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),true)
329 LOCAL_CFLAGS += -DQCOM_RTC_FIX
330endif
Matt Mower6883d732014-03-20 17:28:13 -0500331ifneq ($(TW_NO_LEGACY_PROPS),)
332 LOCAL_CFLAGS += -DTW_NO_LEGACY_PROPS
333endif
Dees Troy4159aed2014-02-28 17:24:43 +0000334ifneq ($(wildcard bionic/libc/include/sys/capability.h),)
335 LOCAL_CFLAGS += -DHAVE_CAPABILITIES
336endif
Sergey 'Jin' Bostandzhyan80a90ed2013-01-04 02:29:03 +0100337
Matt Mower031163b2014-11-01 15:13:03 -0500338LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker
339
340LOCAL_ADDITIONAL_DEPENDENCIES := \
341 busybox_symlinks \
342 dosfsck \
343 dosfslabel \
344 dump_image \
345 erase_image \
346 flash_image \
347 fix_permissions.sh \
348 fsck_msdos_symlink \
349 mkdosfs \
350 mke2fs.conf \
351 mkexfatfs \
352 pigz \
353 teamwin \
354 toolbox_symlinks \
355 twrp \
356 unpigz_symlink \
357 updater
358
359ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
360 LOCAL_ADDITIONAL_DEPENDENCIES += parted
361endif
362ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
363 LOCAL_ADDITIONAL_DEPENDENCIES += openaes ../openaes/LICENSE
364endif
365ifeq ($(TW_INCLUDE_DUMLOCK), true)
366 LOCAL_ADDITIONAL_DEPENDENCIES += \
367 htcdumlock htcdumlocksys flash_imagesys dump_imagesys libbmlutils.so \
368 libflashutils.so libmmcutils.so libmtdutils.so HTCDumlock.apk
369endif
370ifneq ($(TW_EXCLUDE_SUPERSU), true)
371 LOCAL_ADDITIONAL_DEPENDENCIES += \
372 su install-recovery.sh 99SuperSUDaemon Superuser.apk
373endif
374ifneq ($(TW_NO_EXFAT_FUSE), true)
375 LOCAL_ADDITIONAL_DEPENDENCIES += exfat-fuse
376endif
377ifeq ($(TW_INCLUDE_CRYPTO), true)
378 LOCAL_ADDITIONAL_DEPENDENCIES += cryptfs cryptsettings
379endif
380ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
381 LOCAL_ADDITIONAL_DEPENDENCIES += getfooter
382endif
383ifeq ($(TW_INCLUDE_FB2PNG), true)
384 LOCAL_ADDITIONAL_DEPENDENCIES += fb2png
385endif
386ifneq ($(TW_OEM_BUILD),true)
387 LOCAL_ADDITIONAL_DEPENDENCIES += orscmd
388endif
389ifeq ($(BOARD_USES_BML_OVER_MTD),true)
390 LOCAL_ADDITIONAL_DEPENDENCIES += bml_over_mtd
391endif
392ifeq ($(TW_INCLUDE_INJECTTWRP), true)
393 LOCAL_ADDITIONAL_DEPENDENCIES += injecttwrp
394endif
395# Allow devices to specify device-specific recovery dependencies
396ifneq ($(TARGET_RECOVERY_DEVICE_MODULES),)
397 LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_RECOVERY_DEVICE_MODULES)
398endif
399
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800400include $(BUILD_EXECUTABLE)
401
Ethan Yonker5c933692014-04-04 11:26:32 -0500402ifneq ($(TW_USE_TOOLBOX), true)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800403include $(CLEAR_VARS)
Dees_Troyc04dcf72012-10-02 10:46:37 -0400404# Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead
405BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links)
406exclude := tune2fs mke2fs mkdosfs gzip gunzip
Matt Mower81742fb2014-09-01 14:40:52 -0500407
408# If busybox does not have restorecon, assume it does not have SELinux support.
409# Then, let toolbox provide 'ls' so -Z is available to list SELinux contexts.
Dees Troy8d66f8b2013-10-08 14:04:55 +0000410ifeq ($(TWHAVE_SELINUX), true)
Matt Mower81742fb2014-09-01 14:40:52 -0500411 ifeq ($(filter restorecon, $(notdir $(BUSYBOX_LINKS))),)
412 exclude += ls
413 endif
Dees Troy8d66f8b2013-10-08 14:04:55 +0000414endif
Matt Mower81742fb2014-09-01 14:40:52 -0500415
416RECOVERY_BUSYBOX_TOOLS := $(filter-out $(exclude), $(notdir $(BUSYBOX_LINKS)))
417RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/, $(RECOVERY_BUSYBOX_TOOLS))
Dees_Troyc04dcf72012-10-02 10:46:37 -0400418$(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox
419$(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
420 @echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
421 @mkdir -p $(dir $@)
422 @rm -rf $@
423 $(hide) ln -sf $(BUSYBOX_BINARY) $@
424
Matt Mower031163b2014-11-01 15:13:03 -0500425include $(CLEAR_VARS)
426LOCAL_MODULE := busybox_symlinks
427LOCAL_MODULE_TAGS := optional
428LOCAL_ADDITIONAL_DEPENDENCIES := $(RECOVERY_BUSYBOX_SYMLINKS)
429include $(BUILD_PHONY_PACKAGE)
430RECOVERY_BUSYBOX_SYMLINKS :=
431endif # !TW_USE_TOOLBOX
Dees_Troyc04dcf72012-10-02 10:46:37 -0400432
Kenny Root7a4adb52013-10-09 10:14:35 -0700433# All the APIs for testing
434include $(CLEAR_VARS)
435LOCAL_MODULE := libverifier
436LOCAL_MODULE_TAGS := tests
437LOCAL_SRC_FILES := \
438 asn1_decoder.cpp
439include $(BUILD_STATIC_LIBRARY)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800440
441include $(CLEAR_VARS)
Ethan Yonkera1674162014-11-06 08:35:10 -0600442LOCAL_SRC_FILES := fuse_sideload.c
443
444LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
445LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
446
447LOCAL_MODULE := libfusesideload
Ethan Yonker1702eb42014-11-06 09:16:16 -0600448LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
449LOCAL_SHARED_LIBRARIES := libcutils libc
450LOCAL_STATIC_LIBRARIES := libmincrypttwrp
Ethan Yonkera1674162014-11-06 08:35:10 -0600451include $(BUILD_SHARED_LIBRARY)
452
Dees_Troyc04dcf72012-10-02 10:46:37 -0400453include $(CLEAR_VARS)
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700454LOCAL_MODULE := verifier_test
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700455LOCAL_FORCE_STATIC_EXECUTABLE := true
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700456LOCAL_MODULE_TAGS := tests
Ethan Yonkera1674162014-11-06 08:35:10 -0600457
Matt Mower55c75ca2014-08-31 11:30:15 -0500458LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
Ethan Yonkera1674162014-11-06 08:35:10 -0600459
Doug Zongker9e805d62013-09-04 13:44:38 -0700460LOCAL_CFLAGS += -DNO_RECOVERY_MOUNT
Doug Zongker0d32f252014-02-13 15:07:56 -0800461LOCAL_CFLAGS += -Wno-unused-parameter
Ethan Yonkera1674162014-11-06 08:35:10 -0600462
Joe Onorato6396e702012-05-31 23:21:46 -0700463LOCAL_SRC_FILES := \
464 verifier_test.cpp \
Kenny Root7a4adb52013-10-09 10:14:35 -0700465 asn1_decoder.cpp \
Joe Onorato6396e702012-05-31 23:21:46 -0700466 verifier.cpp \
467 ui.cpp
468LOCAL_STATIC_LIBRARIES := \
Dees Troyd63c7642013-11-03 13:03:55 +0000469 libmincrypttwrp \
Joe Onorato6396e702012-05-31 23:21:46 -0700470 libminui \
Doug Zongker99916f02014-01-13 14:16:58 -0800471 libminzip \
Joe Onorato6396e702012-05-31 23:21:46 -0700472 libcutils \
473 libstdc++ \
474 libc
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700475include $(BUILD_EXECUTABLE)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800476
Dees_Troy2673cec2013-04-02 20:22:16 +0000477include $(CLEAR_VARS)
478
479LOCAL_MODULE := libaosprecovery
Matt Mowerdb220442014-10-31 22:43:59 -0500480LOCAL_MODULE_TAGS := eng optional
Matt Mower55c75ca2014-08-31 11:30:15 -0500481LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
Ethan Yonker26860092014-11-06 09:49:25 -0600482LOCAL_SRC_FILES = adb_install.cpp asn1_decoder.cpp bootloader.cpp verifier.cpp mtdutils/mtdutils.c legacy_property_service.c
Ethan Yonkera1674162014-11-06 08:35:10 -0600483LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils libfusesideload
Dees Troybb4c0cb2013-11-02 20:25:14 +0000484LOCAL_STATIC_LIBRARIES += libmincrypttwrp
Dees_Troy2673cec2013-04-02 20:22:16 +0000485
Matt Mowerfb60a942014-07-08 22:25:38 -0500486ifneq ($(BOARD_RECOVERY_BLDRMSG_OFFSET),)
487 LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=$(BOARD_RECOVERY_BLDRMSG_OFFSET)
488endif
489
Dees_Troy2673cec2013-04-02 20:22:16 +0000490include $(BUILD_SHARED_LIBRARY)
491
Dees_Troy51a0e822012-09-05 15:24:24 -0400492commands_recovery_local_path := $(LOCAL_PATH)
Joe Onorato6396e702012-05-31 23:21:46 -0700493include $(LOCAL_PATH)/minui/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700494 $(LOCAL_PATH)/minadbd/Android.mk \
Kenny Root7a4adb52013-10-09 10:14:35 -0700495 $(LOCAL_PATH)/tests/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700496 $(LOCAL_PATH)/tools/Android.mk \
497 $(LOCAL_PATH)/edify/Android.mk \
Doug Zongker76adfc52014-01-13 10:04:25 -0800498 $(LOCAL_PATH)/uncrypt/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700499 $(LOCAL_PATH)/updater/Android.mk \
500 $(LOCAL_PATH)/applypatch/Android.mk
Dees_Troy51a0e822012-09-05 15:24:24 -0400501
502#includes for TWRP
Dees_Troy930bf012013-08-10 22:19:03 +0000503include $(commands_recovery_local_path)/injecttwrp/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400504 $(commands_recovery_local_path)/htcdumlock/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400505 $(commands_recovery_local_path)/gui/Android.mk \
506 $(commands_recovery_local_path)/mmcutils/Android.mk \
507 $(commands_recovery_local_path)/bmlutils/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400508 $(commands_recovery_local_path)/prebuilt/Android.mk \
509 $(commands_recovery_local_path)/mtdutils/Android.mk \
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500510 $(commands_recovery_local_path)/flashutils/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400511 $(commands_recovery_local_path)/pigz/Android.mk \
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500512 $(commands_recovery_local_path)/dosfstools/Android.mk \
513 $(commands_recovery_local_path)/libtar/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400514 $(commands_recovery_local_path)/crypto/cryptsettings/Android.mk \
a39552696ff55ce2013-01-08 16:14:56 +0000515 $(commands_recovery_local_path)/crypto/cryptfs/Android.mk \
Dees_Troyb9d88ac2012-09-14 14:34:19 -0400516 $(commands_recovery_local_path)/libcrecovery/Android.mk \
Dees_Troy2673cec2013-04-02 20:22:16 +0000517 $(commands_recovery_local_path)/libblkid/Android.mk \
Dees_Troy83bd4832013-05-04 12:39:56 +0000518 $(commands_recovery_local_path)/minuitwrp/Android.mk \
Dees Troy8d66f8b2013-10-08 14:04:55 +0000519 $(commands_recovery_local_path)/openaes/Android.mk \
Dees Troybb4c0cb2013-11-02 20:25:14 +0000520 $(commands_recovery_local_path)/toolbox/Android.mk \
Ethan Yonker50381972014-02-11 11:44:06 -0600521 $(commands_recovery_local_path)/libmincrypt/Android.mk \
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400522 $(commands_recovery_local_path)/twrpTarMain/Android.mk \
523 $(commands_recovery_local_path)/mtp/Android.mk
Dees_Troyb9d88ac2012-09-14 14:34:19 -0400524
a39552696ff55ce2013-01-08 16:14:56 +0000525ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
526 include $(commands_recovery_local_path)/crypto/libcrypt_samsung/Android.mk
527endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400528
529ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
Dees_Troy2673cec2013-04-02 20:22:16 +0000530 include $(commands_recovery_local_path)/crypto/jb/Android.mk
Dees_Troy51a0e822012-09-05 15:24:24 -0400531 include $(commands_recovery_local_path)/crypto/fs_mgr/Android.mk
Dees Troy4dff2e62013-11-10 04:11:43 +0000532 include $(commands_recovery_local_path)/crypto/logwrapper/Android.mk
533 include $(commands_recovery_local_path)/crypto/scrypt/Android.mk
Dees Troy89310072013-11-11 15:14:14 +0000534 include $(commands_recovery_local_path)/crypto/crypttools/Android.mk
Dees_Troy51a0e822012-09-05 15:24:24 -0400535endif
Ethan Yonker3d2baac2014-01-27 22:03:00 -0600536ifeq ($(TWHAVE_SELINUX), true)
Dees Troyb7ae0982013-09-10 20:47:35 +0000537 include $(commands_recovery_local_path)/minzip/Android.mk
538else
539 include $(commands_recovery_local_path)/minzipold/Android.mk
540endif
Vojtech Bocek7cc278b2013-02-24 01:40:19 +0100541ifeq ($(BUILD_ID), GINGERBREAD)
542 TW_NO_EXFAT := true
543endif
Dees_Troyb05ddee2013-01-28 20:24:50 +0000544ifneq ($(TW_NO_EXFAT), true)
Captain Throwback6a1acf22014-09-18 12:46:35 -0400545 include $(commands_recovery_local_path)/exfat/mkfs/Android.mk \
Dees_Troyb05ddee2013-01-28 20:24:50 +0000546 $(commands_recovery_local_path)/fuse/Android.mk \
547 $(commands_recovery_local_path)/exfat/libexfat/Android.mk
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500548endif
Captain Throwback6a1acf22014-09-18 12:46:35 -0400549ifneq ($(TW_NO_EXFAT_FUSE), true)
550 include $(commands_recovery_local_path)/exfat/exfat-fuse/Android.mk
551endif
Dees_Troy2673cec2013-04-02 20:22:16 +0000552ifeq ($(TW_INCLUDE_CRYPTO), true)
553 include $(commands_recovery_local_path)/crypto/ics/Android.mk
554endif
Ethan Yonker03a42f62014-08-08 11:03:51 -0500555ifneq ($(TW_OEM_BUILD),true)
556 include $(commands_recovery_local_path)/orscmd/Android.mk
557endif
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500558
Talustus3019a912013-04-06 11:50:07 +0200559# FB2PNG
560ifeq ($(TW_INCLUDE_FB2PNG), true)
561 include $(commands_recovery_local_path)/fb2png/Android.mk
562endif
Matt Mower55c75ca2014-08-31 11:30:15 -0500563
564commands_recovery_local_path :=
565
566endif