summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorcodelover <gerrit@code.info.tm>2015-03-28 19:44:07 +0100
committerDees Troy <dees_troy@teamw.in>2015-05-19 20:43:53 +0200
commit352b75eddb22f78a1148a37d961c792a7847a557 (patch)
tree930fb5a4c7d25d7e87cf27a0c57e6038969137f8 /partition.cpp
parentbootloader: align with AOSP code (diff)
downloadandroid_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.tar
android_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.tar.gz
android_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.tar.bz2
android_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.tar.lz
android_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.tar.xz
android_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.tar.zst
android_bootable_recovery-352b75eddb22f78a1148a37d961c792a7847a557.zip
Diffstat (limited to '')
-rw-r--r--partition.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/partition.cpp b/partition.cpp
index 87ba0bc66..b5aacccf6 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1764,12 +1764,21 @@ bool TWPartition::Backup_Tar(string backup_folder, const unsigned long long *ove
}
bool TWPartition::Backup_DD(string backup_folder) {
- char back_name[255], backup_size[32];
- string Full_FileName, Command, DD_BS;
+ char back_name[255], block_size[32], dd_count[32];
+ string Full_FileName, Command, DD_BS, DD_COUNT;
int use_compression;
+ unsigned long long DD_Block_Size, DD_Count;
- sprintf(backup_size, "%llu", Backup_Size);
- DD_BS = backup_size;
+ DD_Block_Size = 16 * 1024 * 1024;
+ while (Backup_Size % DD_Block_Size != 0) DD_Block_Size >>= 1;
+
+ DD_Count = Backup_Size / DD_Block_Size;
+
+ sprintf(dd_count, "%llu", DD_Count);
+ DD_COUNT = dd_count;
+
+ sprintf(block_size, "%llu", DD_Block_Size);
+ DD_BS = block_size;
TWFunc::GUI_Operation_Text(TW_BACKUP_TEXT, Display_Name, "Backing Up");
gui_print("Backing up %s...\n", Display_Name.c_str());
@@ -1779,7 +1788,7 @@ bool TWPartition::Backup_DD(string backup_folder) {
Full_FileName = backup_folder + "/" + Backup_FileName;
- Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'" + " bs=" + DD_BS + " count=1";
+ Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'" + " bs=" + DD_BS + " count=" + DD_COUNT;
LOGINFO("Backup command: '%s'\n", Command.c_str());
TWFunc::Exec_Cmd(Command);
tw_set_default_metadata(Full_FileName.c_str());
@@ -2102,7 +2111,7 @@ bool TWPartition::Flash_Image_DD(string Filename) {
string Command;
gui_print("Flashing %s...\n", Display_Name.c_str());
- Command = "dd bs=4096 if='" + Filename + "' of=" + Actual_Block_Device;
+ Command = "dd bs=8388608 if='" + Filename + "' of=" + Actual_Block_Device;
LOGINFO("Flash command: '%s'\n", Command.c_str());
TWFunc::Exec_Cmd(Command);
return true;