aboutsummaryrefslogtreecommitdiffstats
path: root/android/main.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-25 16:43:34 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-03-01 15:31:11 +0100
commitc480cca8d2007f5df62a7431beda310911b963e6 (patch)
treee3653361f360a21e7528c39e86638ada37d644c3 /android/main.c
parent0b0194940523fa3f318c380d0693907bd522241c (diff)
downloadexternal_qemu-c480cca8d2007f5df62a7431beda310911b963e6.zip
external_qemu-c480cca8d2007f5df62a7431beda310911b963e6.tar.gz
external_qemu-c480cca8d2007f5df62a7431beda310911b963e6.tar.bz2
Move cache partition initialization to core.
Change-Id: I1f887e6f8fc38e43b1fff3f7bab3814b52542762
Diffstat (limited to 'android/main.c')
-rw-r--r--android/main.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/android/main.c b/android/main.c
index e8bdac9..dad5d69 100644
--- a/android/main.c
+++ b/android/main.c
@@ -121,7 +121,6 @@ int main(int argc, char **argv)
int radio_serial = 0;
int qemud_serial = 0;
int shell_serial = 0;
- unsigned cachePartitionSize = 0;
AndroidHwConfig* hw;
AvdInfo* avd;
@@ -447,30 +446,41 @@ int main(int argc, char **argv)
args[n++] = "-nand";
args[n++] = strdup(tmp);
- if (hw->disk_cachePartition) {
- // TODO: This should go to core
- opts->cache = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_CACHE);
- cachePartitionSize = hw->disk_cachePartition_size;
+ /** CACHE PARTITION **/
+
+ if (opts->no_cache) {
+ /* No cache partition at all */
+ hw->disk_cachePartition = 0;
}
- else if (opts->cache) {
- dwarning( "Emulated hardware doesn't support a cache partition" );
- opts->cache = NULL;
- opts->no_cache = 1;
+ else if (!hw->disk_cachePartition) {
+ if (opts->cache) {
+ dwarning( "Emulated hardware doesn't support a cache partition. -cache option ignored!" );
+ opts->cache = NULL;
+ }
}
+ else
+ {
+ if (!opts->cache) {
+ /* Find the current cache partition file */
+ opts->cache = avdInfo_getCachePath(avd);
+ if (opts->cache == NULL) {
+ /* The file does not exists, we will force its creation
+ * if we are not in the Android build system. Otherwise,
+ * a temporary file will be used.
+ */
+ if (!avdInfo_inAndroidBuild(avd)) {
+ opts->cache = avdInfo_getDefaultCachePath(avd);
+ }
+ }
+ }
- if (opts->cache) {
- /* use a specific cache file */
- sprintf(tmp, "cache,size=0x%0x,file=%s", cachePartitionSize, opts->cache);
- args[n++] = "-nand";
- args[n++] = strdup(tmp);
- }
- else if (!opts->no_cache) {
- /* create a temporary cache partition file */
- sprintf(tmp, "cache,size=0x%0x", cachePartitionSize);
- args[n++] = "-nand";
- args[n++] = strdup(tmp);
+ if (opts->cache) {
+ hw->disk_cachePartition_path = ASTRDUP(opts->cache);
+ }
}
+ /** SD CARD PARTITION */
+
// TODO: This should go to core
if (hw->hw_sdCard != 0)
opts->sdcard = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_SDCARD);