mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 18:57:37 +00:00
Fix legacy rootfs devices
This commit is contained in:
parent
4cc41eccb3
commit
3e479726ec
@ -28,6 +28,6 @@ kapt.incremental.apt=true
|
|||||||
|
|
||||||
# Magisk
|
# Magisk
|
||||||
magisk.stubVersion=16
|
magisk.stubVersion=16
|
||||||
magisk.versionCode=21402
|
magisk.versionCode=21403
|
||||||
magisk.ndkVersion=21d
|
magisk.ndkVersion=21d
|
||||||
magisk.fullNdkVersion=21.3.6528147
|
magisk.fullNdkVersion=21.3.6528147
|
||||||
|
@ -14,7 +14,7 @@ android {
|
|||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
ndkBuild {
|
ndkBuild {
|
||||||
// Pass arguments to ndk-build.
|
// Pass arguments to ndk-build.
|
||||||
arguments("B_MAGISK=1", "B_INIT64=1", "B_BOOT=1", "B_TEST=1",
|
arguments("B_MAGISK=1", "B_INIT=1", "B_BOOT=1", "B_TEST=1",
|
||||||
"MAGISK_DEBUG=1", "MAGISK_VERSION=debug", "MAGISK_VER_CODE=INT_MAX")
|
"MAGISK_DEBUG=1", "MAGISK_VERSION=debug", "MAGISK_VER_CODE=INT_MAX")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ static int64_t setup_block(bool write_block) {
|
|||||||
sprintf(blk_info.block_dev, "/dev/block/%s", dev.devname);
|
sprintf(blk_info.block_dev, "/dev/block/%s", dev.devname);
|
||||||
}
|
}
|
||||||
dev_t rdev = makedev(dev.major, dev.minor);
|
dev_t rdev = makedev(dev.major, dev.minor);
|
||||||
mknod(blk_info.block_dev, S_IFBLK | 0600, rdev);
|
xmknod(blk_info.block_dev, S_IFBLK | 0600, rdev);
|
||||||
return rdev;
|
return rdev;
|
||||||
}
|
}
|
||||||
// Wait 10ms and try again
|
// Wait 10ms and try again
|
||||||
|
@ -322,8 +322,14 @@ void SARBase::patch_rootdir() {
|
|||||||
#define TMP_RULESDIR "/.backup/.sepolicy.rules"
|
#define TMP_RULESDIR "/.backup/.sepolicy.rules"
|
||||||
|
|
||||||
void RootFSInit::patch_rootfs() {
|
void RootFSInit::patch_rootfs() {
|
||||||
|
// Create hardlink mirror of /sbin to /root
|
||||||
|
mkdir("/root", 0777);
|
||||||
|
clone_attr("/sbin", "/root");
|
||||||
|
link_path("/sbin", "/root");
|
||||||
|
|
||||||
// Handle custom sepolicy rules
|
// Handle custom sepolicy rules
|
||||||
xmkdir(TMP_MNTDIR, 0755);
|
xmkdir(TMP_MNTDIR, 0755);
|
||||||
|
xmkdir("/dev/block", 0755);
|
||||||
mount_rules_dir("/dev/block", TMP_MNTDIR);
|
mount_rules_dir("/dev/block", TMP_MNTDIR);
|
||||||
// Preserve custom rule path
|
// Preserve custom rule path
|
||||||
if (!custom_rules_dir.empty()) {
|
if (!custom_rules_dir.empty()) {
|
||||||
@ -346,11 +352,6 @@ void RootFSInit::patch_rootfs() {
|
|||||||
patch_init_rc("/init.rc", "/init.p.rc", "/sbin");
|
patch_init_rc("/init.rc", "/init.p.rc", "/sbin");
|
||||||
rename("/init.p.rc", "/init.rc");
|
rename("/init.p.rc", "/init.rc");
|
||||||
|
|
||||||
// Create hardlink mirror of /sbin to /root
|
|
||||||
mkdir("/root", 0750);
|
|
||||||
clone_attr("/sbin", "/root");
|
|
||||||
link_path("/sbin", "/root");
|
|
||||||
|
|
||||||
// Dump magiskinit as magisk
|
// Dump magiskinit as magisk
|
||||||
int fd = xopen("/sbin/magisk", O_WRONLY | O_CREAT, 0755);
|
int fd = xopen("/sbin/magisk", O_WRONLY | O_CREAT, 0755);
|
||||||
write(fd, self.buf, self.sz);
|
write(fd, self.buf, self.sz);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user