Recently, I'm interest in the android rom, I want to change and rebuild them.
So, I did some test on my XOOM, it's very easy to flash something into the machine.
I got some ROM from MOTOROLA (http://developer.motorola.com/products/software/), they are some img file, and I want to know what's inside, I hope to unpack them.
I tried the unyaffs, it said broken img file
.
I try to mount them, it works great on the system.img, and I can get the file inside.
When I want to mount userdata.img by mount -o loop userdata.img /mnt/userdata
(the same as system.img
), it tells me mount: you must specify the filesystem type
so I try the mount -t ext2 -o loop userdata.img /mnt/userdata
, it said mount: wrong fs type, bad option, bad superblock on...
So, how to get the file from the inside of userdata.img
?
See the answer at: http://omappedia.org/wiki/Android_eMMC_Booting#Modifying_.IMG_Files
First you need to "uncompress" userdata.img
with simg2img
, then you can mount it via the loop device.
I have found a simple solution: http://andwise.net/?p=403
(with slight adjustments for better readability)
This is for all who want to unpack and modify the original system.img that you can flash using recovery. system.img (which you get from the google factory images for example) represents a sparse ext4 loop mounted file system. It is mounted into /system of your device. Note that this tutorial is for ext4 file system. You may have system image which is yaffs2, for example.
The way it is mounted on Galaxy Nexus:
/dev/block/platform/omap/omap_hsmmc.0/by-name/system /system ext4 ro,relatime,barrier=1,data=ordered 0 0
Prerequisites:
- Linux box or virtual machine
- simg2img and make_ext4fs binaries, which can be downloaded from the linux package android-tools-fsutils
Procedure:
Place your system.img and the 2 binaries in one directory, and make sure the binaries have exec permission.
Part 1 – mount the file-system
mkdir sys ./simg2img system.img sys.raw sudo mount -t ext4 -o loop sys.raw sys/
Then you have your system partition mounted in ‘sys/’ and you can modify whatever you want in ‘sys/’. For example de-odex apks and framework jars.
Part 2 – create a new flashable system image
sudo ./make_ext4fs -s -l 512M -a system new.img sys/ sudo umount sys rm -fr sys
Now you can simply type:
fastboot flash system new.img
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With