From 96af84a4094c2018d35c792e33813c07344f553c Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Mon, 5 Jan 2015 14:58:36 -0600 Subject: Allow flashing of images via the GUI - Use the Images... button in the lower right of the zip install page - Unify image flashing functions between restore and image flash - boot and recovery partitions are flashable by default - use fstab flag flashimg=1 or 0 to override defaults - file system partitions are currently not flashable Change-Id: I822dc446030543c55d2153e219d67a1292374ffc --- gui/action.cpp | 19 ++++ gui/devices/1024x600/res/ui.xml | 1 + gui/devices/1024x768/res/ui.xml | 1 + gui/devices/1080x1920/res/ui.xml | 1 + gui/devices/1200x1920/res/ui.xml | 1 + gui/devices/1280x800/res/ui.xml | 1 + gui/devices/1440x2560/res/ui.xml | 1 + gui/devices/1600x2560/res/ui.xml | 1 + gui/devices/1920x1200/res/ui.xml | 1 + gui/devices/240x240/res/ui.xml | 1 + gui/devices/2560x1600/res/ui.xml | 1 + gui/devices/280x280/res/ui.xml | 1 + gui/devices/320x320/res/ui.xml | 1 + gui/devices/320x480/res/ui.xml | 1 + gui/devices/480x800/res/ui.xml | 1 + gui/devices/480x854/res/ui.xml | 1 + gui/devices/540x960/res/ui.xml | 13 +-- gui/devices/720x1280/res/ui.xml | 1 + gui/devices/800x1280/res/ui.xml | 1 + gui/devices/800x480/res/ui.xml | 1 + gui/devices/landscape/res/landscape.xml | 177 ++++++++++++++++++++++++++++++ gui/devices/portrait/res/portrait.xml | 161 ++++++++++++++++++++++++++++ gui/devices/watch/res/watch.xml | 183 +++++++++++++++++++++++++++++++- gui/objects.hpp | 1 + gui/partitionlist.cpp | 4 + partition.cpp | 123 +++++++++++++-------- partitionmanager.cpp | 63 +++++++++++ partitions.hpp | 8 +- 28 files changed, 713 insertions(+), 57 deletions(-) diff --git a/gui/action.cpp b/gui/action.cpp index 750d73b8d..96f620957 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -201,6 +201,7 @@ GUIAction::GUIAction(xml_node<>* node) mf["decrypt_backup"] = &GUIAction::decrypt_backup; mf["repair"] = &GUIAction::repair; mf["changefilesystem"] = &GUIAction::changefilesystem; + mf["flashimage"] = &GUIAction::flashimage; } // First, get the action @@ -1651,6 +1652,24 @@ int GUIAction::stopmtp(std::string arg) return 0; } +int GUIAction::flashimage(std::string arg) +{ + int op_status = 0; + + operation_start("Flash Image"); + string path, filename, full_filename; + DataManager::GetValue("tw_zip_location", path); + DataManager::GetValue("tw_file", filename); + full_filename = path + "/" + filename; + if (PartitionManager.Flash_Image(full_filename)) + op_status = 0; // success + else + op_status = 1; // fail + + operation_end(op_status); + return 0; +} + int GUIAction::getKeyByName(std::string key) { if (key == "home") return KEY_HOME; diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 7b7ad8ce7..1669d4586 100644 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index b5ce1b40b..253ae07e5 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index 1367015bf..ddab4f317 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -81,6 +81,7 @@ + diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml index 77af05ba7..c02032fbd 100644 --- a/gui/devices/1200x1920/res/ui.xml +++ b/gui/devices/1200x1920/res/ui.xml @@ -84,6 +84,7 @@ + diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 716dadc1e..94d0bf981 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/1440x2560/res/ui.xml b/gui/devices/1440x2560/res/ui.xml index 4fc699645..52bf20776 100644 --- a/gui/devices/1440x2560/res/ui.xml +++ b/gui/devices/1440x2560/res/ui.xml @@ -81,6 +81,7 @@ + diff --git a/gui/devices/1600x2560/res/ui.xml b/gui/devices/1600x2560/res/ui.xml index 76217921b..b85803bb3 100644 --- a/gui/devices/1600x2560/res/ui.xml +++ b/gui/devices/1600x2560/res/ui.xml @@ -84,6 +84,7 @@ + diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index e36d0ae76..4bd85a27a 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/240x240/res/ui.xml b/gui/devices/240x240/res/ui.xml index d157f85c1..7448ae5ec 100644 --- a/gui/devices/240x240/res/ui.xml +++ b/gui/devices/240x240/res/ui.xml @@ -75,6 +75,7 @@ + diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 12a2d5536..6da373e56 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/280x280/res/ui.xml b/gui/devices/280x280/res/ui.xml index 971e6371f..ae8c27d3f 100644 --- a/gui/devices/280x280/res/ui.xml +++ b/gui/devices/280x280/res/ui.xml @@ -74,6 +74,7 @@ + diff --git a/gui/devices/320x320/res/ui.xml b/gui/devices/320x320/res/ui.xml index 4678e855f..4a03855ef 100644 --- a/gui/devices/320x320/res/ui.xml +++ b/gui/devices/320x320/res/ui.xml @@ -75,6 +75,7 @@ + diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index dd4cdbc36..70d33e601 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -77,6 +77,7 @@ + diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index 0e0f65d70..895cfaa48 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -77,6 +77,7 @@ + diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index 26d8b28d0..dd7efd720 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -76,6 +76,7 @@ + diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index dc647ce60..eb6d671bc 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -77,6 +77,7 @@ + @@ -311,7 +312,7 @@ - + Name tw_gui_sort_order=1 @@ -319,7 +320,7 @@ - + Date tw_gui_sort_order=2 @@ -327,7 +328,7 @@ - + Size tw_gui_sort_order=3 @@ -341,7 +342,7 @@ - + Name tw_gui_sort_order=-1 @@ -349,7 +350,7 @@ - + Date tw_gui_sort_order=-2 @@ -357,7 +358,7 @@ - + Size tw_gui_sort_order=-3 diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index 2f1fbc7c5..3020daa4f 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -81,6 +81,7 @@ + diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index 03b6144fc..6f49bf7ff 100644 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -78,6 +78,7 @@ + diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index ed1c84271..b80ed3be1 100644 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/landscape/res/landscape.xml b/gui/devices/landscape/res/landscape.xml index 8f557aa33..f66eb8bb6 100644 --- a/gui/devices/landscape/res/landscape.xml +++ b/gui/devices/landscape/res/landscape.xml @@ -148,6 +148,17 @@ + + + + + Images... + + + install_image + + + @@ -390,6 +401,172 @@ + + + + + + + Select Image to Flash + + + + + + + + Storage: %tw_storage_display_name% (%tw_storage_free_size% MB) + + tw_back=install_image + selectstorage + + + + + + +
+ + Folders: + + + + + + + + +
+ + + + +
+ + %tw_zip_location% + + + + + + + + + +
+ + + + + + + + Zips... + + + install + + + + + + flashimage_confirm + + + + + install + + + + + main + + + + + + + + + + + +
+ + Select Partition to Flash Image: + + + + + + +
+ + + + + Folder: + + + + + + %tw_zip_location% + + + + + + File to flash: + + + + + + %tw_file% + + + + + + + tw_back=flashimage_confirm + tw_action=flashimage + tw_has_action2=0 + tw_action_text1=Flashing Image... + tw_action_text2= + tw_complete_text1=Image Flashed + action_page + + + + + + + + Swipe to Confirm Flash + + + + + + tw_clear_destination=install_image + clear_vars + + + + + + + tw_clear_destination=main2 + clear_vars + + + + + + tw_operation_state=0 diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml index 0642c30b0..b73297411 100644 --- a/gui/devices/portrait/res/portrait.xml +++ b/gui/devices/portrait/res/portrait.xml @@ -133,6 +133,17 @@ + + + + + Images... + + + install_image + + + @@ -403,6 +414,156 @@ + + + + + + + Select Image to Install + + + + + + + + Storage: %tw_storage_display_name% (%tw_storage_free_size% MB) + + tw_back=install_image + selectstorage + + + + + + +
+ + %tw_zip_location% + + + + + + + + + +
+ + + + + + + + Zips... + + + install + + + + + + flashimage_confirm + + + + + install + + + + + main + + + + + + + + + + + +
+ + Select Partition to Flash Image: + + + + + + +
+ + + + + Folder: + + + + + + %tw_zip_location% + + + + + + File to flash: + + + + + + %tw_file% + + + + + + + tw_back=flashimage_confirm + tw_action=flashimage + tw_has_action2=0 + tw_action_text1=Flashing Image... + tw_action_text2= + tw_complete_text1=Image Flashed + action_page + + + + + + + + Swipe to Confirm Flash + + + + + + tw_clear_destination=install_image + clear_vars + + + + + + + tw_clear_destination=main2 + clear_vars + + + + + + tw_operation_state=0 diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml index 38de230c4..03effde31 100644 --- a/gui/devices/watch/res/watch.xml +++ b/gui/devices/watch/res/watch.xml @@ -22,10 +22,7 @@ Install - - - install - + install_select @@ -95,6 +92,45 @@ + + + + + + + + + + Install Zips + + + + install + + + + + + + + Install Images + + install_image + + + + + main + + + + + main + + + + + @@ -145,7 +181,7 @@ - main + install_select @@ -385,6 +421,143 @@ + + + + + + + Select Image to Install + + + + + + + + Storage: %tw_storage_display_name% (%tw_storage_free_size% MB) + + tw_back=install_image + selectstorage + + + + + + +
+ + %tw_zip_location% + + + + + + + + + +
+ + + + + + flashimage_confirm + + + + + install_select + + + + + main + + + + + + + + + + + +
+ + Select Partition to Flash Image: + + + + + + +
+ + + + + Folder: + + + + + + %tw_zip_location% + + + + + + File to flash: + + + + + + %tw_file% + + + + + + + tw_back=flashimage_confirm + tw_action=flashimage + tw_has_action2=0 + tw_action_text1=Flashing Image... + tw_action_text2= + tw_complete_text1=Image Flashed + action_page + + + + + + + + Swipe to Confirm Flash + + + + + + tw_clear_destination=install_image + clear_vars + + + + + + + tw_clear_destination=main2 + clear_vars + + + + tw_operation_state=0 diff --git a/gui/objects.hpp b/gui/objects.hpp index 76dbb4625..bb3edb398 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -352,6 +352,7 @@ protected: int changefilesystem(std::string arg); int startmtp(std::string arg); int stopmtp(std::string arg); + int flashimage(std::string arg); int simulate; }; diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp index 9cc6a777b..3ec15488a 100644 --- a/gui/partitionlist.cpp +++ b/gui/partitionlist.cpp @@ -793,6 +793,10 @@ int GUIPartitionList::NotifyTouch(TOUCH_STATE state, int x, int y) DataManager::SetValue(mVariable, str); } } else { + if (ListType == "flashimg") { // only one item can be selected for flashing images + for (int i=0; i 8 && strncmp(ptr, "mounttodecrypt", 14) == 0) { Mount_To_Decrypt = true; + } else if (strncmp(ptr, "flashimg", 8) == 0) { + if (ptr_len == 8) { + Can_Flash_Img = true; + } else if (ptr_len == 10) { + ptr += 9; + if (*ptr == '1' || *ptr == 'y' || *ptr == 'Y') { + Can_Flash_Img = true; + } else { + Can_Flash_Img = false; + } + } } else { if (Display_Error) LOGERR("Unhandled flag: '%s'\n", ptr); @@ -1313,9 +1327,7 @@ bool TWPartition::Restore(string restore_folder, const unsigned long long *total else if (Is_Image(Restore_File_System)) { *already_restored_size += TWFunc::Get_File_Size(Backup_Name); if (Restore_File_System == "emmc") - return Restore_DD(restore_folder, total_restore_size, already_restored_size); - else if (Restore_File_System == "mtd" || Restore_File_System == "bml") - return Restore_Flash_Image(restore_folder, total_restore_size, already_restored_size); + return Restore_Image(restore_folder, total_restore_size, already_restored_size, Restore_File_System); } LOGERR("Unknown restore method for '%s'\n", Mount_Point.c_str()); @@ -1888,53 +1900,21 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System, return ret; } -bool TWPartition::Restore_DD(string restore_folder, const unsigned long long *total_restore_size, unsigned long long *already_restored_size) { - string Full_FileName, Command; +bool TWPartition::Restore_Image(string restore_folder, const unsigned long long *total_restore_size, unsigned long long *already_restored_size, string Restore_File_System) { + string Full_FileName; double display_percent, progress_percent; char size_progress[1024]; TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Display_Name, "Restoring"); Full_FileName = restore_folder + "/" + Backup_FileName; - if (!Find_Partition_Size()) { - LOGERR("Unable to find partition size for '%s'\n", Mount_Point.c_str()); - return false; - } - unsigned long long backup_size = TWFunc::Get_File_Size(Full_FileName); - if (backup_size > Size) { - LOGERR("Size (%iMB) of backup '%s' is larger than target device '%s' (%iMB)\n", - (int)(backup_size / 1048576LLU), Full_FileName.c_str(), - Actual_Block_Device.c_str(), (int)(Size / 1048576LLU)); - return false; + if (Restore_File_System == "emmc") { + if (!Flash_Image_DD(Full_FileName)) + return false; + } else if (Restore_File_System == "mtd" || Restore_File_System == "bml") { + if (!Flash_Image_FI(Full_FileName)) + return false; } - - gui_print("Restoring %s...\n", Display_Name.c_str()); - Command = "dd bs=4096 if='" + Full_FileName + "' of=" + Actual_Block_Device; - LOGINFO("Restore command: '%s'\n", Command.c_str()); - TWFunc::Exec_Cmd(Command); - display_percent = (double)(Restore_Size + *already_restored_size) / (double)(*total_restore_size) * 100; - sprintf(size_progress, "%lluMB of %lluMB, %i%%", (Restore_Size + *already_restored_size) / 1048576, *total_restore_size / 1048576, (int)(display_percent)); - DataManager::SetValue("tw_size_progress", size_progress); - progress_percent = (display_percent / 100); - DataManager::SetProgress((float)(progress_percent)); - *already_restored_size += Restore_Size; - return true; -} - -bool TWPartition::Restore_Flash_Image(string restore_folder, const unsigned long long *total_restore_size, unsigned long long *already_restored_size) { - string Full_FileName, Command; - double display_percent, progress_percent; - char size_progress[1024]; - - gui_print("Restoring %s...\n", Display_Name.c_str()); - Full_FileName = restore_folder + "/" + Backup_FileName; - // Sometimes flash image doesn't like to flash due to the first 2KB matching, so we erase first to ensure that it flashes - Command = "erase_image " + MTD_Name; - LOGINFO("Erase command: '%s'\n", Command.c_str()); - TWFunc::Exec_Cmd(Command); - Command = "flash_image " + MTD_Name + " '" + Full_FileName + "'"; - LOGINFO("Restore command: '%s'\n", Command.c_str()); - TWFunc::Exec_Cmd(Command); display_percent = (double)(Restore_Size + *already_restored_size) / (double)(*total_restore_size) * 100; sprintf(size_progress, "%lluMB of %lluMB, %i%%", (Restore_Size + *already_restored_size) / 1048576, *total_restore_size / 1048576, (int)(display_percent)); DataManager::SetValue("tw_size_progress", size_progress); @@ -2070,7 +2050,62 @@ uint64_t TWPartition::Get_Max_FileSize() { maxFileSize = 3.94 * constTB; //3.94 TB else maxFileSize = 100000000L; - LOGINFO("Get_Max_FileSize::maxFileSize: %\n", maxFileSize); + LOGINFO("Get_Max_FileSize::maxFileSize: %llu\n", maxFileSize); return maxFileSize - 1; } +bool TWPartition::Flash_Image(string Filename) { + string Restore_File_System; + + LOGINFO("Image filename is: %s\n", Filename.c_str()); + + if (Backup_Method == FILES) { + LOGERR("Cannot flash images to file systems\n"); + return false; + } else if (!Can_Flash_Img) { + LOGERR("Cannot flash images to partitions %s\n", Display_Name.c_str()); + return false; + } else { + if (!Find_Partition_Size()) { + LOGERR("Unable to find partition size for '%s'\n", Mount_Point.c_str()); + return false; + } + unsigned long long image_size = TWFunc::Get_File_Size(Filename); + if (image_size > Size) { + LOGERR("Size (%llu bytes) of image '%s' is larger than target device '%s' (%llu bytes)\n", + image_size, Filename.c_str(), Actual_Block_Device.c_str(), Size); + return false; + } + if (Backup_Method == DD) + return Flash_Image_DD(Filename); + else if (Backup_Method == FLASH_UTILS) + return Flash_Image_FI(Filename); + } + + LOGERR("Unknown flash method for '%s'\n", Mount_Point.c_str()); + return false; +} + +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; + LOGINFO("Flash command: '%s'\n", Command.c_str()); + TWFunc::Exec_Cmd(Command); + return true; +} + +bool TWPartition::Flash_Image_FI(string Filename) { + string Command; + + gui_print("Flashing %s...\n", Display_Name.c_str()); + // Sometimes flash image doesn't like to flash due to the first 2KB matching, so we erase first to ensure that it flashes + Command = "erase_image " + MTD_Name; + LOGINFO("Erase command: '%s'\n", Command.c_str()); + TWFunc::Exec_Cmd(Command); + Command = "flash_image " + MTD_Name + " '" + Filename + "'"; + LOGINFO("Flash command: '%s'\n", Command.c_str()); + TWFunc::Exec_Cmd(Command); + return true; +} diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 5d0fb018e..09ae5d2be 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -268,6 +268,8 @@ void TWPartitionManager::Output_Partition(TWPartition* Part) { printf("Retain_Layout_Version "); if (Part->Mount_To_Decrypt) printf("Mount_To_Decrypt "); + if (Part->Can_Flash_Img) + printf("Can_Flash_Img "); printf("\n"); if (!Part->SubPartition_Of.empty()) printf(" SubPartition_Of: %s\n", Part->SubPartition_Of.c_str()); @@ -1848,6 +1850,16 @@ void TWPartitionManager::Get_Partition_List(string ListType, std::vectorpush_back(datamedia); } } + } else if (ListType == "flashimg") { + for (iter = Partitions.begin(); iter != Partitions.end(); iter++) { + if ((*iter)->Can_Flash_Img && (*iter)->Is_Present) { + struct PartitionList part; + part.Display_Name = (*iter)->Backup_Display_Name; + part.Mount_Point = (*iter)->Backup_Path; + part.selected = 0; + Partition_List->push_back(part); + } + } } else { LOGERR("Unknown list type '%s' requested for TWPartitionManager::Get_Partition_List\n", ListType.c_str()); } @@ -2111,3 +2123,54 @@ bool TWPartitionManager::Remove_MTP_Storage(unsigned int Storage_ID) { #endif return false; } + +bool TWPartitionManager::Flash_Image(string Filename) { + int check, partition_count = 0; + TWPartition* flash_part = NULL; + string Flash_List, flash_path; + size_t start_pos = 0, end_pos = 0; + + gui_print("\n[IMAGE FLASH STARTED]\n\n"); + gui_print("Image to flash: '%s'\n", Filename.c_str()); + + if (!Mount_Current_Storage(true)) + return false; + + gui_print("Calculating restore details...\n"); + DataManager::GetValue("tw_flash_partition", Flash_List); + if (!Flash_List.empty()) { + end_pos = Flash_List.find(";", start_pos); + while (end_pos != string::npos && start_pos < Flash_List.size()) { + flash_path = Flash_List.substr(start_pos, end_pos - start_pos); + flash_part = Find_Partition_By_Path(flash_path); + if (flash_part != NULL) { + partition_count++; + if (partition_count > 1) { + LOGERR("Too many partitions selected for flashing.\n"); + return false; + } + } else { + LOGERR("Unable to locate '%s' partition for flashing (flash list).\n", flash_path.c_str()); + return false; + } + start_pos = end_pos + 1; + end_pos = Flash_List.find(";", start_pos); + } + } + + if (partition_count == 0) { + LOGERR("No partitions selected for flashing.\n"); + return false; + } + + DataManager::SetProgress(0.0); + if (flash_part) { + if (!flash_part->Flash_Image(Filename)) + return false; + } else { + LOGERR("Invalid flash partition specified.\n"); + return false; + } + gui_print_color("highlight", "[IMAGE FLASH COMPLETED]\n\n"); + return true; +} diff --git a/partitions.hpp b/partitions.hpp index 43f553547..f26d8e5d8 100644 --- a/partitions.hpp +++ b/partitions.hpp @@ -68,6 +68,7 @@ public: void Check_FS_Type(); // Checks the fs type using blkid, does not do anything on MTD / yaffs2 because this crashes on some devices bool Update_Size(bool Display_Error); // Updates size information void Recreate_Media_Folder(); // Recreates the /data/media folder + bool Flash_Image(string Filename); // Flashes an image to the partition public: string Current_File_System; // Current file system @@ -108,14 +109,15 @@ private: bool Backup_Dump_Image(string backup_folder); // Backs up using dump_image for MTD memory types string Get_Restore_File_System(string restore_folder); // Returns the file system that was in place at the time of the backup bool Restore_Tar(string restore_folder, string Restore_File_System, const unsigned long long *total_restore_size, unsigned long long *already_restored_size); // Restore using tar for file systems - bool Restore_DD(string restore_folder, const unsigned long long *total_restore_size, unsigned long long *already_restored_size); // Restore using dd for emmc memory types - bool Restore_Flash_Image(string restore_folder, const unsigned long long *total_restore_size, unsigned long long *already_restored_size); // Restore using flash_image for MTD memory types + bool Restore_Image(string restore_folder, const unsigned long long *total_restore_size, unsigned long long *already_restored_size, string Restore_File_System); // Restore using dd for images bool Get_Size_Via_statfs(bool Display_Error); // Get Partition size, used, and free space using statfs bool Get_Size_Via_df(bool Display_Error); // Get Partition size, used, and free space using df command bool Make_Dir(string Path, bool Display_Error); // Creates a directory if it doesn't already exist bool Find_MTD_Block_Device(string MTD_Name); // Finds the mtd block device based on the name from the fstab void Recreate_AndSec_Folder(void); // Recreates the .android_secure folder void Mount_Storage_Retry(void); // Tries multiple times with a half second delay to mount a device in case storage is slow to mount + bool Flash_Image_DD(string Filename); // Flashes an image to the partition using dd + bool Flash_Image_FI(string Filename); // Flashes an image to the partition using flash_image for mtd nand private: bool Can_Be_Mounted; // Indicates that the partition can be mounted @@ -163,6 +165,7 @@ private: int Format_Block_Size; // Block size for formatting bool Ignore_Blkid; // Ignore blkid results due to superblocks lying to us on certain devices / partitions bool Retain_Layout_Version; // Retains the .layout_version file during a wipe (needed on devices like Sony Xperia T where /data and /data/media are separate partitions) + bool Can_Flash_Img; // Indicates if this partition can have images flashed to it via the GUI friend class TWPartitionManager; friend class DataManager; @@ -219,6 +222,7 @@ public: bool Add_MTP_Storage(unsigned int Storage_ID); // Adds or removes an MTP Storage partition bool Remove_MTP_Storage(string Mount_Point); // Adds or removes an MTP Storage partition bool Remove_MTP_Storage(unsigned int Storage_ID); // Adds or removes an MTP Storage partition + bool Flash_Image(string Filename); // Flashes an image to a selected partition from the partition list private: void Setup_Settings_Storage_Partition(TWPartition* Part); // Sets up settings storage -- cgit v1.2.3