summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-08-29 18:38:55 +0200
committerDees_Troy <dees_troy@teamw.in>2013-08-29 18:58:38 +0200
commite5017045b5fbc1487356642801df2c516c33f8ff (patch)
tree36420974b2ed44b99033c096a43d5b82aa5182bf
parentUse twrp.fstab if present (diff)
downloadandroid_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.tar
android_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.tar.gz
android_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.tar.bz2
android_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.tar.lz
android_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.tar.xz
android_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.tar.zst
android_bootable_recovery-e5017045b5fbc1487356642801df2c516c33f8ff.zip
Diffstat (limited to '')
-rw-r--r--partition.cpp29
-rw-r--r--partitions.hpp1
-rw-r--r--prebuilt/Android.mk5
3 files changed, 35 insertions, 0 deletions
diff --git a/partition.cpp b/partition.cpp
index 444eb4bc5..e6c622177 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -500,6 +500,7 @@ bool TWPartition::Is_File_System(string File_System) {
File_System == "ntfs" ||
File_System == "yaffs2" ||
File_System == "exfat" ||
+ File_System == "f2fs" ||
File_System == "auto")
return true;
else
@@ -1005,6 +1006,8 @@ bool TWPartition::Wipe(string New_File_System) {
wiped = Wipe_EXFAT();
else if (New_File_System == "yaffs2")
wiped = Wipe_MTD();
+ else if (New_File_System == "f2fs")
+ wiped = Wipe_F2FS();
else {
LOGERR("Unable to wipe '%s' -- unknown file system '%s'\n", Mount_Point.c_str(), New_File_System.c_str());
unlink("/.layout_version");
@@ -1398,6 +1401,32 @@ bool TWPartition::Wipe_RMRF() {
return true;
}
+bool TWPartition::Wipe_F2FS() {
+ string command, result;
+
+ if (TWFunc::Path_Exists("/sbin/mkfs.f2fs")) {
+ if (!UnMount(true))
+ return false;
+
+ gui_print("Formatting %s using mkfs.f2fs...\n", Display_Name.c_str());
+ Find_Actual_Block_Device();
+ command = "mkfs.f2fs " + Actual_Block_Device;
+ if (TWFunc::Exec_Cmd(command, result) == 0) {
+ Recreate_AndSec_Folder();
+ gui_print("Done.\n");
+ return true;
+ } else {
+ LOGERR("Unable to wipe '%s'.\n", Mount_Point.c_str());
+ return false;
+ }
+ return true;
+ } else {
+ gui_print("mkfs.f2fs binary not found, using rm -rf to wipe.\n");
+ return Wipe_RMRF();
+ }
+ return false;
+}
+
bool TWPartition::Wipe_Data_Without_Wiping_Media() {
string dir;
diff --git a/partitions.hpp b/partitions.hpp
index 736304ee6..25ae4dbee 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -92,6 +92,7 @@ private:
bool Wipe_EXFAT(); // Formats as EXFAT
bool Wipe_MTD(); // Formats as yaffs2 for MTD memory types
bool Wipe_RMRF(); // Uses rm -rf to wipe
+ bool Wipe_F2FS(); // Uses mkfs.f2fs to wipe
bool Wipe_Data_Without_Wiping_Media(); // Uses rm -rf to wipe but does not wipe /data/media
bool Backup_Tar(string backup_folder); // Backs up using tar for file systems
bool Backup_DD(string backup_folder); // Backs up using dd for emmc memory types
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 74923a050..39f702b3d 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -89,6 +89,11 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/openaes
RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libopenaes.so
endif
+ifeq ($(TARGET_USERIMAGES_USE_F2FS), true)
+ RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs
+ RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fsck.f2fs
+ RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fibmap.f2fs
+endif
TWRP_AUTOGEN := $(intermediates)/teamwin