I have a ROM that I can flash on Samsung S10 5G(Qualcomm) successfully. My goal is to check whether I can modify system.img file of the ROM or not but before modification, I just want to verify that the AP file can be flashed after unpacking and packing of the system.img. To check this I have tried following:
Unpack-Pack AP file:
A) tar flashing:
- Extracted AP file using
tar -xf AP...tar.md5command. - Compress the extracted files using
tar -cvf AP...tar * - Flash it with Odin3 v3.13.
B) tar.md5 flashing:
- Get tar by following steps in A) and then run md5sum -t AP...tar >> AP...tar and mv AP...tar AP...tar.md5
Both Ap...tar and AP...tar.md5 flashed successfully.
Unpack-Pack system.img.ext4.lz4
- Extracted AP file using
tar -xf AP...tar.md5command. Extracted files are "boot.img.lz4, meta-data, userdata.img.ext4.lz4, carrier.img.ext4.lz4, persist.img.ext4.lz4, vbmeta.img.lz4, dqmdbg.img.ext4.lz4, recovery.img.lz4, vendor.img.ext4.lz4, dtbo.img.lz4, system.img.ext4.lz4". - Extract system file using
unlz4 system.img.ext4.lz4command. This is giving me asystem.img.ext4Android sparse image. - Tried following commands to compress
system.img.ext4without doing any modification:
lz4 system.img.ext4 system.img.ext4.lz4 - Default Compression
lz4 -9 system.img.ext4 system.img.ext4.lz4 - High Compression
lz4 -l system.img.ext4 system.img.ext4.lz4 - Default Compression in Legacy format
lz4 -l -9 system.img.ext4 system.img.ext4.lz4 - High Compression in Legacy format
lz4 -0 -l system.img.ext4 system.img.ext4.lz4 - No Compression in Legacy format
lz4 -B4 system.img.ext4 system.img.ext4.lz4 - Default Compression with Block size 4
lz4 -B5 system.img.ext4 system.img.ext4.lz4 - Default Compression with Block size 5
lz4 -B6 system.img.ext4 system.img.ext4.lz4 - Default Compression with Block size 6
lz4 --no-frame-crc system.img.ext4 system.img.ext4.lz4 - Default Compression with no crc frame
and make an AP file by replacing the original system.img.ext4.lz4 file with the compressed file from above command(one at one time) and tried to flash it but every time it fails with "Odin FAIL! LZ4 is invalid"
LZ4 command detail: 1. Working on Ubuntu 18 2. Using "LZ4 command line interface 64-bits r128, by Yann Collet (Apr 3 2018)"
Tried with "LZ4 command line interface 64-bits v1.9.2, by Yann Collet" but get the same result.
file system.img.ext4.lz4 output:
- Original file:
system.img.ext4.lz4: LZ4 compressed data (v1.4+). My version with both LZ4 (r128 and v1.9.2):
- For file compressed with legacy flag(-l):
system.img.ext4.lz4: LZ4 compressed data (v0.1-v0.9) - For file compressed without legacy flag(-l):
system.img.ext4.lz4: LZ4 compressed data (v1.4+)
- For file compressed with legacy flag(-l):
So, I think it means the file should be compressed without legacy flag.
Size
- With
-9flag i.e. High Compression the output file is of 3.3 GB. - Without
-9flag i.e. Default Compression the output file is of 3.6 GB.
The Original file is of size 3.6 GB so, I think high compression should not be used.
But still the same error throws by Odin.
Any suggestion why it is happening?