a) Modifying
- With
simg2img system.img.ext4 system.img
, you will get a raw image file namedsystem.img
- With
mkdir system
, create directory to mount system.img - With
sudo mount -o loop -r system.img system/
you will get all files ofsystem.img
insystem
folder - With
ls -l system/init.rc
note permissions: 750 - With
sudo chmod 777 system/init.rc
give write permissions - With
sudo echo "#MODIFICATION " >> system/init.rc
done some modification ininit.rc
- With
sudo chmod 750 init.rc
resetinit.rc
to the noted permissions
b) Calculate system sector size
- With
tune2fs -l system.img | grep "Block size\|Block count"
you will get block size and count - With
echo $((1553064 * 4096))
multiply both results. I got 6361350144
c) Packing
- With
sudo make_ext4fs -s -l 6361350144 -a system system_new.img sys/
you will getsystem_new.img
“Android Sparse Image” that has all changes - With
sudo umount system
unmount the system directory - With
rm -fr system
delete the system directory
d) Tar Compression
- With
rm system.img.ext4
remove original system.img.ext4, Don’t worry you should have a backup of it in lz4 file - With
mv system_new.img system.img.ext4
rename system_new.img to system.img.ext4 for flashing with Odin3 v3.13 - With
tar -cvf AP.tar system.img.ext4
you will get AP.tar that you can flash with Odin3 v3.13