[X 2014 General] JulesJam:
MoFo - Image Modification Methods

I have been helping people with other devices to make rooted ext4 images for their devices using [MENTION=2278321]btdownloads7[/MENTION]'s method here:

http://xdaforums.com/showpost.php?p=60389310&postcount=177

Works great. If they have the system images as sparse chunks, you can use [MENTION=5860594]tal.aloni[/MENTION]'s SparseConverter.exe found here:

http://xdaforums.com/showthread.php?t=2749797

to make an ext4 single image system.img but you have to use a hex editor to remove the header and the footer following tal.aloni's instructions in the thread, which I summarized here:

http://xdaforums.com/showpost.php?p=61130622&postcount=41

Then you can use btdownloads7's method above to root it.

The problem is that for some devices like the XT1058 there was only the fxz available as a single file system.img, which is not an ext4 file. I don't know how to convert it to an ext4 image but I have an unlocked XT1060 and at least for the XT1058 what I found I could do was flash the XT1058 system.img to my XT1060 using mfastboot, then boot into recovery and go to Mount and check System. Then from an adb shell run the mount command. That told me where the system image was. On the XT1060 it was /dev/block/mmcblk0p38. Then from the adb shell I ran the command:

dd if=dev/block/mmcblk0p38 of=/sdcard/new_image.img

where if = input file, of = output file and dd is a command that copies the data in the input file to the output file.

Then I exited the adb shell and ran the command

adb pull /sdcard/new_image.img

to get the new_image.img on my computer. new_image.img is an ext4 file that you can flash using mfastboot if your bootloader is unlocked or mofo.exe if your bootloader is locked.

Since my XT1060's bootloader is unlocked and the XT1058 image boots on the XT1060, I could mod the XT1058 image while running android - install Xposed, busy box, etc. - then boot into recovery and run the commands above. I am sure I can also install a custom ROM in TWRP and then pull the image. The point being that for the XT1058 and the non-Dev Ed XT1060's,, which have locked bootloaders, I can modify the images using this method. My XT1060 won't work as a phone running an XT1058 image, but I can use wifi to connect to the playstore to download apps and then install them.

So, I was hoping that this would work the same for the XT1095 and our XT1096 devices. I can boot the Pure Edition XT1095 ext4 image fine on my XT1096 after flashing it with mofo.exe (although it won't make calls) so I think the XT1096 image would run on the XT1095. If someone has an XT1095, they should be able to make a nandroid of their sytem, do all of that above, add in whatever we want to the XT1096 image while running it, then boot into recovery, do the steps above and pull it as an ext4 file using adb, then restore their phone using the nandroid.

To summarize the method:

1) Make a nandroid of XT1095;

2) Use mfastboot to flash XT1096 system.img to XT1095;

3) Boot into TWRP recovery, wipe cache and data partitions, adb push SuperSU zip to /sdcard, install SuperSU zip and then boot into system;

4) Enable USB Debugging, add in Xposed, CFLumen, etc. while running Android and reboot as necessary;

5) Boot into Recovery;

6) Open an adb shell and type the command mount to determine where /system is in /dev/block;

7) Run the command dd if=dev/block/correctplace of=/sdcard/new_image.img, where correctplace is wherever /system is in /dev/block;

8) Exit adb shell and run command adb pull /sdcard/new_image.img; and

9) Restore the XT1095 to its previous state using the nandroid backup.

new_image.img would be an XT1096 rooted ext4 mofo.exe flashable file with Xposed, CFLumen, etc. baked in. In step #1, I would also copy the nandroid to my computer so that I would have a backup copy in case anything strange happened. It shouldn't but it is always better to be safe.

Note that my qe converts to 2/1 when I flash a different model's image but it returns to 1/1 once I reflash an XT1096 image.