diff options
author | Dees_Troy <dees_troy@teamw.in> | 2013-08-17 15:14:43 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@198.50.184.117> | 2013-08-24 14:42:30 +0200 |
commit | a95f55c3ef657411f92c0c00a2e23ceb1d52b851 (patch) | |
tree | ca5c779bea6a16f5e1b397c59de80058fe9b7bb0 | |
parent | Merge "Fix AOSP decrypt when TouchWiz code is present" into twrp2.5 (diff) | |
download | android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.gz android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.bz2 android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.lz android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.xz android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.zst android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.zip |
-rw-r--r-- | Android.mk | 13 | ||||
-rw-r--r-- | partition.cpp | 20 | ||||
-rw-r--r-- | prebuilt/Android.mk | 4 | ||||
-rw-r--r-- | twrp.cpp | 16 |
4 files changed, 47 insertions, 6 deletions
diff --git a/Android.mk b/Android.mk index da06b9a60..a6a82ef26 100644 --- a/Android.mk +++ b/Android.mk @@ -56,7 +56,7 @@ LOCAL_STATIC_LIBRARIES := LOCAL_SHARED_LIBRARIES := LOCAL_STATIC_LIBRARIES += libcrecovery libguitwrp -LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libext4_utils libtar libblkid libminuitwrp libminadbd libmtdutils libminzip libaosprecovery +LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libminzip libaosprecovery ifneq ($(wildcard system/core/libsparse/Android.mk),) LOCAL_SHARED_LIBRARIES += libsparse @@ -65,9 +65,9 @@ endif ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) LOCAL_CFLAGS += -DUSE_EXT4 LOCAL_C_INCLUDES += system/extras/ext4_utils - #LOCAL_STATIC_LIBRARIES += libext4_utils + LOCAL_SHARED_LIBRARIES += libext4_utils endif - +LOCAL_C_INCLUDES += external/libselinux/include ifeq ($(HAVE_SELINUX), true) #LOCAL_C_INCLUDES += external/libselinux/include #LOCAL_STATIC_LIBRARIES += libselinux @@ -75,8 +75,13 @@ ifeq ($(HAVE_SELINUX), true) endif # HAVE_SELINUX ifneq ($(wildcard external/libselinux/Android.mk),) LOCAL_C_INCLUDES += external/libselinux/include - LOCAL_STATIC_LIBRARIES += libselinux + LOCAL_SHARED_LIBRARIES += libselinux LOCAL_CFLAGS += -DHAVE_SELINUX -g + ifneq ($(TARGET_USERIMAGES_USE_EXT4), true) + LOCAL_CFLAGS += -DUSE_EXT4 + LOCAL_C_INCLUDES += system/extras/ext4_utils + LOCAL_SHARED_LIBRARIES += libext4_utils + endif endif # This binary is in the recovery ramdisk, which is otherwise a copy of root. diff --git a/partition.cpp b/partition.cpp index f81748d72..dc71bb9a4 100644 --- a/partition.cpp +++ b/partition.cpp @@ -49,10 +49,15 @@ extern "C" { #ifdef TW_INCLUDE_CRYPTO_SAMSUNG #include "crypto/libcrypt_samsung/include/libcrypt_samsung.h" #endif +#ifdef USE_EXT4 + #include "make_ext4fs.h" +#endif } using namespace std; +extern struct selabel_handle *selinux_handle; + TWPartition::TWPartition(void) { Can_Be_Mounted = false; Can_Be_Wiped = false; @@ -1257,6 +1262,19 @@ bool TWPartition::Wipe_EXT4() { if (!UnMount(true)) return false; +#ifdef USE_EXT4 + gui_print("Formatting %s using make_ext4fs function.\n", Display_Name.c_str()); +#ifdef HAVE_SELINUX + if (make_ext4fs(Actual_Block_Device.c_str(), Length, Mount_Point.c_str(), selinux_handle) != 0) { +#else + if (make_ext4fs(Actual_Block_Device.c_str(), Length) != 0) { +#endif + LOGERR("Unable to wipe '%s' using function call.\n", Mount_Point.c_str()); + return false; + } else { + return true; + } +#else if (TWFunc::Path_Exists("/sbin/make_ext4fs")) { string Command, result; @@ -1283,7 +1301,7 @@ bool TWPartition::Wipe_EXT4() { } } else return Wipe_EXT23("ext4"); - +#endif return false; } diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index e31ec8e31..74923a050 100644 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -46,7 +46,9 @@ RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbmlutils.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libflashutils.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstlport.so #RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypt.so -RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext4_utils.so +ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext4_utils.so +endif RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libaosprecovery.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libjpeg.so ifneq ($(wildcard external/libselinux/Android.mk),) @@ -46,6 +46,11 @@ extern "C" { #include "openrecoveryscript.hpp" #include "variables.h" +#ifdef HAVE_SELINUX +#include "selinux/label.h" +struct selabel_handle *selinux_handle; +#endif + TWPartitionManager PartitionManager; int Log_Offset; @@ -90,6 +95,17 @@ int main(int argc, char **argv) { // Load up all the resources gui_loadResources(); +#ifdef HAVE_SELINUX + struct selinux_opt selinux_options[] = { + { SELABEL_OPT_PATH, "/file_contexts" } + }; + selinux_handle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1); + if (!selinux_handle) + printf("No file contexts for SELinux\n"); + else + printf("SELinux contexts loaded from /file_contexts\n"); +#endif + PartitionManager.Mount_By_Path("/cache", true); string Zip_File, Reboot_Value; |