From b6c24a3a8ae2cc96ae977aa97a48a87589c6ca4d Mon Sep 17 00:00:00 2001 From: LoveSy Date: Wed, 17 Jan 2024 15:13:44 +0800 Subject: [PATCH] No more sony `init.real` tricks Co-authored-by: canyie Co-authored-by: vvb2060 --- docs/tools.md | 2 +- native/src/boot/cpio.rs | 2 +- native/src/boot/ramdisk.rs | 4 ---- native/src/init/getinfo.cpp | 6 ------ scripts/boot_patch.sh | 8 +------- 5 files changed, 3 insertions(+), 19 deletions(-) diff --git a/docs/tools.md b/docs/tools.md index 3d2448ffe..6900c7e52 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -97,7 +97,7 @@ Supported actions: test Test the cpio's status Return value is 0 or bitwise or-ed of following values: - 0x1:Magisk 0x2:unsupported 0x4:Sony + 0x1:Magisk 0x2:unsupported patch Apply ramdisk patches Configure with env variables: KEEPVERITY KEEPFORCEENCRYPT diff --git a/native/src/boot/cpio.rs b/native/src/boot/cpio.rs index 8a1ad1347..b613d9c12 100644 --- a/native/src/boot/cpio.rs +++ b/native/src/boot/cpio.rs @@ -176,7 +176,7 @@ Supported commands: test Test the cpio's status Return value is 0 or bitwise or-ed of following values: - 0x1:Magisk 0x2:unsupported 0x4:Sony + 0x1:Magisk 0x2:unsupported patch Apply ramdisk patches Configure with env variables: KEEPVERITY KEEPFORCEENCRYPT diff --git a/native/src/boot/ramdisk.rs b/native/src/boot/ramdisk.rs index b0c51425e..f63713195 100644 --- a/native/src/boot/ramdisk.rs +++ b/native/src/boot/ramdisk.rs @@ -18,7 +18,6 @@ pub trait MagiskCpio { const MAGISK_PATCHED: i32 = 1 << 0; const UNSUPPORTED_CPIO: i32 = 1 << 1; -const SONY_INIT: i32 = 1 << 2; impl MagiskCpio for Cpio { fn patch(&mut self) { @@ -78,9 +77,6 @@ impl MagiskCpio for Cpio { break; } } - if self.exists("init.real") { - ret |= SONY_INIT; - } ret } diff --git a/native/src/init/getinfo.cpp b/native/src/init/getinfo.cpp index d2d9be2b5..7832d4815 100644 --- a/native/src/init/getinfo.cpp +++ b/native/src/init/getinfo.cpp @@ -228,12 +228,6 @@ void unxz_init(const char *init_xz, const char *init) { } const char *backup_init() { - if (access("/.backup/init.real", F_OK) == 0) - return "/.backup/init.real"; - if (access("/.backup/init.real.xz", F_OK) == 0) { - unxz_init("/.backup/init.real.xz", "/.backup/init.real"); - return "/.backup/init.real"; - } if (access("/.backup/init.xz", F_OK) == 0) unxz_init("/.backup/init.xz", "/.backup/init"); return "/.backup/init"; diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index a3cca2167..b7a081aa7 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -139,12 +139,6 @@ case $((STATUS & 3)) in ;; esac -# Workaround custom legacy Sony /init -> /(s)bin/init_sony : /init.real setup -INIT=init -if [ $((STATUS & 4)) -ne 0 ]; then - INIT=init.real -fi - if [ -f config.orig ]; then # Read existing configs chmod 0644 config.orig @@ -187,7 +181,7 @@ fi [ -n "$SHA1" ] && echo "SHA1=$SHA1" >> config ./magiskboot cpio ramdisk.cpio \ -"add 0750 $INIT magiskinit" \ +"add 0750 init magiskinit" \ "mkdir 0750 overlay.d" \ "mkdir 0750 overlay.d/sbin" \ "$SKIP32 add 0644 overlay.d/sbin/magisk32.xz magisk32.xz" \