AK2: add Android Verified Boot (AVB) signature support

- add built-in support for BootSignature_Android.jar for AVB signature enforcing devices (see https://forum.xda-developers.com/android/software-hacking/signing-boot-images-android-verified-t3600606)
This commit is contained in:
osm0sis committed 2017-06-06 13:24:47 -03:00
1 parent 89ba5089d2
commit 697e286654
1 file changed
+23
+23
View File
@@ -189,6 +189,29 @@ write_boot() {
fi;
mv -f boot-new-signed.img boot-new.img;
fi;
if [ -f "$bin/BootSignature_Android.jar" -a -d "$bin/avb" ]; then
if [ -f "/system/system/bin/dalvikvm" ]; then
umount /system;
umount /system;
mkdir /system_root;
mount -o ro -t auto /dev/block/bootdevice/by-name/system$slot /system_root;
mount -o bind /system_root/system /system;
fi;
unset LD_LIBRARY_PATH;
pk8=`ls $bin/avb/*.pk8`;
der=`ls $bin/avb/*.der`;
/system/bin/dalvikvm -Xbootclasspath:/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/bouncycastle.jar -Xnodex2oat -Xnoimage-dex2oat -cp BootSignature_Android.jar com.android.verity.BootSignature /boot boot-new.img $pk8 $der boot-new-signed.img;
if [ $? != 0 ]; then
ui_print " "; ui_print "Signing image failed. Aborting..."; exit 1;
fi;
mv -f boot-new-signed.img boot-new.img;
if [ -d "/system_root" ]; then
umount /system;
umount /system_root;
rmdir /system_root;
mount -o ro -t auto /system;
fi;
fi;
if [ -f "$bin/blobpack" ]; then
printf '-SIGNED-BY-SIGNBLOB-\00\00\00\00\00\00\00\00' > boot-new-signed.img;
$bin/blobpack tempblob LNX boot-new.img;