Emulation of the SD Card
First of all, we are going to create a FAT32 (this is very important!!!) disk Image (.iso) using the Android tool mksdcard. This tool can be find in the /tools directory of the SDK (Remember where you have download and unzipped it). To create the image we have to put the following line:
mksdcard <size> <filename>
As easy as:
mksdcard 2048M mysdcard.iso
Tip 2048M → 2 Gb
If we want to add files to the sd card, we can do two things:
- Mount the image as a loop device and then copy the files to it
- Use an utility, called “mtools" to copy the files to the image.
Lets have a look to the first option.
If we are using a GNU/Linux system, we can mount the disk image as follows:
sudo mount -t vfat -o loop mysdcard.iso sd
where “sd" is a directory we have to create before, inside the /tools folder.
(To create a directory use the mkdir command)
Once we have done this, its time to copy the files we want (if we want to copy any) inside the sd folder. Its possible that you need administrator privileges to do this.
After doing this, just umount the image
sudo umount sd
Now, we can launch the emulator in two ways:
-Without IDE (Eclipse)
Without IDE → in the /tools folder, use ./emulator (emulator if we are in Windows) -sdcard mycard.iso
With Eclipse → We have to modify the running parameters. For that, left click on the proyect in Eclipse, click in “Run as" and then in “Run configuration". The following image shows what have to be changed.