mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-07 02:04:52 -08:00
Eliminate unnecessarily copy on magiskinit
This patch reuses the abused /data tmpfs for magisktmp
This commit is contained in:
@@ -25,6 +25,7 @@ struct BootConfig {
|
||||
|
||||
#define DEFAULT_DT_DIR "/proc/device-tree/firmware/android"
|
||||
#define INIT_PATH "/system/bin/init"
|
||||
#define REDIR_PATH "/data/magiskinit"
|
||||
|
||||
extern std::vector<std::string> mount_list;
|
||||
|
||||
@@ -48,6 +49,7 @@ protected:
|
||||
char **argv = nullptr;
|
||||
|
||||
[[noreturn]] void exec_init();
|
||||
void prepare_data();
|
||||
public:
|
||||
BaseInit(char *argv[], BootConfig *config = nullptr) : config(config), argv(argv) {}
|
||||
virtual ~BaseInit() = default;
|
||||
@@ -58,8 +60,6 @@ class MagiskInit : public BaseInit {
|
||||
private:
|
||||
void mount_rules_dir();
|
||||
protected:
|
||||
mmap_data self;
|
||||
mmap_data magisk_cfg;
|
||||
std::string custom_rules_dir;
|
||||
|
||||
#if ENABLE_AVD_HACK
|
||||
@@ -72,16 +72,12 @@ protected:
|
||||
bool hijack_sepolicy();
|
||||
void setup_tmp(const char *path);
|
||||
void patch_rw_root();
|
||||
void patch_ro_root();
|
||||
public:
|
||||
using BaseInit::BaseInit;
|
||||
};
|
||||
|
||||
class SARBase : public MagiskInit {
|
||||
protected:
|
||||
std::vector<raw_file> overlays;
|
||||
|
||||
void backup_files();
|
||||
void patch_ro_root();
|
||||
public:
|
||||
using MagiskInit::MagiskInit;
|
||||
};
|
||||
@@ -134,6 +130,7 @@ public:
|
||||
LOGD("%s\n", __FUNCTION__);
|
||||
};
|
||||
void start() override {
|
||||
prepare_data();
|
||||
if (mount_system_root())
|
||||
first_stage_prep();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user