Home Forum Blog Private Support Courses
Our courses are now on YouTube! Start Watching
Hovatek Forum OPERATING SYSTEMS Android [Tutorial] How to use AVBtool and a private key to sign a Unisoc (SPD) image

[Tutorial] How to use AVBtool and a private key to sign a Unisoc (SPD) image

[Tutorial] How to use AVBtool and a private key to sign a Unisoc (SPD) image

Pages (6): Previous 1 2 3 4 5 6 Next
_Jaqb_
_Jaqb_
_Jaqb_
Junior Member
21
26-11-2020, 12:38 PM
#11



(13-03-2020, 05:32 PM)hovatek ...
Important Notice
  • Recall I'd used hovatek.pem private key to create hovatek.bin public key which I'd then used to sign recovery partition when creating my custom signed vbmeta. The custom signed vbmeta first needs to have been flashed to the device else it won't accept this newly signed recovery image
  • You can repeat the same procedure for other partitions. Just replace recovery in the command with the partition name e.g system. You also need to have signed that partition using your custom public key back when creating your custom signed vbmeta
  • Credits goes to Petercxy
Hi, thanks for the work! Do I have to repeat the same procedure key signing for all other partitions to flash recovery magisk_patched_recovery_signed.img?

Can the Tablet P80X (model G5K4) be rooting only by flash patched image without signing?

Which img flashing: magisk_patched_recovery.img/magisk_patched_boot.img or magisk_patched_recovery_signed.img/magisk_patched_boot_signed.img?
danpizzy
danpizzy
danpizzy
Newbie
3
26-11-2020, 01:06 PM
#12
(26-11-2020, 12:38 PM)_Jaqb_
(13-03-2020, 05:32 PM)hovatek ...
Important Notice
  • Recall I'd used hovatek.pem private key to create hovatek.bin public key which I'd then used to sign recovery partition when creating my custom signed vbmeta. The custom signed vbmeta first needs to have been flashed to the device else it won't accept this newly signed recovery image
  • You can repeat the same procedure for other partitions. Just replace recovery in the command with the partition name e.g system. You also need to have signed that partition using your custom public key back when creating your custom signed vbmeta
  • Credits goes to Petercxy
Hi, thanks for the work! Do I have to repeat the same procedure key signing for all other partitions to flash recovery magisk_patched_recovery_signed.img?

Can the Tablet P80X (model G5K4) be rooting only by flash patched image without signing?

Which img flashing: magisk_patched_recovery.img/magisk_patched_boot.img or magisk_patched_recovery_signed.img/magisk_patched_boot_signed.img?

Yes you have to sign all partitions individually that's what I did for my itel p33 plus
And you flash whichever one you want I would recommend you patch the image with magisk first then sign it and flash it also check your vbmeta sometimes I have to flash custom vbmeta then flash custom boot image and stock vbmeta back or the phone won't boot
hovatek
hovatek
hovatek
Administrator
50,891
27-11-2020, 10:34 AM
#13
(26-11-2020, 12:38 PM)_Jaqb_ ...Do I have to repeat the same procedure key signing for all other partitions to flash recovery magisk_patched_recovery_signed.img?

since you intend to flash recovery, then you only need to sign recovery and create a custom key for recovery in vbmeta as well


(26-11-2020, 12:38 PM)_Jaqb_ Can the Tablet P80X (model G5K4) be rooting only by flash patched image without signing?

No, it can't


(26-11-2020, 12:38 PM)_Jaqb_ Which img flashing: magisk_patched_recovery.img/magisk_patched_boot.img or magisk_patched_recovery_signed.img/magisk_patched_boot_signed.img?

whatever image you intend to flash must be signed first otherwise it'll be rejected when you attempt to flash

Learn MediaTek, Unisoc / Spreadtrum (SPD) and Qualcomm Software Repairs @ https://www.hovatek.com/training
Note!
We have a reply schedule for Forum Support. Please try Private Support if you can't wait.
vano1678
vano1678
vano1678
Enthusiastic Member
12
30-12-2020, 07:21 PM
#14
Please tell me, I collected vbmeta_custom.img with a public key. And I signed boot.img and recovery.img and my relatives. So recovery.img is stitched, but boot.img does not hang on the boot. I've been trying to flash it for 3 days, and everything is useless.
Here is a link to my question and files.
https://www.hovatek.com/forum/thread-37665.html
hovatek
hovatek
hovatek
Administrator
50,891
31-12-2020, 07:46 AM
#15

Mediatek Course Mediatek Course


(30-12-2020, 07:21 PM)vano1678 Please tell me, I collected vbmeta_custom.img with a public key. And I signed boot.img and recovery.img and my relatives. So recovery.img is stitched, but boot.img does not hang on the boot. I've been trying to flash it for 3 days, and everything is useless.
Here is a link to my question and files.
https://www.hovatek.com/forum/thread-37665.html

You'll be attended to at your thread

