aboutsummaryrefslogtreecommitdiffstats
path: root/android/avd
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-12-05 09:54:44 -0800
committerSan Mehat <san@google.com>2009-12-07 14:48:32 -0800
commit68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f (patch)
tree59d93e62f0ee5789b80986b347cc1c52dbefb21a /android/avd
parentdc3dd741551c323bb853782656c0d693db98ecdc (diff)
downloadexternal_qemu-68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f.zip
external_qemu-68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f.tar.gz
external_qemu-68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f.tar.bz2
qemu: android: Add support for multiple SD cards
Add commandline support for an additional SD card, and plumb support to the MMC emulation layer. This patch also reworks the way the hw emulation layer registers devices. Previously, the mmc virtual hardware was only created if the sdcard image existed. Now, two virtual MMC controllers are *always* created as on real hardware. When a request is made to one of our controllers which has no image file bound to it, a new interrupt status indicating a command timeout is sent to the guest driver, as is standard with MMC controllers. This patch also sets the stage for supporting hot-add / hot-remove. Signed-off-by: San Mehat <san@google.com> qemu: android: Integrate card detect into the virtual mmc hardware and wire it up to the STATE_CHANGE irq status Signed-off-by: San Mehat <san@google.com> fixups from review - mmc now works with legacy drivers Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'android/avd')
-rw-r--r--android/avd/info.c62
-rw-r--r--android/avd/info.h1
2 files changed, 40 insertions, 23 deletions
diff --git a/android/avd/info.c b/android/avd/info.c
index e738065..6766c96 100644
--- a/android/avd/info.c
+++ b/android/avd/info.c
@@ -92,6 +92,12 @@ AvdInfo* android_avdInfo;
*/
#define SDCARD_PATH "sdcard.path"
+/* the config.ini key that is used to indicate the absolute path
+ * to the second SD Card image file, if you don't want to place it in
+ * the content directory.
+ */
+#define SDCARD2_PATH "sdcard2.path"
+
/* certain disk image files are mounted read/write by the emulator
* to ensure that several emulators referencing the same files
* do not corrupt these files, we need to lock them and respond
@@ -675,7 +681,26 @@ EXIT:
return l->pPath[0];
}
+static void _sdcardLoadImages(ImageLoader* l, AvdInfo* i, AvdInfoParams* params, AvdImageType sdcardImage)
+{
+ imageLoader_set(l, sdcardImage);
+ imageLoader_load(l, IMAGE_OPTIONAL |
+ IMAGE_IGNORE_IF_LOCKED);
+ /* if the file was not found, ignore it */
+ if (l->pPath[0] && !path_exists(l->pPath[0]))
+ {
+ D("ignoring non-existing %s at %s: %s",
+ l->imageText, l->pPath[0], strerror(errno));
+
+ /* if the user provided the SD Card path by hand,
+ * warn him. */
+ if (params->forcePaths[sdcardImage] != NULL)
+ dwarning("ignoring non-existing SD Card image");
+
+ imageLoader_setPath(l, NULL);
+ }
+}
/* find the correct path of all image files we're going to need
* and lock the files that need it.
@@ -772,23 +797,8 @@ _getImagePaths(AvdInfo* i, AvdInfoParams* params )
* already used, we must ignore it.
*/
if (!noSdCard) {
- imageLoader_set (l, AVD_IMAGE_SDCARD);
- imageLoader_load(l, IMAGE_OPTIONAL |
- IMAGE_IGNORE_IF_LOCKED);
-
- /* if the file was not found, ignore it */
- if (l->pPath[0] && !path_exists(l->pPath[0]))
- {
- D("ignoring non-existing %s at %s: %s",
- l->imageText, l->pPath[0], strerror(errno));
-
- /* if the user provided the SD Card path by hand,
- * warn him. */
- if (params->forcePaths[AVD_IMAGE_SDCARD] != NULL)
- dwarning("ignoring non-existing SD Card image");
-
- imageLoader_setPath(l, NULL);
- }
+ _sdcardLoadImages(l, i, params, AVD_IMAGE_SDCARD);
+ _sdcardLoadImages(l, i, params, AVD_IMAGE_SDCARD2);
}
return 0;
@@ -1043,22 +1053,24 @@ _getSkin( AvdInfo* i, AvdInfoParams* params )
}
/* If the user didn't explicitely provide an SD Card path,
- * check the SDCARD_PATH key in config.ini and use that if
+ * check the specfied key in config.ini and use that if
* available.
*/
static void
-_getSDCardPath( AvdInfo* i, AvdInfoParams* params )
+_getSDCardPath(AvdInfo* i, AvdInfoParams* params, AvdImageType sdcardImage,
+ const char* iniKey )
{
const char* path;
- if (params->forcePaths[AVD_IMAGE_SDCARD] != NULL)
+ if (params->forcePaths[sdcardImage] != NULL) {
return;
+ }
- path = iniFile_getString(i->configIni, SDCARD_PATH);
+ path = iniFile_getString(i->configIni, iniKey);
if (path == NULL)
return;
- params->forcePaths[AVD_IMAGE_SDCARD] = path;
+ params->forcePaths[sdcardImage] = path;
}
AvdInfo*
@@ -1087,7 +1099,8 @@ avdInfo_new( const char* name, AvdInfoParams* params )
* obsolete SDKs.
*/
_getSearchPaths(i);
- _getSDCardPath(i, params);
+ _getSDCardPath(i, params, AVD_IMAGE_SDCARD, SDCARD_PATH);
+ _getSDCardPath(i, params, AVD_IMAGE_SDCARD2, SDCARD2_PATH);
/* don't need this anymore */
iniFile_free(i->rootIni);
@@ -1255,6 +1268,9 @@ _getBuildImagePaths( AvdInfo* i, AvdInfoParams* params )
if (!noSdCard) {
imageLoader_set (l, AVD_IMAGE_SDCARD);
imageLoader_load(l, IMAGE_OPTIONAL | IMAGE_IGNORE_IF_LOCKED);
+
+ imageLoader_set (l, AVD_IMAGE_SDCARD2);
+ imageLoader_load(l, IMAGE_OPTIONAL | IMAGE_IGNORE_IF_LOCKED);
}
return 0;
diff --git a/android/avd/info.h b/android/avd/info.h
index 19df807..75dab89 100644
--- a/android/avd/info.h
+++ b/android/avd/info.h
@@ -58,6 +58,7 @@
_AVD_IMG(USERDATA,"userdata-qemu.img", "user data") \
_AVD_IMG(CACHE,"cache.img","cache") \
_AVD_IMG(SDCARD,"sdcard.img","SD Card") \
+ _AVD_IMG(SDCARD2,"sdcard2.img","SD Card 2") \
/* define the enumared values corresponding to each AVD image type
* examples are: AVD_IMAGE_KERNEL, AVD_IMAGE_SYSTEM, etc..