Move nand flash handling into boot_patch.sh
This commit is contained in:
parent
e92d77bbec
commit
3f0136362b
@ -327,23 +327,19 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
private fun patchBoot(): Boolean {
|
private fun patchBoot(): Boolean {
|
||||||
"cd $installDir".sh()
|
"cd $installDir".sh()
|
||||||
|
|
||||||
var srcNand: File? = null
|
var isSigned = false
|
||||||
if ("[ -c $srcBoot ] && nanddump -f boot.img $srcBoot".sh().isSuccess) {
|
if (srcBoot.let { it !is SuFile || !it.isCharacter }) {
|
||||||
srcNand = srcBoot
|
try {
|
||||||
srcBoot = installDirFile("boot.img")
|
SuFileInputStream(srcBoot).use {
|
||||||
}
|
if (SignBoot.verifySignature(it, null)) {
|
||||||
|
isSigned = true
|
||||||
var isSigned: Boolean
|
console.add("- Boot image is signed with AVB 1.0")
|
||||||
try {
|
}
|
||||||
SuFileInputStream(srcBoot).use {
|
|
||||||
isSigned = SignBoot.verifySignature(it, null)
|
|
||||||
if (isSigned) {
|
|
||||||
console.add("- Boot image is signed with AVB 1.0")
|
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
console.add("! Unable to check signature")
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
} catch (e: IOException) {
|
|
||||||
console.add("! Unable to check signature")
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val FLAGS =
|
val FLAGS =
|
||||||
@ -354,9 +350,6 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
if (!"$FLAGS sh boot_patch.sh $srcBoot".sh().isSuccess)
|
if (!"$FLAGS sh boot_patch.sh $srcBoot".sh().isSuccess)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (srcNand != null)
|
|
||||||
srcBoot = srcNand
|
|
||||||
|
|
||||||
val job = Shell.sh("./magiskboot cleanup", "cd /")
|
val job = Shell.sh("./magiskboot cleanup", "cd /")
|
||||||
|
|
||||||
val patched = installDirFile("new-boot.img")
|
val patched = installDirFile("new-boot.img")
|
||||||
|
@ -60,6 +60,13 @@ fi
|
|||||||
BOOTIMAGE="$1"
|
BOOTIMAGE="$1"
|
||||||
[ -e "$BOOTIMAGE" ] || abort "$BOOTIMAGE does not exist!"
|
[ -e "$BOOTIMAGE" ] || abort "$BOOTIMAGE does not exist!"
|
||||||
|
|
||||||
|
# Dump image for MTD/NAND character device boot partitions
|
||||||
|
if [ -c "$BOOTIMAGE" ]; then
|
||||||
|
nanddump -f boot.img "$BOOTIMAGE"
|
||||||
|
BOOTNAND="$BOOTIMAGE"
|
||||||
|
BOOTIMAGE=boot.img
|
||||||
|
fi
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
[ -z $KEEPVERITY ] && KEEPVERITY=false
|
[ -z $KEEPVERITY ] && KEEPVERITY=false
|
||||||
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
|
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
|
||||||
@ -188,5 +195,8 @@ ui_print "- Repacking boot image"
|
|||||||
# Sign chromeos boot
|
# Sign chromeos boot
|
||||||
$CHROMEOS && sign_chromeos
|
$CHROMEOS && sign_chromeos
|
||||||
|
|
||||||
|
# Restore the original boot partition path
|
||||||
|
[ -e "$BOOTNAND" ] && BOOTIMAGE="$BOOTNAND"
|
||||||
|
|
||||||
# Reset any error code
|
# Reset any error code
|
||||||
true
|
true
|
||||||
|
@ -438,14 +438,7 @@ flash_image() {
|
|||||||
install_magisk() {
|
install_magisk() {
|
||||||
cd $MAGISKBIN
|
cd $MAGISKBIN
|
||||||
|
|
||||||
# Dump image for MTD/NAND character device boot partitions
|
if [ $API -ge 21 -a ! -c $BOOTIMAGE ]; then
|
||||||
if [ -c $BOOTIMAGE ]; then
|
|
||||||
nanddump -f boot.img $BOOTIMAGE
|
|
||||||
local BOOTNAND=$BOOTIMAGE
|
|
||||||
BOOTIMAGE=boot.img
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $API -ge 21 ]; then
|
|
||||||
eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true
|
eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true
|
||||||
$BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0"
|
$BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0"
|
||||||
fi
|
fi
|
||||||
@ -455,9 +448,6 @@ install_magisk() {
|
|||||||
. ./boot_patch.sh "$BOOTIMAGE"
|
. ./boot_patch.sh "$BOOTIMAGE"
|
||||||
|
|
||||||
ui_print "- Flashing new boot image"
|
ui_print "- Flashing new boot image"
|
||||||
|
|
||||||
# Restore the original boot partition path
|
|
||||||
[ "$BOOTNAND" ] && BOOTIMAGE=$BOOTNAND
|
|
||||||
flash_image new-boot.img "$BOOTIMAGE"
|
flash_image new-boot.img "$BOOTIMAGE"
|
||||||
case $? in
|
case $? in
|
||||||
1)
|
1)
|
||||||
|
Loading…
Reference in New Issue
Block a user