AK3: support custom AVBv1 signing with magiskboot

NOTE: this currently appears to be broken in magiskboot, so continue to use boot_signer for now, but we're ready for when it works ;)
This commit is contained in:
osm0sis committed 2023-09-10 14:37:17 -03:00
1 parent b5a74aab24
commit 1dfb2c34aa
2 files changed
+13 -6

No files matched your search

+1 -1
View File
@@ -3,4 +3,4 @@
# Dummy file; update-binary is a shell script (DO NOT CHANGE) # Dummy file; update-binary is a shell script (DO NOT CHANGE)
# #
# #
# AK_BASE_VERSION=20230904 # AK_BASE_VERSION=20230910
+12 -5
View File
@@ -404,16 +404,23 @@ flash_boot() {
fi; fi;
[ $? != 0 ] && signfail=1; [ $? != 0 ] && signfail=1;
fi; fi;
if [ -f "$bin/boot_signer-dexed.jar" -a -d "$bin/avb" ]; then if [ -d "$bin/avb" ]; then
pk8=$(ls $bin/avb/*.pk8); pk8=$(ls $bin/avb/*.pk8);
cert=$(ls $bin/avb/*.x509.*); cert=$(ls $bin/avb/*.x509.*);
case $block in case $block in
*recovery*|*SOS*) avbtype=recovery;; *recovery*|*RECOVERY*|*SOS*) avbtype=recovery;;
*) avbtype=boot;; *) avbtype=boot;;
esac; esac;
if [ -f /system/bin/dalvikvm ] && [ "$(/system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/boot_signer-dexed.jar com.android.verity.BootSignature -verify boot.img 2>&1 | grep VALID)" ]; then if [ -f "$bin/boot_signer-dexed.jar" ]; then
echo "Signing with AVBv1..." >&2; if [ -f /system/bin/dalvikvm ] && [ "$(/system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/boot_signer-dexed.jar com.android.verity.BootSignature -verify boot.img 2>&1 | grep VALID)" ]; then
/system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/boot_signer-dexed.jar com.android.verity.BootSignature /$avbtype boot-new.img $pk8 $cert boot-new-signed.img; echo "Signing with AVBv1 /$avbtype..." >&2;
/system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/boot_signer-dexed.jar com.android.verity.BootSignature /$avbtype boot-new.img $pk8 $cert boot-new-signed.img;
fi;
else
if $bin/magiskboot verify boot.img; then
echo "Signing with AVBv1 /$avbtype..." >&2;
$bin/magiskboot sign /$avbtype boot-new.img $cert $pk8;
fi;
fi; fi;
fi; fi;
if [ $? != 0 -o "$signfail" ]; then if [ $? != 0 -o "$signfail" ]; then