mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Add init_boot.img
patching for Samsung tar firmware packages
Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com>
This commit is contained in:
parent
459088024f
commit
584bad5314
@ -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 (!initBoot.exists()) {
|
||||
if (!boot.exists()) {
|
||||
console.add("! No boot image found")
|
||||
throw IOException()
|
||||
}
|
||||
srcBoot = boot
|
||||
} else {
|
||||
srcBoot = initBoot
|
||||
}
|
||||
}
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user