[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
Follow the steps below to sign boot.img, recovery.img etc images using avbtool
python avbtool info_image --image recovery_stock.img
Footer version: 1.0
Image size: 41943040 bytes
Original image size: 23742464 bytes
VBMeta offset: 23744512
VBMeta size: 2112 bytes
--
Minimum libavb version: 1.0
Header Block: 256 bytes
Authentication Block: 576 bytes
Auxiliary Block: 1280 bytes
Algorithm: SHA256_RSA4096
Rollback Index: 0
Flags: 0
Release String: 'avbtool 1.1.0'
Descriptors:
Hash descriptor:
Image Size: 23742464 bytes
Hash Algorithm: sha256
Partition Name: recovery
Salt: 6d13e635e505f337460c4e0f9d22be4a96518ceee422511cca6c6113cd96fa25
Digest: 75ab9441053eb877eb2c95f1dd3474beeead5437a9a16c3d09efe931c4d16693
Flags: 0
python avbtool add_hash_footer --image recovery_magisk.img --partition_name recovery --partition_size 41943040 --key hovatek.pem --algorithm SHA256_RSA4096
--prop com.android.build.boot.os_version:13
--include_descriptors_from_image boot.img
(13-03-2020, 05:32 PM)hovatek ...
(17-06-2020, 11:34 AM)Abatoir How can I rectify this issue? https://imgur.com/fs7KHaX
(18-06-2020, 02:57 PM)X3nonthnk you, i shall post results asap.(17-06-2020, 11:34 AM)Abatoir How can I rectify this issue?
if using windows OS, install both python and openssl and ensure that both are added into PATH
if using linux OS, you might want to try installing python 2.x , openssl should be installed by default but you can check to confirm if not the install openssl as well
if you still have problems then create a new thread for your device issue by clicking "ask question" at the top
>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'
(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...
(20-09-2020, 11:13 PM)danpizzy python avbtool info_image --image vbmeta-sign.img
avbtool: Given image does not look like a vbmeta image.
got this error on itel p33 plus
(19-09-2020, 08:32 AM)hovatek(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...
create a new thread by clicking Ask Question at the top.
In the thread, add a screenshot of the folder containing avbtool and other files
also a screenshot of the command(s) you ran