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
+11 -4

No files matched your search

+1 -1
View File
@@ -3,4 +3,4 @@
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
#
#
# AK_BASE_VERSION=20230904
# AK_BASE_VERSION=20230910
+10 -3
View File
@@ -404,17 +404,24 @@ flash_boot() {
fi;
[ $? != 0 ] && signfail=1;
fi;
if [ -f "$bin/boot_signer-dexed.jar" -a -d "$bin/avb" ]; then
if [ -d "$bin/avb" ]; then
pk8=$(ls $bin/avb/*.pk8);
cert=$(ls $bin/avb/*.x509.*);
case $block in
*recovery*|*SOS*) avbtype=recovery;;
*recovery*|*RECOVERY*|*SOS*) avbtype=recovery;;
*) avbtype=boot;;
esac;
if [ -f "$bin/boot_signer-dexed.jar" ]; then
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
echo "Signing with AVBv1..." >&2;
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;
if [ $? != 0 -o "$signfail" ]; then
abort "Signing image failed. Aborting...";