cfig / Android_boot_image_editor

Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 15
Apache License 2.0
991 stars 225 forks source link

Support unpack/pack apex_payload.img #120

Open nxtclone opened 1 year ago

nxtclone commented 1 year ago

Can u make this project support unpack/pack apex_payload.img in .apex file? I see it's ext4 file system image backed by dm-verity, so i think can unpack and disable dm-verity like boot.img image

cfig commented 1 year ago

Yes, have been considering this for a long time ...

apex format https://cs.android.com/android/platform/superproject/+/master:system/apex/docs/README.md

cfig commented 12 months ago

example capex cc.cfig.lazybox.capex.zip

Archive:  cc.cfig.lazybox.capex
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
    1328  Stored     1328   0% 2009-01-01 00:00 3134ceed  AndroidManifest.xml
     520  Stored      520   0% 2009-01-01 00:00 f6cbf43d  apex_build_info.pb
     133  Stored      133   0% 2009-01-01 00:00 46672ed5  apex_manifest.pb
    1032  Stored     1032   0% 2009-01-01 00:00 55a7242d  apex_pubkey
  339017  Defl:N    63297  81% 2009-01-01 00:00 63f975b8  original_apex
     597  Defl:N      395  34% 2009-01-01 00:00 c7885266  META-INF/CERT.SF
    2373  Defl:N     1975  17% 2009-01-01 00:00 a5386d22  META-INF/CERT.RSA
     462  Defl:N      305  34% 2009-01-01 00:00 d0dfce73  META-INF/MANIFEST.MF
--------          -------  ---                            -------
  345462            68985  80%                            8 files
nxtclone commented 7 months ago

I tested in Android 11, i can use UKA to unpack and repack witth new apex_pubkey and boot success, but i can't do this with android 13. I tried just extracting the com.android.conscrypt.apex file, then compressing(mode: store) and signing it again, but it still doesn't work, I'm feeling confused.

cfig commented 6 months ago

Having been too busy these months ... I will try to implement it before Chinese New Year

nxtclone commented 6 months ago

I have found an alternative solution. Just re-sign .apex file with tool sign_apex.py with any key and replace it in /system/apex

cfig commented 6 months ago

Just did some testings on apex, there are already some useful tools like apexer, deapexer. As there is alternative tool to do the unpack/pack work, just using the existing ones should be OK.

cfig commented 6 months ago

Screenshot_2023-12-19_16-13-07

Attach a pic here, and leave the issue open to help late comers who may be interested.