From 6e5df1f06b7ef08bc8f54a6641d39f82566d560c Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 16 Jun 2022 01:47:23 -0700 Subject: [PATCH] Abort when unsupported dtb is detected --- scripts/boot_patch.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index 6f255eba4..43ffab3a8 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -183,7 +183,15 @@ rm -f ramdisk.cpio.orig config magisk*.xz ################# for dt in dtb kernel_dtb extra; do - [ -f $dt ] && ./magiskboot dtb $dt patch && ui_print "- Patch fstab in $dt" + if [ -f $dt ]; then + if ! ./magiskboot dtb $dt test; then + ui_print "! Unsupported boot image $dt" + abort "! Please restore back to stock boot image" + fi + if ./magiskboot dtb $dt patch; then + ui_print "- Patch fstab in boot image $dt" + fi + fi done if [ -f kernel ]; then