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
Quote
(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 here http://andwise.net/?attachment_id=406 (windows), or in 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
In Android file system, "system.img" and "userdata.img" are VMS Alpha executable. "system.img" and "userdata.img" have the contents of /system and /data directory on root file system. They are mapped on NAND devices with yaffs2 file system. Now, yaffs2 image file can not be mounted on linux PC. If you can, maybe you got some rom that not packed in yaffs2 file system. You can check those rom file by execute the command:
file <system.img/userdata.img>
If it show "VMS Alpha executable" then you can use "unyaffs" to extract it.
Another option would be to use the File Explorer in DDMS (Eclipse SDK), you can see the whole file system there and download/upload files to the desired place. That way you don't have to mount and deal with images. Just remember to set your device as USB debuggable (from Developer Tools)
I have found that Furius ISO mount works best for me. I am using a Debian based distro Knoppix. I use this to Open system.img
files all the time.
Furius ISO mount: https://packages.debian.org/sid/otherosfs/furiusisomount
"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?"
To load .img
files you have to select loop and load the .img
Select loop
Next you select mount
Select mount
Furius ISO mount handles all the other options loading the .img
file to your /home/dir.