I extracted the super.img file (simg2img –> lpunpack).
If the system.img file is ext2 or ext4, I increase the file size with the commands
fallocate -l 6G system.img
resize2fs system.img 6G
and remove the shared blocks with the command.
e2fsck -E unshare_blocks system.img
In this way, I can edit the system.img file. When I pack it as super.img (lpmake) again and flash it, it works on the phone without any problems.
but I make an ext4.img file myself
dd if=/dev/zero of=my.new.system.img bs=4k count=1572864
mkfs.ext4 my.new.system.img
tune2fs -c0 -i0 my.new.system.img
e2fsck -yf my.new.system.img
sudo mount -o loop my.new.system.img newSystem
sudo mount -o loop system.img oldSystem
and use files and copy them
sudo cp -rf oldSystem/* newSystem/
or for erofs
sudo fsck.erofs --extract=newSystem --force --preserve --overwrite system.img
When I package it back to super.img (lpmake) the phone doesn’t work. It keeps turning on and off. Why doesn’t the phone work when I extract or copy files from system.img to my.new.system.img that I created? How can I convert from old system.img (ext2, ext4, erofs) to new system.img (ext4)?
The file system of the Samsung Galaxy A15’s system.img file is erofs and its size is 4.7G. However, the file system of the system-td-arm64-ab-vanilla.img (GSI) file, which is ext2 and 2G in size, that I loaded onto the phone, worked. I was expecting it to work when I increased the size of the system-td-arm64-ab-vanilla.img file, deleted its content, and copied the erofs files from system.img here.
Okan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.