nkk71 | 71c6c50 | 2017-01-05 23:55:05 +0200 | [diff] [blame] | 1 | # Copyright (C) 2017 TeamWin Recovery 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. |
| 14 | |
| 15 | LOCAL_PATH := $(call my-dir) |
| 16 | |
| 17 | ifeq ($(TW_INCLUDE_CRYPTO), true) |
| 18 | ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),) |
| 19 | ifneq ($(TW_CRYPTO_USE_SYSTEM_VOLD),false) |
| 20 | |
| 21 | |
| 22 | # Parse TW_CRYPTO_USE_SYSTEM_VOLD |
| 23 | ifeq ($(TW_CRYPTO_USE_SYSTEM_VOLD),true) |
| 24 | # Just enabled, so only vold + vdc |
| 25 | services := |
| 26 | else |
| 27 | # Additional services needed by vold |
| 28 | services := $(TW_CRYPTO_USE_SYSTEM_VOLD) |
| 29 | endif |
| 30 | |
| 31 | # List of .rc files for each additional service |
| 32 | rc_files := $(foreach item,$(services),init.recovery.vold_decrypt.$(item).rc) |
| 33 | |
| 34 | |
| 35 | include $(CLEAR_VARS) |
| 36 | LOCAL_MODULE := init.recovery.vold_decrypt.rc |
| 37 | LOCAL_MODULE_TAGS := eng |
| 38 | LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES |
| 39 | |
| 40 | # Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc |
| 41 | # during ramdisk creation and only allows init.recovery.*.rc files to be copied |
| 42 | # from TARGET_ROOT_OUT thereafter |
| 43 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 44 | |
| 45 | LOCAL_SRC_FILES := $(LOCAL_MODULE) |
| 46 | |
| 47 | # Add additional .rc files and imports into init.recovery.vold_decrypt.rc |
| 48 | # Note: any init.recovery.vold_decrypt.{service}.rc that are not default |
| 49 | # in crypto/vold_decrypt should be in the device tree |
| 50 | LOCAL_POST_INSTALL_CMD := $(hide) \ |
| 51 | $(foreach item, $(rc_files), \ |
| 52 | sed -i '1iimport \/$(item)' "$(TARGET_ROOT_OUT)/$(LOCAL_MODULE)"; \ |
| 53 | if [ -f "$(LOCAL_PATH)/$(item)" ]; then \ |
| 54 | cp -f "$(LOCAL_PATH)/$(item)" "$(TARGET_ROOT_OUT)"/; \ |
| 55 | fi; \ |
| 56 | ) |
| 57 | include $(BUILD_PREBUILT) |
| 58 | |
| 59 | |
| 60 | include $(CLEAR_VARS) |
| 61 | LOCAL_MODULE := libvolddecrypt |
| 62 | LOCAL_MODULE_TAGS := eng optional |
| 63 | LOCAL_CFLAGS := -Wall |
| 64 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) |
| 65 | LOCAL_C_INCLUDES += external/stlport/stlport bionic bionic/libstdc++/include |
| 66 | endif |
| 67 | |
| 68 | ifneq ($(services),) |
| 69 | LOCAL_CFLAGS += -DTW_CRYPTO_SYSTEM_VOLD_SERVICES='"$(services)"' |
| 70 | endif |
| 71 | |
| 72 | ifeq ($(TW_CRYPTO_SYSTEM_VOLD_DEBUG),true) |
| 73 | # Enabling strace will expose the password in the strace logs!! |
| 74 | LOCAL_CFLAGS += -DTW_CRYPTO_SYSTEM_VOLD_DEBUG |
| 75 | endif |
| 76 | |
| 77 | ifeq ($(TW_CRYPTO_SYSTEM_VOLD_DISABLE_TIMEOUT),true) |
| 78 | LOCAL_CFLAGS += -DTW_CRYPTO_SYSTEM_VOLD_DISABLE_TIMEOUT |
| 79 | endif |
| 80 | |
| 81 | LOCAL_SRC_FILES = vold_decrypt.cpp |
| 82 | LOCAL_SHARED_LIBRARIES := libcutils |
| 83 | include $(BUILD_STATIC_LIBRARY) |
| 84 | |
| 85 | endif |
| 86 | endif |
| 87 | endif |