diff options
author | David 'Digit' Turner <digit@android.com> | 2011-03-01 14:04:00 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-03-01 15:31:11 +0100 |
commit | 40841b2d221273a08abfe20824e7631211ade31d (patch) | |
tree | ea4ae5d5dd91b9473a4fd34c46e50f7af246f2a0 /vl-android.c | |
parent | 5f64b873605baa5519211b0d47a53c93df9d4868 (diff) | |
download | external_qemu-40841b2d221273a08abfe20824e7631211ade31d.zip external_qemu-40841b2d221273a08abfe20824e7631211ade31d.tar.gz external_qemu-40841b2d221273a08abfe20824e7631211ade31d.tar.bz2 |
Move system image initialization to core.
Change-Id: Ic8da3ccaed9bab7dbb44c0bb341b0dba20b90980
Diffstat (limited to 'vl-android.c')
-rw-r--r-- | vl-android.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vl-android.c b/vl-android.c index 04fed59..36289e4 100644 --- a/vl-android.c +++ b/vl-android.c @@ -60,6 +60,7 @@ #include "android/utils/filelock.h" #include "android/utils/path.h" #include "android/utils/stralloc.h" +#include "android/utils/tempfile.h" #include "android/display-core.h" #include "android/utils/timezone.h" #include "android/snapshot.h" @@ -4841,6 +4842,41 @@ int main(int argc, char **argv, char **envp) } #endif // CONFIG_NAND_LIMITS + /* Initialize system partition image */ + { + char tmp[PATH_MAX+32]; + const char* sysImage = android_hw->disk_systemPartition_path; + const char* initImage = android_hw->disk_systemPartition_initPath; + uint64_t sysBytes = android_hw->disk_systemPartition_size; + + if (sysBytes == 0) { + PANIC("Invalid system partition size: %" PRUd64, sysBytes); + } + + snprintf(tmp,sizeof(tmp),"system,size=0x%" PRUx64, sysBytes); + + if (sysImage && *sysImage) { + if (filelock_create(sysImage) == NULL) { + fprintf(stderr,"WARNING: System image already in use, changes will not persist!\n"); + /* If there is no file= parameters, nand_add_dev will create + * a temporary file to back the partition image. */ + } else { + pstrcat(tmp,sizeof(tmp),",file="); + pstrcat(tmp,sizeof(tmp),sysImage); + } + } + if (initImage && *initImage) { + if (!path_exists(initImage)) { + PANIC("Invalid initial system image path: %s", initImage); + } + pstrcat(tmp,sizeof(tmp),",initfile="); + pstrcat(tmp,sizeof(tmp),initImage); + } else { + PANIC("Missing initial system image path!"); + } + nand_add_dev(tmp); + } + /* Init SD-Card stuff. For Android, it is always hda */ /* If the -hda option was used, ignore the Android-provided one */ if (hda_opts == NULL) { |