Don't need to find system_dev

This commit is contained in:
topjohnwu 2020-03-31 22:41:25 -07:00
parent 5537b083a8
commit 543ce937ec
4 changed files with 4 additions and 15 deletions

View File

@ -17,7 +17,7 @@ buildscript {
maven { url 'https://kotlin.bintray.com/kotlinx' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${vKotlin}"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$vNav"

View File

@ -66,7 +66,6 @@ public:
class SARBase : public MagiskInit {
protected:
raw_data config;
dev_t system_dev;
void backup_files(const char *self_path);
void patch_rootdir();

View File

@ -218,7 +218,6 @@ void SARInit::early_mount() {
exit(1);
}
}
system_dev = dev;
xmkdir("/system_root", 0755);
if (xmount("/dev/root", "/system_root", "ext4", MS_RDONLY, nullptr))
xmount("/dev/root", "/system_root", "erofs", MS_RDONLY, nullptr);
@ -237,17 +236,6 @@ void SecondStageInit::early_mount() {
rm_rf("/.backup");
rm_rf("/overlay.d");
// Find system_dev
parse_mnt("/proc/mounts", [&](mntent *me) -> bool {
if (me->mnt_dir == "/system_root"sv) {
struct stat st;
stat(me->mnt_fsname, &st);
system_dev = st.st_rdev;
return false;
}
return true;
});
switch_root("/system_root");
}

View File

@ -270,8 +270,10 @@ void SARBase::patch_rootdir() {
sbin_overlay(self, config);
// Mount system_root mirror
struct stat st;
xstat("/", &st);
xmkdir(ROOTMIR, 0755);
mknod(ROOTBLK, S_IFBLK | 0600, system_dev);
mknod(ROOTBLK, S_IFBLK | 0600, st.st_dev);
if (xmount(ROOTBLK, ROOTMIR, "ext4", MS_RDONLY, nullptr))
xmount(ROOTBLK, ROOTMIR, "erofs", MS_RDONLY, nullptr);