Update dtb patch to not use in-place modification

This commit is contained in:
topjohnwu
2019-09-21 05:30:04 -04:00
parent 120668c7bc
commit 4d91e50d6d
7 changed files with 86 additions and 98 deletions

View File

@ -158,7 +158,7 @@ rm -f ramdisk.cpio.orig config
if ! $KEEPVERITY; then
for dt in dtb kernel_dtb extra recovery_dtbo; do
[ -f $dt ] && ./magiskboot dtb-patch $dt && ui_print "- Removing dm(avb)-verity in $dt"
[ -f $dt ] && ./magiskboot dtb $dt patch && ui_print "- Removing dm(avb)-verity in $dt"
done
fi

View File

@ -280,11 +280,13 @@ patch_dtbo_image() {
find_dtbo_image
if [ ! -z $DTBOIMAGE ]; then
ui_print "- DTBO image: $DTBOIMAGE"
if $MAGISKBIN/magiskboot --dtb-test $DTBOIMAGE; then
local PATCHED=$TMPDIR/dtbo
if $MAGISKBIN/magiskboot dtb $DTBOIMAGE patch $PATCHED; then
ui_print "- Backing up stock DTBO image"
$MAGISKBIN/magiskboot --compress $DTBOIMAGE $MAGISKBIN/stock_dtbo.img.gz
$MAGISKBIN/magiskboot compress $DTBOIMAGE $MAGISKBIN/stock_dtbo.img.gz
ui_print "- Patching DTBO to remove avb-verity"
$MAGISKBIN/magiskboot --dtb-patch $DTBOIMAGE
cat $PATCHED /dev/zero > $DTBOIMAGE
rm -f $PATCHED
return 0
fi
fi