diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-04-26 08:20:18 -0700 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-04-30 07:09:45 -0700 |
commit | 6f50aa39e741a1d1f3081665d0b7f8d56b7b793c (patch) | |
tree | e53c21b1ac6ebe3215c906d0958273e3aecf68ee /android | |
parent | 7756be82baf16d1c9bb65d2f6a9906afb222e0ca (diff) | |
download | external_qemu-6f50aa39e741a1d1f3081665d0b7f8d56b7b793c.zip external_qemu-6f50aa39e741a1d1f3081665d0b7f8d56b7b793c.tar.gz external_qemu-6f50aa39e741a1d1f3081665d0b7f8d56b7b793c.tar.bz2 |
Add an option to set custom size for cache partition
Change-Id: I1be43697ee04f46c5839c4d23e461d54eefc450f
Diffstat (limited to 'android')
-rw-r--r-- | android/cmdline-options.h | 1 | ||||
-rw-r--r-- | android/help.c | 9 | ||||
-rw-r--r-- | android/main.c | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/android/cmdline-options.h b/android/cmdline-options.h index eb8ede0..5e8d59f 100644 --- a/android/cmdline-options.h +++ b/android/cmdline-options.h @@ -72,6 +72,7 @@ CFG_PARAM( initdata, "<file>", "same as '-init-data <file>'" ) CFG_PARAM( data, "<file>", "data image (default <datadir>/userdata-qemu.img" ) CFG_PARAM( partition_size, "<size>", "system/data partition size in MBs" ) CFG_PARAM( cache, "<file>", "cache partition image (default is temporary file)" ) +OPT_PARAM( cache_size, "<size>", "cache partition size in MBs" ) CFG_FLAG ( no_cache, "disable the cache partition" ) CFG_FLAG ( nocache, "same as -no-cache" ) OPT_PARAM( sdcard, "<file>", "SD card image (default <system>/sdcard.img") diff --git a/android/help.c b/android/help.c index c6ffb87..1570160 100644 --- a/android/help.c +++ b/android/help.c @@ -585,6 +585,15 @@ help_cache(stralloc_t* out) } static void +help_cache_size(stralloc_t* out) +{ + PRINTF( + " use '-cache <size>' to specify a /cache partition size in MB. By default,\n" + " the cache partition size is set to 66MB\n\n" + ); +} + +static void help_no_cache(stralloc_t* out) { PRINTF( diff --git a/android/main.c b/android/main.c index 51d481c..d9d2274 100644 --- a/android/main.c +++ b/android/main.c @@ -723,6 +723,18 @@ int main(int argc, char **argv) } } + if (hw->disk_cachePartition_path && opts->cache_size) { + /* Set cache partition size per user options. */ + char* end; + long sizeMB = strtol(opts->cache_size, &end, 0); + + if (sizeMB < 0 || *end != 0) { + derror( "-cache-size must be followed by a positive integer" ); + exit(1); + } + hw->disk_cachePartition_size = (uint64_t) sizeMB * ONE_MB; + } + /** SD CARD PARTITION */ if (!hw->hw_sdCard) { |