mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +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) {
|
while (tarIn.nextEntry?.let { entry = it } != null) {
|
||||||
if (entry.name.startsWith("boot.img") ||
|
if (entry.name.startsWith("boot.img") ||
|
||||||
|
entry.name.startsWith("init_boot.img") ||
|
||||||
(Config.recovery && entry.name.contains("recovery.img"))) {
|
(Config.recovery && entry.name.contains("recovery.img"))) {
|
||||||
val name = entry.name.replace(".lz4", "")
|
val name = entry.name.replace(".lz4", "")
|
||||||
console.add("-- Extracting: $name")
|
console.add("-- Extracting: $name")
|
||||||
@ -216,6 +217,7 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val boot = installDir.getChildFile("boot.img")
|
val boot = installDir.getChildFile("boot.img")
|
||||||
|
val initBoot = installDir.getChildFile("init_boot.img")
|
||||||
val recovery = installDir.getChildFile("recovery.img")
|
val recovery = installDir.getChildFile("recovery.img")
|
||||||
if (Config.recovery && recovery.exists() && boot.exists()) {
|
if (Config.recovery && recovery.exists() && boot.exists()) {
|
||||||
// Install to recovery
|
// Install to recovery
|
||||||
@ -236,11 +238,15 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
}
|
}
|
||||||
boot.delete()
|
boot.delete()
|
||||||
} else {
|
} else {
|
||||||
|
if (!initBoot.exists()) {
|
||||||
if (!boot.exists()) {
|
if (!boot.exists()) {
|
||||||
console.add("! No boot image found")
|
console.add("! No boot image found")
|
||||||
throw IOException()
|
throw IOException()
|
||||||
}
|
}
|
||||||
srcBoot = boot
|
srcBoot = boot
|
||||||
|
} else {
|
||||||
|
srcBoot = initBoot
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tarOut
|
return tarOut
|
||||||
}
|
}
|
||||||
@ -300,7 +306,14 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
try {
|
try {
|
||||||
val newBoot = installDir.getChildFile("new-boot.img")
|
val newBoot = installDir.getChildFile("new-boot.img")
|
||||||
if (outStream is TarOutputStream) {
|
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()))
|
outStream.putNextEntry(newTarEntry(name, newBoot.length()))
|
||||||
}
|
}
|
||||||
newBoot.newInputStream().cleanPump(outStream)
|
newBoot.newInputStream().cleanPump(outStream)
|
||||||
|
Loading…
Reference in New Issue
Block a user