From 6e7fcd6d28be647e83ca2d97192f3e96418cf401 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 10 Dec 2021 23:21:10 -0400 Subject: [PATCH] AK3: add magiskboot KEEPVBMETAFLAG support - some devices fail to boot when magiskboot changes the vbmeta flag is set in the AVBv2 signature from 00 to 03, this allows disabling that behavior - set keep_vbmeta_flag=1 in anykernel.sh to force it to keep whatever's there, =auto will take it from the existing image if Magisk-patched (Canary 23016 or later), and =0 will allow the default magiskboot behavior --- META-INF/com/google/android/updater-script | 2 +- tools/ak3-core.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/META-INF/com/google/android/updater-script b/META-INF/com/google/android/updater-script index dfa796b..bf1af46 100644 --- a/META-INF/com/google/android/updater-script +++ b/META-INF/com/google/android/updater-script @@ -3,4 +3,4 @@ # Dummy file; update-binary is a shell script (DO NOT CHANGE) # # -# AK_BASE_VERSION=20211207 +# AK_BASE_VERSION=20211210 diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh index cf8200b..a913049 100755 --- a/tools/ak3-core.sh +++ b/tools/ak3-core.sh @@ -349,13 +349,19 @@ flash_boot() { *-dtb) rm -f kernel_dtb;; esac; fi; - unset magisk_patched KEEPFORCEENCRYPT KEEPVERITY SHA1 TWOSTAGEINIT; + unset magisk_patched KEEPFORCEENCRYPT KEEPVERITY SHA1 TWOSTAGEINIT; # leave KEEPVBMETAFLAG set for repack ;; esac; case $ramdisk_compression in none|cpio) nocompflag="-n";; esac; + case $keep_vbmeta_flag in + auto) [ "$KEEPVBMETAFLAG" ] || export KEEPVBMETAFLAG=false;; + 1) export KEEPVBMETAFLAG=true;; + *) export KEEPVBMETAFLAG=false;; + esac; $bin/magiskboot repack $nocompflag $bootimg $home/boot-new.img; + unset KEEPVBMETAFLAG; fi; if [ $? != 0 ]; then abort "Repacking image failed. Aborting...";