diff options
author | David 'Digit' Turner <digit@android.com> | 2011-03-01 00:48:52 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-03-01 16:07:28 +0100 |
commit | fd59c330bec77e7b9241e478efb1e1c508480d1d (patch) | |
tree | 6066fec2e82862a45479f4620633cca033465808 /android/main.c | |
parent | f7cdd20aac6980871eb8161d6eb08ee2c974e3b8 (diff) | |
download | external_qemu-fd59c330bec77e7b9241e478efb1e1c508480d1d.zip external_qemu-fd59c330bec77e7b9241e478efb1e1c508480d1d.tar.gz external_qemu-fd59c330bec77e7b9241e478efb1e1c508480d1d.tar.bz2 |
Move data partition initialization to core.
Change-Id: I3c2b4668593391026da028194503fc87246e44ba
Diffstat (limited to 'android/main.c')
-rw-r--r-- | android/main.c | 72 |
1 files changed, 63 insertions, 9 deletions
diff --git a/android/main.c b/android/main.c index 33a96ea..808ca4d 100644 --- a/android/main.c +++ b/android/main.c @@ -309,9 +309,6 @@ int main(int argc, char **argv) exit(1); } - /* Update HW config with the AVD information. */ - updateHwConfigFromAVD(hw, avd, opts, inAndroidBuild); - if (opts->keyset) { parse_keyset(opts->keyset, opts); if (!android_keyset) { @@ -583,13 +580,70 @@ int main(int argc, char **argv) /** DATA PARTITION **/ - bufprint(tmp, tmpend, - "userdata,size=0x%x,file=%s", - (uint32_t)hw->disk_dataPartition_size, - avdInfo_getImageFile(avd, AVD_IMAGE_USERDATA)); + if (opts->datadir) { + if (!path_exists(opts->datadir)) { + derror("Invalid -datadir directory: %s", opts->datadir); + } + } + + { + char* dataImage = NULL; + char* initImage = NULL; + + do { + if (!opts->data) { + dataImage = avdInfo_getDataImagePath(avd); + if (dataImage != NULL) { + D("autoconfig: -data %s", dataImage); + break; + } + dataImage = avdInfo_getDefaultDataImagePath(avd); + if (dataImage == NULL) { + derror("No data image path for this configuration!"); + exit (1); + } + opts->wipe_data = 1; + break; + } - args[n++] = "-nand"; - args[n++] = strdup(tmp); + if (opts->datadir) { + dataImage = _getFullFilePath(opts->datadir, opts->data); + } else { + dataImage = ASTRDUP(opts->data); + } + } while (0); + + if (opts->initdata != NULL) { + initImage = ASTRDUP(opts->initdata); + if (!path_exists(initImage)) { + derror("Invalid initial data image path: %s", initImage); + exit(1); + } + } else { + initImage = avdInfo_getDataInitImagePath(avd); + D("autoconfig: -initdata %s", initImage); + } + + hw->disk_dataPartition_path = dataImage; + if (opts->wipe_data) { + hw->disk_dataPartition_initPath = initImage; + } else { + hw->disk_dataPartition_initPath = NULL; + } + + uint64_t defaultBytes = defaultPartitionSize; + uint64_t dataBytes; + const char* dataPath = hw->disk_dataPartition_initPath; + + if (dataPath == NULL) + dataPath = hw->disk_dataPartition_path; + + path_get_size(dataPath, &dataBytes); + + hw->disk_dataPartition_size = + _adjustPartitionSize("data", dataBytes, defaultBytes, + avdInfo_inAndroidBuild(avd)); + } /** CACHE PARTITION **/ |