Learn MediaTek, Unisoc / Spreadtrum (SPD) and Qualcomm Software Repairs @ https://www.hovatek.com/training
Note!
We have a reply schedule for Forum Support. Please try Private Support if you can't wait.
getoverwith
getoverwith
getoverwith
Enthusiastic Member
6
09-02-2021, 10:10 PM
#16
(17-09-2020, 10:42 PM)ch3mn3y I'm trying to sign magisk patched boot.img using rsa4096_vbmeta.pem which I have as my publickey.bin file.
Unfortunately avbtool seems to not treat patched boot as boot...

I got error like this:
Code:

>python avbtool.py add_hash_footer --image boot.img --partition_name boot --partition_size 36700160 --key publickey.bin --algorithm SHA256_RSA4096 usage: avbtool.py add_hash_footer [-h] [--image IMAGE]                                   [--partition_size PARTITION_SIZE]                                   [--partition_name PARTITION_NAME]                                   [--hash_algorithm HASH_ALGORITHM]                                   [--salt SALT] [--calc_max_image_size]                                   [--output_vbmeta_image OUTPUT_VBMETA_IMAGE]                                   [--do_not_append_vbmeta_image]                                   [--algorithm ALGORITHM] [--key KEY]                                   [--signing_helper APP]                                   [--signing_helper_with_files APP]                                   [--public_key_metadata KEY_METADATA]                                   [--rollback_index ROLLBACK_INDEX]                                   [--append_to_release_string STR]                                   [--prop KEY:VALUE]                                   [--prop_from_file KEY:PATH]                                   [--kernel_cmdline CMDLINE]                                   [--setup_rootfs_from_kernel IMAGE]                                   [--include_descriptors_from_image IMAGE]                                   [--print_required_libavb_version]                                   [--chain_partition PART_NAME:ROLLBACK_SLOT:KEY_PATH]                                   [--flags FLAGS]                                   [--set_hashtree_disabled_flag]                                   [--use_persistent_digest] [--do_not_use_ab] avbtool.py add_hash_footer: error: argument --image: invalid FileType('rab+') value: 'boot.img'

