23-12-2020, 12:00 PM
Ive got a Teclast P80X (G5K6) tablet, and have followed the guides on this site to unlock bootloader, root (using magisk on boot), create a custom vbmeta, and sign images. Everything has gone fine so far. But I have an issue when trying to sign a system image.
When gaining information on the original/stock system image using python avbtool info_image -:
Code:
$ python avbtool info_image --image ../OrigFirmware/system.img
Footer version: 1.0
Image size: 2936012800 bytes
Original image size: 2889601024 bytes
VBMeta offset: 2935390208
VBMeta size: 2624 bytes
--
Minimum libavb version: 1.0
Header Block: 256 bytes
Authentication Block: 576 bytes
Auxiliary Block: 1792 bytes
Algorithm: SHA256_RSA4096
Rollback Index: 0
Flags: 0
Release String: 'avbtool 1.1.0'
Descriptors:
Hashtree descriptor:
Version of dm-verity: 1
Image Size: 2889601024 bytes
Tree Offset: 2889601024
Tree Size: 22761472 bytes
Data Block Size: 4096 bytes
Hash Block Size: 4096 bytes
FEC num roots: 2
FEC offset: 2912362496
FEC size: 23027712 bytes
Hash Algorithm: sha1
Partition Name: system
Salt: 53ba0caa0522fdd899acbe2a86675e173e9236c5262bbce0af54fc9c3410f28d
Root Digest: 0c0d26c3936a1b9999fbf2578dd611104cc8d158
Flags: 0
Kernel Cmdline descriptor:
Flags: 1
Kernel Cmdline: 'dm="1 vroot none ro 1,0 5643752 verity 1 PARTUUID=$(ANDROID_SYSTEM_PARTUUID) PARTUUID=$(ANDROID_SYSTEM_PARTUUID) 4096 4096 705469 705469 sha1 0c0d26c3936a1b9999fbf2578dd611104cc8d158 53ba0caa0522fdd899acbe2a86675e173e9236c5262bbce0af54fc9c3410f28d 10 $(ANDROID_VERITY_MODE) ignore_zero_blocks use_fec_from_device PARTUUID=$(ANDROID_SYSTEM_PARTUUID) fec_roots 2 fec_blocks 711026 fec_start 711026" root=/dev/dm-0'
Kernel Cmdline descriptor:
Flags: 2
Kernel Cmdline: 'root=PARTUUID=$(ANDROID_SYSTEM_PARTUUID)'
I then try to sign a system image I'd like to use, in the same way I signed boot, with a few adjustments (size and partition name) -:
Code:
$ python avbtool add_hash_footer --image lineage_signed.img --partition_name system --partition_size 2936012800 --key rsa4096_vbmeta.pem --algorithm SHA256_RSA4096
$
No error message is given, and the img file is modified. But the result is a file that is completely the wrong size. Instead of being padded up to 2936012800 bytes from its original 1905398040 bytes, it instead ends up at a size of 1874698496 bytes, as can be seen here -:
Code:
$ls -l lineage_signed.img ../OrigFirmware/lineage-17.1-20201215-UNOFFICIAL-treble_arm64_avS.img ../OrigFirmware/system.img
-rw-r--r-- 1 x x 1874698496 Dec 23 16:34 lineage_signed.img
-rw-r--r-- 1 x x 1905398040 Dec 23 14:43 ../OrigFirmware/lineage-17.1-20201215-UNOFFICIAL-treble_arm64_avS.img
-rw-r--r-- 1 x x 2936012800 Dec 23 15:25 ../OrigFirmware/system.img
Where lineage_signed.img is the result of signing the lineage-17.1-20201215-UNOFFICIAL-treble_arm64_avS.img file. I've got the stock/factory system firmware file (system.img) there also for reference.
When trying to flash the modified file it fails (obviously I have created a vbmeta that will allow the signed system image). Any help or tips on how to correctly sign the lineage system image would be appreciated. Including any information on why it isnt being padded/expanded to the correct size.