How to mount the android img file under linux?

FrankDeng picture FrankDeng · Dec 29, 2011 · Viewed 132k times · Source

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?

Answer

Lajos Molnar picture Lajos Molnar · Mar 12, 2012

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.