Talk with a Hovatek Engineer/Developer. Start Now

Learn Mediatek Software Repairs Online! Enroll




How to use AVBtool and a private key to sign a Unisoc (SPD) image
#11

Post: 11 by _Jaqb_



(13-03-2020, 05:32 PM)hovatek Wrote:  ...
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?

find Reply
#12

Post: 12 by danpizzy

(26-11-2020, 12:38 PM)_Jaqb_ Wrote:  
(13-03-2020, 05:32 PM)hovatek Wrote:  ...
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
find Reply
#13

Post: 13 by X3non

(26-11-2020, 12:38 PM)_Jaqb_ Wrote:  ...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_ Wrote:  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_ Wrote:  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
find Reply
#14

Post: 14 by 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
find Reply
#15

Post: 15 by hovatek

(30-12-2020, 07:21 PM)vano1678 Wrote:  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

Note!
We have a reply schedule for Free Support. Please upgrade to Private Support if you can't wait.
find Reply
#16

Post: 16 by getoverwith

(17-09-2020, 10:42 PM)ch3mn3y Wrote:  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?
find Reply
#17

Post: 17 by X3non

(09-02-2021, 10:10 PM)getoverwith Wrote:  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
find Reply
#18

Post: 18 by per Noman

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
find Reply
#19

Post: 19 by X3non

(12-04-2021, 07:38 AM)per Noman Wrote:  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 Wrote:  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
find Reply
#20

Post: 20 by lolvatveo

my stock vbmeta is signed with rsa4096 key, can i sign magiskpatched recovery with rsa4096?
find Reply




Users browsing this thread: 1 Guest(s)
YouTubeWhatsappTelegram

© 2023. Powered by Hovatek...just a button away! Software by MyBB.