blob: 725436a0a1aa69286aa46f785dab271f0432843d [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 -080020
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080021LOCAL_SRC_FILES := \
Doug Zongker28ce47c2011-10-28 10:33:05 -070022 recovery.cpp \
Dees_Troy7c2dec82012-09-26 09:49:14 -040023 twbootloader.cpp \
Doug Zongker28ce47c2011-10-28 10:33:05 -070024 install.cpp \
25 roots.cpp \
Doug Zongker32a0a472011-11-01 11:00:20 -070026 ui.cpp \
Doug Zongker211aebc2011-10-28 15:13:10 -070027 screen_ui.cpp \
Doug Zongker9270a202012-01-09 15:16:13 -080028 verifier.cpp \
bigbiff bigbiffa0f8a592012-10-09 21:01:03 -040029 fixPermissions.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_Troy9df963c2012-09-26 08:58:12 -040034 makelist.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040035 partition.cpp \
36 partitionmanager.cpp \
Dees_Troy32c8eb82012-09-11 15:28:06 -040037 mtdutils/mtdutils.c \
38 twinstall.cpp \
Dees_Troy812660f2012-09-20 09:55:17 -040039 twrp-functions.cpp \
40 openrecoveryscript.cpp
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
66LOCAL_STATIC_LIBRARIES += libmtdutils
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
Dees_Troy43d8b002012-09-17 16:00:01 -040069LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libmincrypt libext4_utils
Doug Zongker49c73a72010-06-29 17:36:28 -070070
71ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
Joe Onorato6396e702012-05-31 23:21:46 -070072 LOCAL_CFLAGS += -DUSE_EXT4
73 LOCAL_C_INCLUDES += system/extras/ext4_utils
Dees_Troy43d8b002012-09-17 16:00:01 -040074 #LOCAL_STATIC_LIBRARIES += libext4_utils
Doug Zongker49c73a72010-06-29 17:36:28 -070075endif
76
Stephen Smalley1a114492012-01-13 07:59:51 -050077ifeq ($(HAVE_SELINUX), true)
Joe Onorato6396e702012-05-31 23:21:46 -070078 LOCAL_C_INCLUDES += external/libselinux/include
79 LOCAL_STATIC_LIBRARIES += libselinux
80 LOCAL_CFLAGS += -DHAVE_SELINUX
Stephen Smalley1a114492012-01-13 07:59:51 -050081endif # HAVE_SELINUX
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080082
83# This binary is in the recovery ramdisk, which is otherwise a copy of root.
84# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
85# a (redundant) copy of the binary in /system/bin for user builds.
86# TODO: Build the ramdisk image in a more principled way.
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080087LOCAL_MODULE_TAGS := eng
88
Doug Zongkerddd6a282009-06-09 12:22:33 -070089ifeq ($(TARGET_RECOVERY_UI_LIB),)
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070090 LOCAL_SRC_FILES += default_device.cpp
Doug Zongkerddd6a282009-06-09 12:22:33 -070091else
92 LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UI_LIB)
93endif
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080094
Doug Zongkercc8cd3f2010-09-20 12:16:13 -070095LOCAL_C_INCLUDES += system/extras/ext4_utils
96
Dees_Troy51a0e822012-09-05 15:24:24 -040097#TWRP Build Flags
98ifeq ($(BOARD_HAS_NO_REAL_SDCARD), true)
99 LOCAL_CFLAGS += -DBOARD_HAS_NO_REAL_SDCARD
100endif
101ifneq ($(SP1_NAME),)
102 LOCAL_CFLAGS += -DSP1_NAME=$(SP1_NAME) -DSP1_BACKUP_METHOD=$(SP1_BACKUP_METHOD) -DSP1_MOUNTABLE=$(SP1_MOUNTABLE)
103endif
104ifneq ($(SP1_DISPLAY_NAME),)
105 LOCAL_CFLAGS += -DSP1_DISPLAY_NAME=$(SP1_DISPLAY_NAME)
106endif
107ifneq ($(SP2_NAME),)
108 LOCAL_CFLAGS += -DSP2_NAME=$(SP2_NAME) -DSP2_BACKUP_METHOD=$(SP2_BACKUP_METHOD) -DSP2_MOUNTABLE=$(SP2_MOUNTABLE)
109endif
110ifneq ($(SP2_DISPLAY_NAME),)
111 LOCAL_CFLAGS += -DSP2_DISPLAY_NAME=$(SP2_DISPLAY_NAME)
112endif
113ifneq ($(SP3_NAME),)
114 LOCAL_CFLAGS += -DSP3_NAME=$(SP3_NAME) -DSP3_BACKUP_METHOD=$(SP3_BACKUP_METHOD) -DSP3_MOUNTABLE=$(SP3_MOUNTABLE)
115endif
116ifneq ($(SP3_DISPLAY_NAME),)
117 LOCAL_CFLAGS += -DSP3_DISPLAY_NAME=$(SP3_DISPLAY_NAME)
118endif
119ifneq ($(RECOVERY_SDCARD_ON_DATA),)
120 LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
121endif
122ifneq ($(TW_INCLUDE_DUMLOCK),)
123 LOCAL_CFLAGS += -DTW_INCLUDE_DUMLOCK
124endif
125ifneq ($(TW_INTERNAL_STORAGE_PATH),)
126 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_PATH=$(TW_INTERNAL_STORAGE_PATH)
127endif
128ifneq ($(TW_INTERNAL_STORAGE_MOUNT_POINT),)
129 LOCAL_CFLAGS += -DTW_INTERNAL_STORAGE_MOUNT_POINT=$(TW_INTERNAL_STORAGE_MOUNT_POINT)
130endif
131ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
132 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
133endif
134ifneq ($(TW_EXTERNAL_STORAGE_MOUNT_POINT),)
135 LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_MOUNT_POINT=$(TW_EXTERNAL_STORAGE_MOUNT_POINT)
136endif
137ifeq ($(TW_HAS_NO_RECOVERY_PARTITION), true)
138 LOCAL_CFLAGS += -DTW_HAS_NO_RECOVERY_PARTITION
139endif
140ifeq ($(TW_NO_REBOOT_BOOTLOADER), true)
141 LOCAL_CFLAGS += -DTW_NO_REBOOT_BOOTLOADER
142endif
143ifeq ($(TW_NO_REBOOT_RECOVERY), true)
144 LOCAL_CFLAGS += -DTW_NO_REBOOT_RECOVERY
145endif
146ifeq ($(TW_NO_BATT_PERCENT), true)
147 LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
148endif
149ifneq ($(TW_CUSTOM_POWER_BUTTON),)
150 LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
151endif
152ifeq ($(TW_ALWAYS_RMRF), true)
153 LOCAL_CFLAGS += -DTW_ALWAYS_RMRF
154endif
155ifeq ($(TW_NEVER_UNMOUNT_SYSTEM), true)
156 LOCAL_CFLAGS += -DTW_NEVER_UNMOUNT_SYSTEM
157endif
158ifeq ($(TW_NO_USB_STORAGE), true)
159 LOCAL_CFLAGS += -DTW_NO_USB_STORAGE
160endif
161ifeq ($(TW_INCLUDE_INJECTTWRP), true)
162 LOCAL_CFLAGS += -DTW_INCLUDE_INJECTTWRP
163endif
164ifeq ($(TW_INCLUDE_BLOBPACK), true)
165 LOCAL_CFLAGS += -DTW_INCLUDE_BLOBPACK
166endif
167ifeq ($(TW_DEFAULT_EXTERNAL_STORAGE), true)
168 LOCAL_CFLAGS += -DTW_DEFAULT_EXTERNAL_STORAGE
169endif
170ifneq ($(TARGET_USE_CUSTOM_LUN_FILE_PATH),)
171 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(TARGET_USE_CUSTOM_LUN_FILE_PATH)\"
172endif
173ifneq ($(BOARD_UMS_LUNFILE),)
174 LOCAL_CFLAGS += -DCUSTOM_LUN_FILE=\"$(BOARD_UMS_LUNFILE)\"
175endif
176#ifeq ($(TW_FLASH_FROM_STORAGE), true) Making this the default behavior
177 LOCAL_CFLAGS += -DTW_FLASH_FROM_STORAGE
178#endif
179ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
180 LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
181endif
182ifeq ($(TW_SDEXT_NO_EXT4), true)
183 LOCAL_CFLAGS += -DTW_SDEXT_NO_EXT4
184endif
Dees_Troyfdf5fcc2012-09-11 10:27:01 -0400185ifeq ($(TW_FORCE_CPUINFO_FOR_DEVICE_ID), true)
186 LOCAL_CFLAGS += -DTW_FORCE_CPUINFO_FOR_DEVICE_ID
187endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400188ifeq ($(TW_INCLUDE_CRYPTO), true)
189 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
190 LOCAL_CFLAGS += -DCRYPTO_FS_TYPE=\"$(TW_CRYPTO_FS_TYPE)\"
191 LOCAL_CFLAGS += -DCRYPTO_REAL_BLKDEV=\"$(TW_CRYPTO_REAL_BLKDEV)\"
192 LOCAL_CFLAGS += -DCRYPTO_MNT_POINT=\"$(TW_CRYPTO_MNT_POINT)\"
193 LOCAL_CFLAGS += -DCRYPTO_FS_OPTIONS=\"$(TW_CRYPTO_FS_OPTIONS)\"
194 LOCAL_CFLAGS += -DCRYPTO_FS_FLAGS=\"$(TW_CRYPTO_FS_FLAGS)\"
195 LOCAL_CFLAGS += -DCRYPTO_KEY_LOC=\"$(TW_CRYPTO_KEY_LOC)\"
196 LOCAL_SHARED_LIBRARIES += libcrypto
197 LOCAL_SRC_FILES += crypto/ics/cryptfs.c
198 LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
199endif
200ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
201 LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
202 LOCAL_CFLAGS += -DTW_INCLUDE_JB_CRYPTO
203 LOCAL_SHARED_LIBRARIES += libcrypto
204 LOCAL_STATIC_LIBRARIES += libfs_mgrtwrp
205 LOCAL_SRC_FILES += crypto/jb/cryptfs.c
206 LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
207endif
208
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800209include $(BUILD_EXECUTABLE)
210
Doug Zongker73ae31c2009-12-09 17:01:45 -0800211include $(CLEAR_VARS)
Dees_Troyc04dcf72012-10-02 10:46:37 -0400212# Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead
213BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links)
214exclude := tune2fs mke2fs mkdosfs gzip gunzip
215RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS))))
216$(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox
217$(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
218 @echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
219 @mkdir -p $(dir $@)
220 @rm -rf $@
221 $(hide) ln -sf $(BUSYBOX_BINARY) $@
222
223ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
224
225include $(CLEAR_VARS)
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700226LOCAL_MODULE := verifier_test
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700227LOCAL_FORCE_STATIC_EXECUTABLE := true
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700228LOCAL_MODULE_TAGS := tests
Joe Onorato6396e702012-05-31 23:21:46 -0700229LOCAL_SRC_FILES := \
230 verifier_test.cpp \
231 verifier.cpp \
232 ui.cpp
233LOCAL_STATIC_LIBRARIES := \
234 libmincrypt \
235 libminui \
236 libcutils \
237 libstdc++ \
238 libc
Doug Zongkerdaefc1d2011-10-31 09:34:15 -0700239include $(BUILD_EXECUTABLE)
Doug Zongker73ae31c2009-12-09 17:01:45 -0800240
Dees_Troy51a0e822012-09-05 15:24:24 -0400241commands_recovery_local_path := $(LOCAL_PATH)
Joe Onorato6396e702012-05-31 23:21:46 -0700242include $(LOCAL_PATH)/minui/Android.mk \
243 $(LOCAL_PATH)/minelf/Android.mk \
244 $(LOCAL_PATH)/minzip/Android.mk \
245 $(LOCAL_PATH)/minadbd/Android.mk \
Joe Onorato6396e702012-05-31 23:21:46 -0700246 $(LOCAL_PATH)/tools/Android.mk \
247 $(LOCAL_PATH)/edify/Android.mk \
248 $(LOCAL_PATH)/updater/Android.mk \
249 $(LOCAL_PATH)/applypatch/Android.mk
Dees_Troy51a0e822012-09-05 15:24:24 -0400250
251#includes for TWRP
252include $(commands_recovery_local_path)/libjpegtwrp/Android.mk \
253 $(commands_recovery_local_path)/injecttwrp/Android.mk \
254 $(commands_recovery_local_path)/htcdumlock/Android.mk \
255 $(commands_recovery_local_path)/minuitwrp/Android.mk \
256 $(commands_recovery_local_path)/gui/Android.mk \
257 $(commands_recovery_local_path)/mmcutils/Android.mk \
258 $(commands_recovery_local_path)/bmlutils/Android.mk \
259 $(commands_recovery_local_path)/flashutils/Android.mk \
260 $(commands_recovery_local_path)/prebuilt/Android.mk \
261 $(commands_recovery_local_path)/mtdutils/Android.mk \
262 $(commands_recovery_local_path)/pigz/Android.mk \
263 $(commands_recovery_local_path)/crypto/cryptsettings/Android.mk \
Dees_Troyb9d88ac2012-09-14 14:34:19 -0400264 $(commands_recovery_local_path)/libcrecovery/Android.mk \
265 $(commands_recovery_local_path)/twmincrypt/Android.mk
266
Dees_Troy51a0e822012-09-05 15:24:24 -0400267
268ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
269 include $(commands_recovery_local_path)/crypto/fs_mgr/Android.mk
270endif
271
272commands_recovery_local_path :=
273