mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 10:35:26 +00:00
init: support 2SI devices with skip_initramfs
This commit is contained in:
parent
8e82113bce
commit
b38fd1ca5f
@ -230,7 +230,9 @@ kv_pairs load_partition_map() {
|
||||
}
|
||||
|
||||
bool check_two_stage() {
|
||||
if (access("/apex", F_OK) == 0)
|
||||
if (access("/first_stage_ramdisk", F_OK) == 0)
|
||||
return true;
|
||||
if (access("/second_stage_resources", F_OK) == 0)
|
||||
return true;
|
||||
if (access("/system/bin/init", F_OK) == 0)
|
||||
return true;
|
||||
|
@ -90,15 +90,17 @@ int main(int argc, char *argv[]) {
|
||||
} else {
|
||||
// This will also mount /sys and /proc
|
||||
load_kernel_info(&config);
|
||||
bool recovery = access("/sbin/recovery", F_OK) == 0 ||
|
||||
access("/system/bin/recovery", F_OK) == 0;
|
||||
|
||||
if (config.skip_initramfs)
|
||||
if (config.force_normal_boot)
|
||||
init = new FirstStageInit(argv, &config);
|
||||
else if (!recovery && check_two_stage())
|
||||
init = new FirstStageInit(argv, &config);
|
||||
else if (config.skip_initramfs)
|
||||
init = new LegacySARInit(argv, &config);
|
||||
else if (config.force_normal_boot)
|
||||
init = new FirstStageInit(argv, &config);
|
||||
else if (access("/sbin/recovery", F_OK) == 0 || access("/system/bin/recovery", F_OK) == 0)
|
||||
else if (recovery)
|
||||
init = new RecoveryInit(argv, &config);
|
||||
else if (check_two_stage())
|
||||
init = new FirstStageInit(argv, &config);
|
||||
else
|
||||
init = new RootFSInit(argv, &config);
|
||||
}
|
||||
|
@ -200,8 +200,7 @@ mount_root:
|
||||
xmount("tmpfs", "/dev", "tmpfs", 0, "mode=755");
|
||||
mount_list.emplace_back("/dev");
|
||||
|
||||
// Use the apex folder to determine whether 2SI (Android 10+)
|
||||
bool is_two_stage = access("/apex", F_OK) == 0;
|
||||
bool is_two_stage = access("/system/bin/init", F_OK) == 0;
|
||||
LOGD("is_two_stage: [%d]\n", is_two_stage);
|
||||
|
||||
// For API 28 AVD, it uses legacy SAR setup that requires
|
||||
|
Loading…
Reference in New Issue
Block a user