[Q] creating fastboot flashable system.img

dl12345

Senior Member
Aug 1, 2014
293
814
123
I wish to modify the system image on my Xperia Z3+. I seem to be having trouble creating a fastboot flashable .img file that allows the phone to boot.

To test, I extracted the .ext4 file from the stock firmware system.sin that is currently installed on my Z3+ using FlashTool's SIN extractor. I mounted the resulting ext4 image using the loopback filesystem, following which I executed the command

Code:
make_ext4fs -s -l 5513412608 -a /system system.img system
The partition size is taken directly from the AOSP BoardConfig.mk for this device. I made no modifications to the filesystem - it's stock. It flashes successfully with fastboot using the same command that successfully flashes a AOSP built system.img

Code:
fastboot flash -s 256M system system.img
The system won't boot when fastboot flashing the converted SIN to IMG. There's something wrong with the way I'm creating the system.img file. It makes no difference if I add the SELinux file_contexts with the -T option and the file_contexts located in the system image.

Anyone have any pointers?
 

DHGE

Senior Member
Jun 20, 2015
600
282
93
coastal paradise
give some extra blocks

I modified the system image of 28.0.A.27 to include the newer stagefright libs from .251 and a su executable (unsucsessful: RIC and maybe SELinux).

I checked the image and added some - rounded up - extra blocks for my modifications (ls -l).

The device (Tablet Z4) booted but the media server did not come up and the booting did not finish. I could adb shell but had no touch GUI.

Maybe yours is another problem. If you can adb shell I would check the log.

And I did it this way (no /):
Code:
make_ext4fs -s -l 5big_number8 -a system system.img system
 

dl12345

Senior Member
Aug 1, 2014
293
814
123
I modified the system image of 28.0.A.27 to include the newer stagefright libs from .251 and a su executable (unsucsessful: RIC and maybe SELinux).

I checked the image and added some - rounded up - extra blocks for my modifications (ls -l).

The device (Tablet Z4) booted but the media server did not come up and the booting did not finish. I could adb shell but had no touch GUI.

Maybe yours is another problem. If you can adb shell I would check the log.

And I did it this way (no /):
Code:
make_ext4fs -s -l 5big_number8 -a system system.img system
I tried with and without the / but same problem. I can't get an adb shell as the device doesn't even start booting - it sticks on the Sony logo.