Fix direct install on NAND devices

Co-authored-by: John Wu <topjohnwu@gmail.com>
This commit is contained in:
Chris Renshaw 2020-06-01 02:08:13 -07:00 committed by topjohnwu
parent 02b2290b16
commit ad94f10205
2 changed files with 12 additions and 2 deletions

View File

@ -239,6 +239,12 @@ abstract class MagiskInstallImpl : FlashResultListener {
}
private fun patchBoot(): Boolean {
var srcNand = ""
if ("[ -c $srcBoot ] && nanddump -f boot.img $srcBoot".sh().isSuccess) {
srcNand = srcBoot
srcBoot = File(installDir, "boot.img").path
}
var isSigned = false
try {
SuFileInputStream(srcBoot).use {
@ -258,6 +264,10 @@ abstract class MagiskInstallImpl : FlashResultListener {
return false
}
if (srcNand.isNotEmpty()) {
srcBoot = srcNand
}
val job = Shell.sh(
"./magiskboot cleanup",
"mv bin/busybox busybox",

View File

@ -411,8 +411,8 @@ flash_image() {
[ $img_sz -gt $blk_sz ] && return 1
eval $CMD1 | eval $CMD2 | cat - /dev/zero > "$2" 2>/dev/null
elif [ -c "$2" ]; then
flash_eraseall "$2"
eval $CMD1 | eval $CMD2 | nandwrite -p "$2" -
flash_eraseall "$2" >&2
eval $CMD1 | eval $CMD2 | nandwrite -p "$2" - >&2
else
ui_print "- Not block or char device, storing image"
eval $CMD1 | eval $CMD2 > "$2" 2>/dev/null