blob: 58b0607289a2b05c45592271c95807a65fe72ca2 [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
Dees_Troy51a0e822012-09-05 15:24:24 -040017TARGET_RECOVERY_GUI := true
Joe Onorato6396e702012-05-31 23:21:46 -070018
19include $(CLEAR_VARS)
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080020LOCAL_SRC_FILES := \
Doug Zongker28ce47c2011-10-28 10:33:05 -070021 recovery.cpp \
Dees_Troy7c2dec82012-09-26 09:49:14 -040022 twbootloader.cpp \
Doug Zongker28ce47c2011-10-28 10:33:05 -070023 install.cpp \
24 roots.cpp \
Doug Zongker32a0a472011-11-01 11:00:20 -070025 ui.cpp \
Doug Zongker211aebc2011-10-28 15:13:10 -070026 screen_ui.cpp \
Doug Zongker9270a202012-01-09 15:16:13 -080027 verifier.cpp \
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040028 fixPermissions.cpp \
bigbiff bigbiff9c754052013-01-09 09:09:08 -050029 twrpTar.cpp \
Doug Zongker9270a202012-01-09 15:16:13 -080030 adb_install.cpp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080031
Dees_Troy51a0e822012-09-05 15:24:24 -040032LOCAL_SRC_FILES += \
Dees_Troy51a0e822012-09-05 15:24:24 -040033 data.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040034 partition.cpp \
35 partitionmanager.cpp \
Dees_Troy32c8eb82012-09-11 15:28:06 -040036 mtdutils/mtdutils.c \
37 twinstall.cpp \
Dees_Troy812660f2012-09-20 09:55:17 -040038 twrp-functions.cpp \
Dees_Troye34c1332013-02-06 19:13:00 +000039 openrecoveryscript.cpp \
40 tarWrite.c
Dees_Troy51a0e822012-09-05 15:24:24 -040041
Dees_Troya58bead2012-09-27 09:49:29 -040042ifneq ($(TARGET_RECOVERY_REBOOT_SRC),)
Dees_Troy51a0e822012-09-05 15:24:24 -040043 LOCAL_SRC_FILES += $(TARGET_RECOVERY_REBOOT_SRC)
44endif
45
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080046LOCAL_MODULE := recovery
47
Dees_Troy51a0e822012-09-05 15:24:24 -040048#LOCAL_FORCE_STATIC_EXECUTABLE := true
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080049
Doug Zongkere08991e2010-02-02 13:09:52 -080050RECOVERY_API_VERSION := 3
Doug Zongkerfb2e3af2009-06-17 17:29:40 -070051LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
52
Dees_Troy51a0e822012-09-05 15:24:24 -040053#LOCAL_STATIC_LIBRARIES := \
54# libext4_utils \
55# libminzip \
56# libmtdutils \
57# libmincrypt \
58# libminadbd \
59# libpixelflinger_static
60
61LOCAL_C_INCLUDES += bionic external/stlport/stlport
62
63LOCAL_STATIC_LIBRARIES :=
64LOCAL_SHARED_LIBRARIES :=
65
Dees_Troyb05ddee2013-01-28 20:24:50 +000066LOCAL_STATIC_LIBRARIES += libmtdutils libcrecovery
Dees_Troy43d8b002012-09-17 16:00:01 -040067LOCAL_STATIC_LIBRARIES += libminadbd libminzip libunz
Dees_Troy7d15c252012-09-05 20:47:21 -040068LOCAL_STATIC_LIBRARIES += libminuitwrp libpixelflinger_static libpng libjpegtwrp libgui
bigbiff bigbiff9c754052013-01-09 09:09:08 -050069LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libmincrypt libext4_utils libtar
Doug Zongker49c73a72010-06-29 17:36:28 -070070
Dees_Troy4546fe72013-01-10 14:33:27 +000071ifneq ($(wildcard system/core/libsparse/Android.mk),)
72LOCAL_SHARED_LIBRARIES += libsparse
73endif
74
Doug Zongker49c73a72010-06-29 17:36:28 -070075ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
Joe Onorato6396e702012-05-31 23:21:46 -070076 LOCAL_CFLAGS += -DUSE_EXT4
77 LOCAL_C_INCLUDES += system/extras/ext4_utils
Dees_Troy43d8b002012-09-17 16:00:01 -040078 #LOCAL_STATIC_LIBRARIES += libext4_utils
Doug Zongker49c73a72010-06-29 17:36:28 -070079endif
80
Stephen Smalley1a114492012-01-13 07:59:51 -050081ifeq ($(HAVE_SELINUX), true)
Joe Onorato6396e702012-05-31 23:21:46 -070082 LOCAL_C_INCLUDES += external/libselinux/include
83 LOCAL_STATIC_LIBRARIES += libselinux
bigbiff bigbiff9c754052013-01-09 09:09:08 -050084 LOCAL_CFLAGS += -DHAVE_SELINUX -g
Stephen Smalley1a114492012-01-13 07:59:51 -050085endif # HAVE_SELINUX
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080086
87# This binary is in the recovery ramdisk, which is otherwise a copy of root.
88# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
89# a (redundant) copy of the binary in /system/bin for user builds.
90# TODO: Build the ramdisk image in a more principled way.
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080091LOCAL_MODULE_TAGS := eng
92
Doug Zongkerddd6a282009-06-09 12:22:33 -070093ifeq ($(TARGET_RECOVERY_UI_LIB),)
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070094 LOCAL_SRC_FILES += default_device.cpp
Doug Zongkerddd6a282009-06-09 12:22:33 -070095else
96 LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UI_LIB)
97endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080098
Doug Zongkercc8cd3f2010-09-20 12:16:13 -070099LOCAL_C_INCLUDES += system/extras/ext4_utils
100
Dees_Troy51a0e822012-09-05 15:24:24 -0400101#TWRP Build Flags
102ifeq ($(BOARD_HAS_NO_REAL_SDCARD), true)
103 LOCAL_CFLAGS += -DBOARD_HAS_NO_REAL_SDCARD
104endif
105ifneq ($(SP1_NAME),)
106 LOCAL_CFLAGS += -DSP1_NAME=$(SP1_NAME) -DSP1_BACKUP_METHOD=$(SP1_BACKUP_METHOD) -DSP1_MOUNTABLE=$(SP1_MOUNTABLE)
107endif
108ifneq ($(SP1_DISPLAY_NAME),)
109 LOCAL_CFLAGS += -DSP1_DISPLAY_NAME=$(SP1_DISPLAY_NAME)
110endif
111ifneq ($(SP2_NAME),)
112 LOCAL_CFLAGS += -DSP2_NAME=$(SP2_NAME) -DSP2_BACKUP_METHOD=$(SP2_BACKUP_METHOD) -DSP2_MOUNTABLE=$(SP2_MOUNTABLE)
113endif
114ifneq ($(SP2_DISPLAY_NAME),)
115 LOCAL_CFLAGS += -DSP2_DISPLAY_NAME=$(SP2_DISPLAY_NAME)
116endif
117ifneq ($(SP3_NAME),)
118 LOCAL_CFLAGS += -DSP3_NAME=$(SP3_NAME) -DSP3_BACKUP_METHOD=$(SP3_BACKUP_METHOD) -DSP3_MOUNTABLE=$(SP3_MOUNTABLE)
119endif
120ifneq ($(SP3_DISPLAY_NAME),)
121 LOCAL_CFLAGS += -DSP3_DISPLAY_NAME=$(SP3_DISPLAY_NAME)
122endif
123ifneq ($(RECOVERY_SDCARD_ON_DATA),)
124 LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
125endif
126ifneq ($(TW_INCLUDE_DUMLOCK),)
127 LOCAL_CFLAGS += -DTW_INCLUDE_DUMLOCK
128endif
129ifneq ($(TW_INTERNAL_STORAGE_PATH),)
130 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_PATH=$(TW_INTERNAL_STORAGE_PATH)
131endif
132ifneq ($(TW_INTERNAL_STORAGE_MOUNT_POINT),)
133 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_MOUNT_POINT=$(TW_INTERNAL_STORAGE_MOUNT_POINT)
134endif
135ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
136 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
137endif
138ifneq ($(TW_EXTERNAL_STORAGE_MOUNT_POINT),)
139 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_MOUNT_POINT=$(TW_EXTERNAL_STORAGE_MOUNT_POINT)
140endif
141ifeq ($(TW_HAS_NO_RECOVERY_PARTITION), true)
142 LOCAL_CFLAGS += -DTW_HAS_NO_RECOVERY_PARTITION
143endif
ChampionSwimmercf33e4d2013-02-03 13:59:22 +0530144ifeq ($(TW_HAS_NO_BOOT_PARTITION), true)
145 LOCAL_CFLAGS += -DTW_HAS_NO_BOOT_PARTITION
146endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400147ifeq ($(TW_NO_REBOOT_BOOTLOADER), true)
148 LOCAL_CFLAGS += -DTW_NO_REBOOT_BOOTLOADER
149endif
150ifeq ($(TW_NO_REBOOT_RECOVERY), true)
151 LOCAL_CFLAGS += -DTW_NO_REBOOT_RECOVERY
152endif
153ifeq ($(TW_NO_BATT_PERCENT), true)
154 LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
155endif
156ifneq ($(TW_CUSTOM_POWER_BUTTON),)
157 LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
158endif
159ifeq ($(TW_ALWAYS_RMRF), true)
160 LOCAL_CFLAGS += -DTW_ALWAYS_RMRF
161endif
162ifeq ($(TW_NEVER_UNMOUNT_SYSTEM), true)
163 LOCAL_CFLAGS += -DTW_NEVER_UNMOUNT_SYSTEM
164endif
165ifeq ($(TW_NO_USB_STORAGE), true)
166 LOCAL_CFLAGS += -DTW_NO_USB_STORAGE
167endif
168ifeq ($(TW_INCLUDE_INJECTTWRP), true)
169 LOCAL_CFLAGS += -DTW_INCLUDE_INJECTTWRP
170endif
171ifeq ($(TW_INCLUDE_BLOBPACK), true)
172 LOCAL_CFLAGS += -DTW_INCLUDE_BLOBPACK
173endif
174ifeq ($(TW_DEFAULT_EXTERNAL_STORAGE), true)
175 LOCAL_CFLAGS += -DTW_DEFAULT_EXTERNAL_STORAGE
176endif
177ifneq ($(TARGET_USE_CUSTOM_LUN_FILE_PATH),)
178 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(TARGET_USE_CUSTOM_LUN_FILE_PATH)\"
179endif
180ifneq ($(BOARD_UMS_LUNFILE),)
181 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(BOARD_UMS_LUNFILE)\"
182endif
183#ifeq ($(TW_FLASH_FROM_STORAGE), true) Making this the default behavior
184 LOCAL_CFLAGS += -DTW_FLASH_FROM_STORAGE
185#endif
186ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
187 LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
188endif
189ifeq ($(TW_SDEXT_NO_EXT4), true)
190 LOCAL_CFLAGS += -DTW_SDEXT_NO_EXT4
191endif
Dees_Troyfdf5fcc2012-09-11 10:27:01 -0400192ifeq ($(TW_FORCE_CPUINFO_FOR_DEVICE_ID), true)
193 LOCAL_CFLAGS += -DTW_FORCE_CPUINFO_FOR_DEVICE_ID
194endif
Dees_Troy3f5c4e82013-02-01 15:16:59 +0000195ifeq ($(TW_NO_EXFAT_FUSE), true)
196 LOCAL_CFLAGS += -DTW_NO_EXFAT_FUSE
197endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400198ifeq ($(TW_INCLUDE_CRYPTO), true)
199 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
200 LOCAL_CFLAGS += -DCRYPTO_FS_TYPE=\"$(TW_CRYPTO_FS_TYPE)\"
201 LOCAL_CFLAGS += -DCRYPTO_REAL_BLKDEV=\"$(TW_CRYPTO_REAL_BLKDEV)\"
202 LOCAL_CFLAGS += -DCRYPTO_MNT_POINT=\"$(TW_CRYPTO_MNT_POINT)\"
203 LOCAL_CFLAGS += -DCRYPTO_FS_OPTIONS=\"$(TW_CRYPTO_FS_OPTIONS)\"
204 LOCAL_CFLAGS += -DCRYPTO_FS_FLAGS=\"$(TW_CRYPTO_FS_FLAGS)\"
205 LOCAL_CFLAGS += -DCRYPTO_KEY_LOC=\"$(TW_CRYPTO_KEY_LOC)\"
a39552696ff55ce2013-01-08 16:14:56 +0000206ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
207 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO_SAMSUNG=\"$(TW_INCLUDE_CRYPTO_SAMSUNG)\"
208 ifdef TW_CRYPTO_SD_REAL_BLKDEV
209 LOCAL_CFLAGS += -DCRYPTO_SD_REAL_BLKDEV=\"$(TW_CRYPTO_SD_REAL_BLKDEV)\"
210 LOCAL_CFLAGS += -DCRYPTO_SD_FS_TYPE=\"$(TW_CRYPTO_SD_FS_TYPE)\"
211 endif
212 #LOCAL_LDFLAGS += -L$(TARGET_OUT_SHARED_LIBRARIES) -lsec_km
213 LOCAL_LDFLAGS += -ldl
214 LOCAL_STATIC_LIBRARIES += libcrypt_samsung
215endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400216 LOCAL_SHARED_LIBRARIES += libcrypto
217 LOCAL_SRC_FILES += crypto/ics/cryptfs.c
218 LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
219endif
220ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
221 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
222 LOCAL_CFLAGS += -DTW_INCLUDE_JB_CRYPTO
223 LOCAL_SHARED_LIBRARIES += libcrypto
224 LOCAL_STATIC_LIBRARIES += libfs_mgrtwrp
225 LOCAL_SRC_FILES += crypto/jb/cryptfs.c
226 LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
227endif
Anatoly Smaznov10c11f62013-02-12 13:33:40 +0700228ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true)
229 LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
230endif
Sergey 'Jin' Bostandzhyan80a90ed2013-01-04 02:29:03 +0100231ifeq ($(TARGET_BOARD_PLATFORM),rk30xx)
Anatoly Smaznov10c11f62013-02-12 13:33:40 +0700232 LOCAL_CFLAGS += -DRK3066
Sergey 'Jin' Bostandzhyan80a90ed2013-01-04 02:29:03 +0100233endif
234
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800235include $(BUILD_EXECUTABLE)
236
Doug Zongker73ae31c2009-12-09 17:01:45 -0800237include $(CLEAR_VARS)
Dees_Troyc04dcf72012-10-02 10:46:37 -0400238# Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead
239BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links)
240exclude := tune2fs mke2fs mkdosfs gzip gunzip
241RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS))))
242$(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox
243$(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
244 @echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
245 @mkdir -p $(dir $@)
246 @rm -rf $@
247 $(hide) ln -sf $(BUSYBOX_BINARY) $@
248
249ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
250
251include $(CLEAR_VARS)
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700252LOCAL_MODULE := verifier_test
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700253LOCAL_FORCE_STATIC_EXECUTABLE := true
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700254LOCAL_MODULE_TAGS := tests
Joe Onorato6396e702012-05-31 23:21:46 -0700255LOCAL_SRC_FILES := \
256 verifier_test.cpp \
257 verifier.cpp \
258 ui.cpp
259LOCAL_STATIC_LIBRARIES := \
260 libmincrypt \
261 libminui \
262 libcutils \
263 libstdc++ \
264 libc
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700265include $(BUILD_EXECUTABLE)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800266
Dees_Troy51a0e822012-09-05 15:24:24 -0400267commands_recovery_local_path := $(LOCAL_PATH)
Joe Onorato6396e702012-05-31 23:21:46 -0700268include $(LOCAL_PATH)/minui/Android.mk \
269 $(LOCAL_PATH)/minelf/Android.mk \
270 $(LOCAL_PATH)/minzip/Android.mk \
271 $(LOCAL_PATH)/minadbd/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700272 $(LOCAL_PATH)/tools/Android.mk \
273 $(LOCAL_PATH)/edify/Android.mk \
274 $(LOCAL_PATH)/updater/Android.mk \
275 $(LOCAL_PATH)/applypatch/Android.mk
Dees_Troy51a0e822012-09-05 15:24:24 -0400276
277#includes for TWRP
278include $(commands_recovery_local_path)/libjpegtwrp/Android.mk \
279 $(commands_recovery_local_path)/injecttwrp/Android.mk \
280 $(commands_recovery_local_path)/htcdumlock/Android.mk \
281 $(commands_recovery_local_path)/minuitwrp/Android.mk \
282 $(commands_recovery_local_path)/gui/Android.mk \
283 $(commands_recovery_local_path)/mmcutils/Android.mk \
284 $(commands_recovery_local_path)/bmlutils/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400285 $(commands_recovery_local_path)/prebuilt/Android.mk \
286 $(commands_recovery_local_path)/mtdutils/Android.mk \
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500287 $(commands_recovery_local_path)/flashutils/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400288 $(commands_recovery_local_path)/pigz/Android.mk \
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500289 $(commands_recovery_local_path)/dosfstools/Android.mk \
290 $(commands_recovery_local_path)/libtar/Android.mk \
Dees_Troy51a0e822012-09-05 15:24:24 -0400291 $(commands_recovery_local_path)/crypto/cryptsettings/Android.mk \
a39552696ff55ce2013-01-08 16:14:56 +0000292 $(commands_recovery_local_path)/crypto/cryptfs/Android.mk \
Dees_Troyb9d88ac2012-09-14 14:34:19 -0400293 $(commands_recovery_local_path)/libcrecovery/Android.mk \
Dees_Troyb05ddee2013-01-28 20:24:50 +0000294 $(commands_recovery_local_path)/twmincrypt/Android.mk
Dees_Troyb9d88ac2012-09-14 14:34:19 -0400295
a39552696ff55ce2013-01-08 16:14:56 +0000296ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
297 include $(commands_recovery_local_path)/crypto/libcrypt_samsung/Android.mk
298endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400299
300ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
301 include $(commands_recovery_local_path)/crypto/fs_mgr/Android.mk
302endif
303
Dees_Troyb05ddee2013-01-28 20:24:50 +0000304ifneq ($(TW_NO_EXFAT), true)
305 include $(commands_recovery_local_path)/exfat/exfat-fuse/Android.mk \
306 $(commands_recovery_local_path)/exfat/mkfs/Android.mk \
307 $(commands_recovery_local_path)/fuse/Android.mk \
308 $(commands_recovery_local_path)/exfat/libexfat/Android.mk
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500309endif
310
Dees_Troy51a0e822012-09-05 15:24:24 -0400311commands_recovery_local_path :=