Add MTK6575/6577 EMMC partitions backup support

taken from https://github.com/mrjavum/Team-Win-Recovery-Project/commit/140ff0cde8ad2236caf7bcd480d257d74d8b85bc

"sorocean.gor@gmail.com"

Change-Id: I1a97160c73c7a0bab0535e938d6b35dc09585037
diff --git a/partition.cpp b/partition.cpp
index 73aa8af..6070775 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -620,6 +620,29 @@
 	char line[512];
 	string tmpdevice;
 
+	fp = fopen("/proc/dumchar_info", "rt");
+	if (fp != NULL) {
+		while (fgets(line, sizeof(line), fp) != NULL)
+		{
+			char label[32], device[32];
+			unsigned long size = 0;
+
+			sscanf(line, "%s %lx %*lx %*lu %s", label, &size, device);
+
+			// Skip header, annotation  and blank lines
+			if ((strncmp(device, "/dev/", 5) != 0) || (strlen(line) < 8))
+				continue;
+
+			tmpdevice = "/dev/";
+			tmpdevice += label;
+			if (tmpdevice == Primary_Block_Device || tmpdevice == Alternate_Block_Device) {
+				Size = size;
+				fclose(fp);
+				return true;
+			}
+		}
+	}
+
 	// In this case, we'll first get the partitions we care about (with labels)
 	fp = fopen("/proc/partitions", "rt");
 	if (fp == NULL)
@@ -1344,10 +1367,13 @@
 }
 
 bool TWPartition::Backup_DD(string backup_folder) {
-	char back_name[255];
-	string Full_FileName, Command, result;
+	char back_name[255], backup_size[32];
+	string Full_FileName, Command, result, DD_BS;
 	int use_compression;
 
+	sprintf(backup_size, "%llu", Backup_Size);
+	DD_BS = backup_size;
+
 	TWFunc::GUI_Operation_Text(TW_BACKUP_TEXT, Display_Name, "Backing Up");
 	ui_print("Backing up %s...\n", Display_Name.c_str());
 
@@ -1356,7 +1382,7 @@
 
 	Full_FileName = backup_folder + "/" + Backup_FileName;
 
-	Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'";
+	Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'" + " bs=" + DD_BS + "c count=1";
 	LOGI("Backup command: '%s'\n", Command.c_str());
 	TWFunc::Exec_Cmd(Command, result);
 	if (TWFunc::Get_File_Size(Full_FileName) == 0) {