How to use AVBtool to create a custom signed vbmeta.img for Unisoc


In this video tutorial, I’ll be explaining
how to create a custom signed vmbeta image. These are the files you’re going to need:
the public keys, you can extract these ones from the stock vbmeta, I’ll link to a guide
on how to do that. I also have my AVBtool. I have my hovatek.pem. Its a private key which I created with OpenSSL,
I’ll link to that also. I have my rsa.pem which is my key used to
sign my vbmeta image. Once you launch terminal as I did while talking,
you run this command. this command is to run a check on the stock
vbmeta image so I can get the information I need for future commands like the algorithm
used and hashes. Next, I’m going to create a public key using
my private key. I’m using hovatek.pem. You can decide to use the rsa.pem as your
private key also even though you’re using it to sign vbmeta image. When I run this command, its going to create
a file named hovatek.bin in the keys folder. This public key is going to be used to sign
any partition I intend to flash a custom image to in the future. I’m going to be signing.. I’m going to be flashing to only recovery
so I’m going to be signing only the recovery partition using this public key OK? Now, I’m going to run this command. This command is going to create my custom
signed vbmeta image. Now, I’m using the default public keys (extracted)
from my stock vbmeta but for recovery, I’m going to replace the public key with my hovatek.bin
public key. That means if I want to flash a recovery image
to the recovery partition, I’ll need to sign that recovery image using the hovatek.pem
. I’ll link to a guide on how to do that. Now, this command is going to create a vbmeta
image which is 16kb. That’s because the stock also has a padded
size of 16kb but the overall size of stock is 1MB. That’s because there’s some Checksum that
needs to be applied to a certain position. That’s what this script is for, vbmeta_pad.py. So you run this command also and this is going
to generate a 1MB file. This is very identical to the stock. I’m going to run a command to see the information
about or of this custom vbmeta image. When you compare it to the stock, you’re going
to see that its very identical; maybe the flag will just be different, which is 2 to
disable verity checks and the hash for recovery partition is going to be different. Every other thing is going to be identical
to what I have in stock and they’re both the same signature. You’re going to need the keys your OEM used
to sign your stock vbmeta if not this guide is not going to work. Unisoc uses the same key across, at least
so far uses the same key across their models so I have my vbmeta. You can now flash it using fastboot.

Add a Comment

Your email address will not be published. Required fields are marked *