Tried different file names (thought that may be the problem, like standard "magisk_patched" or "boot_magisk".

EDIT: Same problem with stock boot...
I have the same issue... Have u solved it?
hovatek
hovatek
hovatek
Administrator
50,891
10-02-2021, 10:47 AM
#17
(09-02-2021, 10:10 PM)getoverwith I have the same issue... Have u solved it?

@humni solved this by using linux instead of windows. see his post @ https://www.hovatek.com/forum/thread-326...#pid202892

Learn MediaTek, Unisoc / Spreadtrum (SPD) and Qualcomm Software Repairs @ https://www.hovatek.com/training
Note!
We have a reply schedule for Forum Support. Please try Private Support if you can't wait.
per Noman
per Noman
per Noman
Enthusiastic Member
11
12-04-2021, 07:38 AM
#18
Running this command: python avbtool info_image --image recovery_stock.img
Give me this error:

File "avbtool", line 411
b = 2L**32
^

But running this command: python3 avbtool.py info_image --image vbmeta_stock.img
work perfectly and give me thes output:

cd@cd:~/Desktop/avbtool$ python3 avbtool.py info_image --image vbmeta_stock.img
Minimum libavb version: 1.0
Header Block: 256 bytes
Authentication Block: 320 bytes
Auxiliary Block: 3264 bytes
Public key (sha1): cdbb77177f731920bbe0a0f94f84d9038ae0617d
Algorithm: SHA256_RSA2048
Rollback Index: 0
Flags: 0
Rollback Index Location: 0
Release String: 'avbtool 1.1.0'
Descriptors:
Chain Partition descriptor:
Partition Name: recovery
Rollback Index Location: 1
Public key (sha1): 0aa0987116fc792f36bc909b0a4d530413f02a54
Chain Partition descriptor:
Partition Name: vbmeta_system
Rollback Index Location: 2
Public key (sha1): fa41159a5d696abdef93176a07d0b0d001263f01
Chain Partition descriptor:
Partition Name: vbmeta_vendor
Rollback Index Location: 4
Public key (sha1): 9577bc6c0772975ecce93c4d8a178662c728dadf
Chain Partition descriptor:
Partition Name: boot
Rollback Index Location: 3
Public key (sha1): 9d808b0995768d0677fccb1efcddb7cf9e153d99
Hash descriptor:
Image Size: 49776 bytes
Hash Algorithm: sha256
Partition Name: dtbo
Salt: 836908ce5dc44be62c8cee40cff79fb14aef98065e181ab6f909dd7fd2f1e89e
Digest: 9e4eb8d861f2c6b3d0a46c1d524470fbd18a4935b3bbcd72b945e2143c587da5
Flags: 0

what am i doing wrong?

And how do I modify the script to fit my vbmeta.img file info, as seen above, for signing Empty_vbmeta/recovery/magisk_patched boot images?
Code:
python avbtool make_vbmeta_image --key rsa4096_vbmeta.pem --algorithm SHA256_RSA4096 --flag 2 --chain_partition boot:1:keys/key_boot.bin --chain_partition system:3:keys/key_system.bin --chain_partition vendor:4:keys/key_vendor.bin --chain_partition product:10:keys/key_product.bin --chain_partition dtbo:9:keys/key_dtbo.bin --chain_partition recovery:2:keys/hovatek.bin --chain_partition l_modem:5:keys/key_l_modem.bin --chain_partition l_ldsp:6:keys/key_l_ldsp.bin --chain_partition l_gdsp:7:keys/key_l_gdsp.bin --chain_partition pm_sys:8:keys/key_pm_sys.bin --chain_partition dtb:11:keys/key_dtb.bin --padding_size 16384 --output vbmeta-sign-custom.img
This post was last modified: 12-04-2021, 10:06 AM by per Noman.
hovatek
hovatek
hovatek
Administrator
50,891
12-04-2021, 10:38 AM
#19
(12-04-2021, 07:38 AM)per Noman Running this command: python avbtool info_image --image recovery_stock.img
Give me this error:

  File "avbtool", line 411
    b = 2L**32
        ^

use python v2.7.10


(12-04-2021, 07:38 AM)per Noman But running this command: python3 avbtool.py info_image --image vbmeta_stock.img
work perfectly and give me thes output:
Code:

cd@cd:~/Desktop/avbtool$ python3 avbtool.py info_image --image vbmeta_stock.img Minimum libavb version:  1.0 Header Block:            256 bytes Authentication Block:    320 bytes Auxiliary Block:          3264 bytes Public key (sha1):        cdbb77177f731920bbe0a0f94f84d9038ae0617d Algorithm:                SHA256_RSA2048 Rollback Index:          0 Flags:                    0 Rollback Index Location:  0 Release String:          'avbtool 1.1.0' Descriptors:     Chain Partition descriptor:       Partition Name:          recovery       Rollback Index Location: 1       Public key (sha1):      0aa0987116fc792f36bc909b0a4d530413f02a54     Chain Partition descriptor:       Partition Name:          vbmeta_system       Rollback Index Location: 2       Public key (sha1):      fa41159a5d696abdef93176a07d0b0d001263f01     Chain Partition descriptor:       Partition Name:          vbmeta_vendor       Rollback Index Location: 4       Public key (sha1):      9577bc6c0772975ecce93c4d8a178662c728dadf     Chain Partition descriptor:       Partition Name:          boot       Rollback Index Location: 3       Public key (sha1):      9d808b0995768d0677fccb1efcddb7cf9e153d99     Hash descriptor:       Image Size:            49776 bytes       Hash Algorithm:        sha256       Partition Name:        dtbo       Salt:                  836908ce5dc44be62c8cee40cff79fb14aef98065e181ab6f909dd7fd2f1e89e       Digest:                9e4eb8d861f2c6b3d0a46c1d524470fbd18a4935b3bbcd72b945e2143c587da5       Flags:                0
what am i doing wrong?

And how do I modify the script to fit my vbmeta.img file info, as seen above, for signing Empty_vbmeta/recovery/magisk_patched boot images?
Code:
python avbtool make_vbmeta_image --key rsa4096_vbmeta.pem --algorithm SHA256_RSA4096 --flag 2 --chain_partition boot:1:keys/key_boot.bin --chain_partition system:3:keys/key_system.bin --chain_partition vendor:4:keys/key_vendor.bin --chain_partition product:10:keys/key_product.bin --chain_partition dtbo:9:keys/key_dtbo.bin --chain_partition recovery:2:keys/hovatek.bin --chain_partition l_modem:5:keys/key_l_modem.bin --chain_partition l_ldsp:6:keys/key_l_ldsp.bin --chain_partition l_gdsp:7:keys/key_l_gdsp.bin --chain_partition pm_sys:8:keys/key_pm_sys.bin --chain_partition dtb:11:keys/key_dtb.bin --padding_size 16384 --output vbmeta-sign-custom.img

you don't need to tamper with avbtool
for creating a custom vbmeta, see https://www.hovatek.com/forum/thread-32664.html ; use info gotten from your stock vbmeta, e.g stock vbmeta has rsa2048, you'll need to replace that in the make_vbmeta command
if you still have problems then create a new thread for your device issue by clicking "ask question" at the top

Learn MediaTek, Unisoc / Spreadtrum (SPD) and Qualcomm Software Repairs @ https://www.hovatek.com/training
Note!
We have a reply schedule for Forum Support. Please try Private Support if you can't wait.
lolvatveo
lolvatveo
lolvatveo
Senior Member
146
25-09-2021, 04:10 PM
#20
my stock vbmeta is signed with rsa4096 key, can i sign magiskpatched recovery with rsa4096?
Pages (6): Previous 1 2 3 4 5 6 Next
Users browsing this thread:
 1 Guest(s)
Users browsing this thread:
 1 Guest(s)
WhTlYt