mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 12:39:49 +00:00
Support custom legacy Sony devices with init.real setup
Custom ROM bring-ups of legacy Sony devices contain the following: /init (symlink to /bin/init_sony) /init.real (the "real" Android init) /bin/init_sony (this was /sbin/init_sony on Android <11) Kernel loads the ramdisk and starts /init -> /bin/init_sony /bin/init_sony does low-level device setup (see: https://github.com/LineageOS/android_device_sony_common/blob/lineage-18.1/init/init_main.cpp) /bin/init_sony unlinks /init and renames /init.real to /init /bin/init_sony starts /init Since init_sony needs to run first magiskinit needs to replace init.real instead, so add workarounds based on detection of init.real to boot patcher and uninstaller Thanks @115ek and @bleckdeth Fixes #3636 Co-authored-by: topjohnwu <topjohnwu@gmail.com>
This commit is contained in:
@@ -58,9 +58,9 @@ Supported actions:
|
||||
extract [ENTRY OUT]
|
||||
Extract ENTRY to OUT, or extract all entries to current directory
|
||||
test
|
||||
Test the current cpio's patch status
|
||||
Return values:
|
||||
0:stock 1:Magisk 2:unsupported (phh, SuperSU, Xposed)
|
||||
Test the current cpio's status
|
||||
Return value is 0 or bitwise or-ed of following values:
|
||||
0x1:Magisk 0x2:unsupported 0x4:Sony
|
||||
patch
|
||||
Apply ramdisk patches
|
||||
Configure with env variables: KEEPVERITY KEEPFORCEENCRYPT
|
||||
|
@@ -59,11 +59,12 @@ void magisk_cpio::patch() {
|
||||
}
|
||||
}
|
||||
|
||||
#define STOCK_BOOT 0
|
||||
#define MAGISK_PATCHED (1 << 0)
|
||||
#define UNSUPPORTED_CPIO (1 << 1)
|
||||
#define SONY_INIT (1 << 2)
|
||||
|
||||
int magisk_cpio::test() {
|
||||
int ret = 0;
|
||||
for (auto file : UNSUPPORT_LIST) {
|
||||
if (exists(file)) {
|
||||
return UNSUPPORTED_CPIO;
|
||||
@@ -71,10 +72,13 @@ int magisk_cpio::test() {
|
||||
}
|
||||
for (auto file : MAGISK_LIST) {
|
||||
if (exists(file)) {
|
||||
return MAGISK_PATCHED;
|
||||
ret |= MAGISK_PATCHED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return STOCK_BOOT;
|
||||
if (exists("init.real"))
|
||||
ret |= SONY_INIT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define for_each_line(line, buf, size) \
|
||||
|
Reference in New Issue
Block a user