diff options
author | David 'Digit' Turner <digit@google.com> | 2010-01-07 15:43:09 -0800 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2010-01-07 15:43:09 -0800 |
commit | 1cb37b34f117f72bb16de23f42ba6885e729d85c (patch) | |
tree | 251177ae40459554833847939ab637147e92f8fd /android/avd | |
parent | c973b058ebe38bb585a9a6026e39519db1f91c33 (diff) | |
download | external_qemu-1cb37b34f117f72bb16de23f42ba6885e729d85c.zip external_qemu-1cb37b34f117f72bb16de23f42ba6885e729d85c.tar.gz external_qemu-1cb37b34f117f72bb16de23f42ba6885e729d85c.tar.bz2 |
Add new -sdcard2 <file> option.
Add support for FreeBSD in the standalone build system.
Diffstat (limited to 'android/avd')
-rw-r--r-- | android/avd/info.c | 62 | ||||
-rw-r--r-- | android/avd/info.h | 1 |
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.. |