Hovatek Forum DEVELOPMENT Android How to flash a GSI to Unisoc devices with Super partition
Try our Online TWRP Builder..its free!
Can't login? Please, reset your password.


How to flash a GSI to Unisoc devices with Super partition

How to flash a GSI to Unisoc devices with Super partition

hovatek
hovatek
hovatek
Administrator
49,597
12-04-2024, 02:57 AM
#1



This guide will explain how to flash a Generic System Image (GSI) to a Unisoc Android device which has a Super partition. This guide is specific to those models that require an unlock token to unlock the bootloader and also create custom vbmeta to flash modified files. 

The idea is to generate a custom vbmeta_system.img so that the system_ext.img and system.img will pass verification then create a custom vbmeta.img so that vbmeta_system.img will also pass verification. vbmeta.img will pass verification if generated with the same private key the OEM used.

This guide assumes you're a bit familiar with generating vbmetas so you might need to make a few modifications.

Requirements


  1. GSI (system.img)
  2. system_ext.img (You can extract this from firmware's super.img using simg2img and lpunpack)
  3. avbtool
  4. Private key the OEM used to sign the vbmeta partition (e.g rsa4096_vbmeta.pem)

How to flash a GSI to Unisoc Android devices



  1. Generate a public key from the private key using the command:
    Code:

    python avbtool.py extract_public_key --key rsa4096_vbmeta.pem --output rsa4096_vbmeta.bin

  2. Generate a custom vbmeta_system.img

    Code:

    python avbtool.py make_vbmeta_image --algorithm SHA256_RSA4096 --key rsa4096_vbmeta.pem --include_descriptors_from_image system.img --include_descriptors_from_image system_ext.img --padding_size 4096 --output vbmeta_system_custom.img

  3. Generate a custom vbmeta.img (similar to stock vbmeta except you swap the public key for vbmeta_system to the bin generated at the beginning

    Code:

    python avbtool.py make_vbmeta_image --key rsa4096_vbmeta.pem --algorithm SHA256_RSA4096 --flag 0 --chain_partition boot:1:keys/boot_key.bin --chain_partition vendor_boot:18:keys/vendor_boot_key.bin --chain_partition dtbo:6:keys/dtbo_key.bin --chain_partition vbmeta_system:2:keys/rsa4096_vbmeta.bin --chain_partition vbmeta_vendor:4:keys/vbmeta_vendor_key.bin --chain_partition vbmeta_odm:7:keys/vbmeta_odm_key.bin --chain_partition vbmeta_system_ext:3:keys/vbmeta_system_ext_key.bin --chain_partition vbmeta_product:5:keys/vbmeta_product_key.bin --chain_partition l_modem:11:keys/l_modem_key.bin --chain_partition l_ldsp:12:keys/l_ldsp_key.bin --chain_partition l_gdsp:13:keys/l_gdsp_key.bin --chain_partition pm_sys:14:keys/pm_sys_key.bin --chain_partition l_agdsp:15:keys/l_agdsp_key.bin --prop com.android.build.boot.os_version:13 --prop com.android.build.boot.security_patch:2023-09-05 --prop com.android.build.system.os_version:13 --prop com.android.build.system.security_patch:2023-09-05 --prop com.android.build.vendor.os_version:13 --prop com.android.build.vendor.security_patch:2023-09-05 --padding_size 20480 --output vbmeta-sign-custom.img

    You could apply its padding python script too

  4. Flash the GSI using
    Code:

    adb reboot fastboot
    fastboot flash vbmeta vbmeta-sign-custom.img
    fastboot flash vbmeta_system vbmeta_system_custom.img
    fastboot erase system_ext
    fastboot flash system_ext system_ext.img
    fastboot erase system
    fastboot flash system system.img
    fastboot -w

    If you can, go to recovery mode and do a factory reset before rebooting.

Important Notice
The values used in the commands are for demo purposes. Ensure to study the relevant guides.
This post was last modified: 12-04-2024, 03:02 AM by hovatek.

Note!
We have a reply schedule for Free Support. Please upgrade to Private Support if you can't wait.
Users browsing this thread:
 1 Guest(s)
Users browsing this thread:
 1 Guest(s)
YtWhTl
live chat
whatsapp telegram instagram