1

I built the AOSP 2.3.7 release successfully.

The emulator is running smooth.

I wrote an(droid) application which has something to do with sd card.

Now according to this I cannot mount a sdcard image on a running Emulator.

So How do I get SD Card in my Emulator. I can create a sd card image using the mksdcard tool.

Do I need to rebuild AOSP(with some additional settings)? or It can be done without Re-Building AOSP by doing some hack ?

Kindly Point me in the right direction !

LW001
  • 2,452
  • 6
  • 27
  • 36
vyi
  • 1,078
  • 1
  • 19
  • 46
  • The problem in the linked question concerns re-mounting an image which has been demounted (likely because there's no means to simulate the hardware presence re-detection) so it does not seem relevant to what you are trying to do. Can't you attach the image when starting up the emulator? – Chris Stratton Jun 05 '13 at 18:18
  • @ChrisStratton I don't understand what you mean by 'attach on starting up emulator'. There is no AVD manager (is there ?)! can you elaborate more ! – vyi Jun 05 '13 at 18:29
  • The AVD manager may not be in use, but there's still a commandline being issued from somewhere to start the emulator. Find it and change it. If you are curious what it currently is, run the emulator, find it's PID on the host system, and then get the commandline out of the process's directory in /proc – Chris Stratton Jun 05 '13 at 18:34
  • @ChrisStratton I run ". build/envsetup.sh" followed by "lunch" followed by 'emulator &' to run the emulator. – vyi Jun 05 '13 at 18:42
  • Something is giving the emulator configuration - you'll have to find and change that. – Chris Stratton Jun 05 '13 at 18:43
  • 1
    @ChrisStratton Done! I did find it. Deep inside the 'out' Directory in my AOSP folder there was bin directory (`/AOSP/out/host/linux-x86/bin`). The `". build/envsetup.sh"` command did put this 'bin' directory in the system path. This directory contains all the tools (adb emulator fastboot mksdcard etc..). So I just did `mksdcard -l SdCard 128M MySd.img` followed by `emulator -sdcard MySd.img`. And this time emulator had the SDcard. Thanks ! Now i understod what you meant in first comment. – vyi Jun 05 '13 at 19:19
  • Great, look's like you've discovered enough specifics to post and accept your own answer, so that the question can be formally resolved. – Chris Stratton Jun 05 '13 at 19:24

1 Answers1

1

The problem was partially due to my In-experience with android-emulator and partially due to my lack of AOSP understanding.

Basically when AOSP is built, the result goes to the 'out' directory located in the AOSP root (/home/mydev/AOSP/out/ in my case). All the tools and plateform tools like adb emulator fastboot mksdcard mksnapshot etc are located in a sub-directory( /out/host/linux-x86/bin ).

To set the environment( i.e. to place proper directories in system $PATH ) use the commands ". build/envsetup.sh" and lunch. Now on everything can be done the usual way( as we do with android sdk). emulator command launches the emulator. adb devices will return the list of available devices. mksdcard will create a sdcard.

For my specific problem the solution is( as suggested by ChrisStratton) to attach the sdcard image on boot up. That is done by using the following command :

emulator -sdcard MySd.img

This will launch the emulator with the MySd.img SD-Card image mounted !

This assumes you have already created the MySd.img, if not, use mksdcard command to make a Sd-Card image first. Thats All !

vyi
  • 1,078
  • 1
  • 19
  • 46