aboutsummaryrefslogtreecommitdiffstats
path: root/android/main.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-03-01 14:03:20 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-03-01 15:31:11 +0100
commit48a3c66361158678f476fc7c2eca2bef025eae62 (patch)
tree276dd2b4c0c0dd5c64d8d32423ebc5884ba239fa /android/main.c
parentc480cca8d2007f5df62a7431beda310911b963e6 (diff)
downloadexternal_qemu-48a3c66361158678f476fc7c2eca2bef025eae62.zip
external_qemu-48a3c66361158678f476fc7c2eca2bef025eae62.tar.gz
external_qemu-48a3c66361158678f476fc7c2eca2bef025eae62.tar.bz2
Move the SD Card initialization to the core.
Change-Id: I2c8fa2a7df3d79ed4222296a93b787994a8ee11d
Diffstat (limited to 'android/main.c')
-rw-r--r--android/main.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/android/main.c b/android/main.c
index dad5d69..ae0fee6 100644
--- a/android/main.c
+++ b/android/main.c
@@ -115,7 +115,6 @@ int main(int argc, char **argv)
char* args[128];
int n;
char* opt;
- int use_sdcard_img = 0;
int serial = 0;
int gps_serial = 0;
int radio_serial = 0;
@@ -472,6 +471,9 @@ int main(int argc, char **argv)
opts->cache = avdInfo_getDefaultCachePath(avd);
}
}
+ if (opts->cache) {
+ D("autoconfig: -cache %s", opts->cache);
+ }
}
if (opts->cache) {
@@ -481,12 +483,38 @@ int main(int argc, char **argv)
/** SD CARD PARTITION */
- // TODO: This should go to core
- if (hw->hw_sdCard != 0)
- opts->sdcard = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_SDCARD);
- else if (opts->sdcard) {
- dwarning( "Emulated hardware doesn't support SD Cards" );
- opts->sdcard = NULL;
+ if (!hw->hw_sdCard) {
+ /* No SD Card emulation, so -sdcard will be ignored */
+ if (opts->sdcard) {
+ dwarning( "Emulated hardware doesn't support SD Cards. -sdcard option ignored." );
+ opts->sdcard = NULL;
+ }
+ } else {
+ /* Auto-configure -sdcard if it is not available */
+ if (!opts->sdcard) {
+ do {
+ /* If -datadir <path> is used, look for a sdcard.img file here */
+ if (opts->datadir) {
+ bufprint(tmp, tmpend, "%s/%s", opts->datadir, "system.img");
+ if (path_exists(tmp)) {
+ opts->sdcard = strdup(tmp);
+ break;
+ }
+ }
+
+ /* Otherwise, look at the AVD's content */
+ opts->sdcard = avdInfo_getSdCardPath(avd);
+ if (opts->sdcard != NULL) {
+ break;
+ }
+
+ /* Nothing */
+ } while (0);
+
+ if (opts->sdcard) {
+ D("autoconfig: -sdcard %s", opts->sdcard);
+ }
+ }
}
if(opts->sdcard) {
@@ -499,15 +527,16 @@ int main(int argc, char **argv)
if (size < 9*1024*1024ULL) {
fprintf(stderr, "### WARNING: SD Card files must be at least 9MB, ignoring '%s'\n", opts->sdcard);
} else {
- args[n++] = "-hda";
- args[n++] = opts->sdcard;
- use_sdcard_img = 1;
+ hw->hw_sdCard_path = ASTRDUP(opts->sdcard);
}
} else {
- D("no SD Card image at '%s'", opts->sdcard);
+ dwarning("no SD Card image at '%s'", opts->sdcard);
}
}
+
+ /** SNAPSHOT STORAGE HANDLING */
+
if (!opts->no_snapstorage) {
// TODO: This should go to core
opts->snapstorage = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_SNAPSHOTS);