Update: See stackoverflow.com - Mount Android emulator images
Short Answer is, there are 3 types:
- Regular filesystem images, that can be mounted with
-o loop
option
- YAFFS2 filesystem images, which currently cannot be mounted in Ubuntu and have to be unpacked
- EXT4 filesystem images that have been further processed by the Android toolchain and need to be converted to regular images with
simg2img
from the Android toolchain.
So, you have a binary image extracted from an Android device, is that correct?
What does the file command say about the file? Something like this?
$ file system.img
system.img: VMS Alpha executable
That system image is extracted via nandroid from a Samsung Galaxy i7500. Most of those old Android devices used yaffs as a file system. Knowing what you are dealing with greatly helps. (i.e. Which device are we talking about? Where is that image from?)
Converting images into other file systems will only produce garbage at best if you do not have installed support for the file system in question. Unfortunately there is no package for Ubuntu. But that question has already been asked and answered: Create yaffs2 file system on Ubuntu Server 11.10
There is also the possibility that this image is encrypted. But why would someone give you an encrypted image?
Since this is mostly about Android and you call yourself an Android Developer, please read the Android documentation, again. It's supposed to be all in there. If not ask your question at android.stackexchange.com, XDA-Developers, RootzWiki and the like. And please do not put a ROM on the net for hundreds of people to use unless you REALLY know what you are doing and you read the documentation. Doing it for fame is dangerous and bad for the users!
Select a virtual machine by clicking its name in the VirtualBox window
Click the Machine menu at the top of the VirtualBox window, and click Settings
Click the Storage category in the Settings window
Right-click in the storage tree pane, and click Add Floppy Controller
Right-click the Floppy Controller device, and click Add Floppy Device
Click the Choose Disk button in the prompt window that appears
Navigate to the floppy disk image file (.IMG) on your computer and double-click it
If that doesn't work, try renaming the .IMG as .ISO and mount it.
If that too doesn't work, use VBoxManage's convertfromraw command as follows:
VBoxManage convertfromraw --format VDI [filename].img [filename].vdi
Finally, mount the VDI as a hard disk.
Best Answer
Ubuntu currently does not support YAFFS2. There is a feature request to package the YAFFS2 kernel module, which would provide mount support for the filesystem: [needs-packaging] yaffs2.
Kernel support
Thus, currently, if you need mount support you will have to compile it yourself. The YAFFS website has instructions for compiling a Linux kernel with YAFFS support (using Precise 32-bit):
The Ubuntu wiki also has general information on compiling your own kernel.
Extract and rebuild
Alternatively, try using
yaffs2utils
to extract and rebuild the image.Note that due to a bug, you must specify the
--yaffs-ecclayout
option or it will silently fail. So to extract, try something likeTheoretically you can also rebuild the image using
mkyaffs2
, but I couldn't get it to work (the result wasn't bootable).Yaffey
I found a program, Yaffey, that lets you edit a YAFFS2 image using a GUI:
While the home page says it's Windows-only, with a trivial change it compiles on Ubuntu Precise. To do so:
sudo apt-get install qt-sdk
hg clone https://code.google.com/p/yaffey/
In the file
yaffey/yaffs2/yaffs_guts.h
, change the lineto
cd yaffey && qmake && make
./yaffey
.When I tried it, the resulting image booted successfully in the Android emulator.