diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt index 60a6b5123..51e891004 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt @@ -190,6 +190,7 @@ abstract class MagiskInstallImpl protected constructor( while (tarIn.nextEntry?.let { entry = it } != null) { if (entry.name.startsWith("boot.img") || + entry.name.startsWith("init_boot.img") || (Config.recovery && entry.name.contains("recovery.img"))) { val name = entry.name.replace(".lz4", "") console.add("-- Extracting: $name") @@ -216,6 +217,7 @@ abstract class MagiskInstallImpl protected constructor( } } val boot = installDir.getChildFile("boot.img") + val initBoot = installDir.getChildFile("init_boot.img") val recovery = installDir.getChildFile("recovery.img") if (Config.recovery && recovery.exists() && boot.exists()) { // Install to recovery @@ -236,11 +238,15 @@ abstract class MagiskInstallImpl protected constructor( } boot.delete() } else { - if (!boot.exists()) { - console.add("! No boot image found") - throw IOException() + if (!initBoot.exists()) { + if (!boot.exists()) { + console.add("! No boot image found") + throw IOException() + } + srcBoot = boot + } else { + srcBoot = initBoot } - srcBoot = boot } return tarOut } @@ -300,7 +306,14 @@ abstract class MagiskInstallImpl protected constructor( try { val newBoot = installDir.getChildFile("new-boot.img") if (outStream is TarOutputStream) { - val name = if (srcBoot.path.contains("recovery")) "recovery.img" else "boot.img" + val name = + if (srcBoot.path.contains("recovery")) { + "recovery.img" + } else if (srcBoot.path.contains("init_boot")) { + "init_boot.img" + } else { + "boot.img" + } outStream.putNextEntry(newTarEntry(name, newBoot.length())) } newBoot.newInputStream().cleanPump(outStream)