repack: update repacking
This will support updating the ramdisk to a different
compression format and co-exist with magisk.
We are also moving twrp repacking to its own class. We
check the new ramdisk format and if it's different
we have magisk compress using the new ramdisk format.
Change-Id: I770030aae7797e75817178b2f0fccd9f39dc23af
diff --git a/partitions.hpp b/partitions.hpp
index 4510281..dba9be8 100755
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -76,19 +76,6 @@
char* fstab_line;
};
-enum Repack_Type {
- REPLACE_NONE = 0,
- REPLACE_RAMDISK = 1,
- REPLACE_KERNEL = 2,
-};
-
-struct Repack_Options_struct {
- Repack_Type Type;
- bool Backup_First;
- bool Disable_Verity;
- bool Disable_Force_Encrypt;
-};
-
enum PartitionManager_Op { // PartitionManager Restore Mode for Raw_Read_Write()
PM_BACKUP = 0,
PM_RESTORE = 1,
@@ -160,9 +147,12 @@
int Decrypt_Adopted();
void Revert_Adopted();
void Partition_Post_Processing(bool Display_Error); // Apply partition specific settings after fstab processed
- void Set_Backup_FileName(string fname); // Set Backup_FileName for partition
+ void Set_Backup_FileName(string fname); // Set backup filename for partition
+ std::string Get_Backup_FileName(); // Get the backup filename for the partition
string Get_Backup_Name(); // Get Backup_Name for partition
bool Decrypt_FBE_DE(); // If FBE is present, backup exclusions are set up and DE decrypt is attempted
+ std::string Get_Display_Name(); // Get the display name in the gui for the partition
+ bool Is_SlotSelect(); // Return whether the partition is a slot partition or not
public:
string Current_File_System; // Current file system
@@ -390,9 +380,6 @@
void read_uevent(); // Reads uevent data into a buffer
void close_uevent(); // Closes the uevent netlink socket
void Add_Partition(TWPartition* Part); // Adds a new partition to the Partitions vector
- bool Prepare_Repack(TWPartition* Part, const std::string& Temp_Folder_Destination, const bool Create_Backup, const std::string& Backup_Name); // Prepares an image for repacking by unpacking it to the temp folder destination
- bool Prepare_Repack(const std::string& Source_Path, const std::string& Temp_Folder_Destination, const bool Copy_Source, const bool Create_Destination = true); // Prepares an image for repacking by unpacking it to the temp folder destination
- bool Repack_Images(const std::string& Target_Image, const struct Repack_Options_struct& Repack_Options); // Repacks the boot image with a new kernel or a new ramdisk
std::vector<users_struct>* Get_Users_List(); // Returns pointer to list of users
int Set_FDE_Encrypt_Status(); // Sets encryption state for FDE devices (ro.crypto.state and ro.crypto.type)
@@ -415,6 +402,8 @@
Backup_Method_enum Backup_Method; // Method used for backup
void Mark_User_Decrypted(int userID); // Marks given user ID in Users_List as decrypted
void Check_Users_Decryption_Status(); // Checks to see if all users are decrypted
+ std::string original_ramdisk_format; // Ramdisk format of boot partition
+ std::string repacked_ramdisk_format; // Ramdisk format of boot image to repack from
private:
std::vector<TWPartition*> Partitions; // Vector list of all partitions