mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-25 21:37:24 +00:00
Add separate product partition support
This commit is contained in:
parent
f1112fdf37
commit
e8b73ba6d1
@ -88,12 +88,14 @@ node_entry::~node_entry() {
|
|||||||
delete node;
|
delete node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SPECIAL_NODE (parent->parent ? false : (name == "vendor" || name == "product"))
|
||||||
|
|
||||||
bool node_entry::is_special() {
|
bool node_entry::is_special() {
|
||||||
return parent ? (parent->parent ? false : name == "vendor") : false;
|
return parent ? SPECIAL_NODE : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool node_entry::is_root() {
|
bool node_entry::is_root() {
|
||||||
return parent ? (parent->parent ? false : name == "vendor") : true;
|
return parent ? SPECIAL_NODE : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string node_entry::get_path() {
|
string node_entry::get_path() {
|
||||||
@ -374,6 +376,8 @@ static bool magisk_env() {
|
|||||||
mount_mirror(system, MS_RDONLY);
|
mount_mirror(system, MS_RDONLY);
|
||||||
} else if (DIR_IS(vendor)) {
|
} else if (DIR_IS(vendor)) {
|
||||||
mount_mirror(vendor, MS_RDONLY);
|
mount_mirror(vendor, MS_RDONLY);
|
||||||
|
} else if (DIR_IS(product)) {
|
||||||
|
mount_mirror(product, MS_RDONLY);
|
||||||
} else if (DIR_IS(data) && me->mnt_type != "tmpfs"sv) {
|
} else if (DIR_IS(data) && me->mnt_type != "tmpfs"sv) {
|
||||||
mount_mirror(data, 0);
|
mount_mirror(data, 0);
|
||||||
} else if (SDK_INT >= 24 && DIR_IS(proc) && !strstr(me->mnt_opts, "hidepid=2")) {
|
} else if (SDK_INT >= 24 && DIR_IS(proc) && !strstr(me->mnt_opts, "hidepid=2")) {
|
||||||
@ -661,6 +665,13 @@ void post_fs_data(int client) {
|
|||||||
unlink(buf2);
|
unlink(buf2);
|
||||||
xsymlink(buf, buf2);
|
xsymlink(buf, buf2);
|
||||||
}
|
}
|
||||||
|
// If /system/product exists in module, create a link outside
|
||||||
|
snprintf(buf, PATH_MAX, "%s/%s/system/product", MODULEROOT, module);
|
||||||
|
if (access(buf, F_OK) == 0) {
|
||||||
|
snprintf(buf2, PATH_MAX, "%s/%s/product", MODULEROOT, module);
|
||||||
|
unlink(buf2);
|
||||||
|
xsymlink(buf, buf2);
|
||||||
|
}
|
||||||
sys_root->create_module_tree(module);
|
sys_root->create_module_tree(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,6 +682,10 @@ void post_fs_data(int client) {
|
|||||||
special->magic_mount();
|
special->magic_mount();
|
||||||
delete special;
|
delete special;
|
||||||
}
|
}
|
||||||
|
if ((special = sys_root->extract("product"))) {
|
||||||
|
special->magic_mount();
|
||||||
|
delete special;
|
||||||
|
}
|
||||||
|
|
||||||
sys_root->magic_mount();
|
sys_root->magic_mount();
|
||||||
}
|
}
|
||||||
|
@ -201,9 +201,9 @@ void SARCommon::patch_rootdir() {
|
|||||||
sbin_overlay(self, config);
|
sbin_overlay(self, config);
|
||||||
|
|
||||||
// Mount system_root mirror
|
// Mount system_root mirror
|
||||||
xmkdir(MIRRDIR, 0777);
|
xmkdir(MIRRDIR, 0);
|
||||||
xmkdir(ROOTMIR, 0777);
|
xmkdir(ROOTMIR, 0755);
|
||||||
xmkdir(BLOCKDIR, 0777);
|
xmkdir(BLOCKDIR, 0);
|
||||||
mknod(ROOTBLK, S_IFBLK | 0600, system_dev);
|
mknod(ROOTBLK, S_IFBLK | 0600, system_dev);
|
||||||
if (xmount(ROOTBLK, ROOTMIR, "ext4", MS_RDONLY, nullptr))
|
if (xmount(ROOTBLK, ROOTMIR, "ext4", MS_RDONLY, nullptr))
|
||||||
xmount(ROOTBLK, ROOTMIR, "erofs", MS_RDONLY, nullptr);
|
xmount(ROOTBLK, ROOTMIR, "erofs", MS_RDONLY, nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user