diff options
author | Tim Baverstock <weasel@google.com> | 2010-12-02 14:21:39 +0000 |
---|---|---|
committer | Tim Baverstock <weasel@google.com> | 2010-12-02 17:50:58 +0000 |
commit | 53d8a5c0c8fc087d16316a4399f5a773339c4956 (patch) | |
tree | af1e02fa9dff6839a1852711bdfc57f3725e31a0 | |
parent | 86ca19f7e89801a5735277a3c99df53d697dd2c4 (diff) | |
download | external_qemu-53d8a5c0c8fc087d16316a4399f5a773339c4956.zip external_qemu-53d8a5c0c8fc087d16316a4399f5a773339c4956.tar.gz external_qemu-53d8a5c0c8fc087d16316a4399f5a773339c4956.tar.bz2 |
Add -no-snapshot-load option to permit reboot.
This is a workaround for the emulator not being able to detect the guest's
power-down situation, and simply lingering like a zombie: on exit it's saved
as a zombie, and is restored as a zombie which isn't useful. Denying autoload
forces a reboot.
Change-Id: I48f32600f5ce18cd5c71aa01d1b71b382102f227
-rw-r--r-- | android/cmdline-options.h | 7 | ||||
-rw-r--r-- | android/help.c | 21 | ||||
-rw-r--r-- | android/main-ui.c | 8 | ||||
-rw-r--r-- | android/main.c | 8 |
4 files changed, 32 insertions, 12 deletions
diff --git a/android/cmdline-options.h b/android/cmdline-options.h index 3aaa478..fc30ebc 100644 --- a/android/cmdline-options.h +++ b/android/cmdline-options.h @@ -79,9 +79,10 @@ OPT_PARAM( sdcard, "<file>", "SD card image (default <system>/sdcard.img") #if CONFIG_ANDROID_SNAPSHOTS OPT_PARAM( snapstorage, "<file>", "file that contains all state snapshots (default <datadir>/snapshots.img)") OPT_FLAG ( no_snapstorage, "do not mount a snapshot storage file (this disables all snapshot functionality)" ) -OPT_PARAM( snapshot, "<name>", "immediately load state snapshot rather than doing a full boot (default 'default-boot')" ) -OPT_FLAG ( no_snapshot, "do not start from snapshot, but perform a full boot sequence" ) -OPT_FLAG ( no_snapshot_save, "do not preserve snapshot, if restore was attempted" ) +OPT_PARAM( snapshot, "<name>", "name of snapshot within storage file for auto-start and auto-save (default 'default-boot')" ) +OPT_FLAG ( no_snapshot, "perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage" ) +OPT_FLAG ( no_snapshot_save, "do not auto-save to snapshot on exit: abandon changed state" ) +OPT_FLAG ( no_snapshot_load, "do not auto-start from snapshot: perform a full boot" ) OPT_FLAG ( snapshot_list, "show a list of available snapshots" ) #endif OPT_FLAG ( wipe_data, "reset the use data image (copy it from initdata)" ) diff --git a/android/help.c b/android/help.c index 348e2e6..f49e3fa 100644 --- a/android/help.c +++ b/android/help.c @@ -670,18 +670,19 @@ help_snapshot(stralloc_t* out) " Rather than executing a full boot sequence, the Android emulator can\n" " resume execution from an earlier state snapshot (which is usually\n" " significantly faster). When the parameter '-snapshot <name>' is given,\n" - " the emulator loads the snapshot of that name from the snapshot image.\n\n" + " the emulator loads the snapshot of that name from the snapshot image,\n" + " and saves it back under the same name on exit.\n\n" " If the option is not specified, it defaults to 'default-boot'. If the\n" " specified snapshot does not exist, the emulator will perform a full boot\n" - " sequence instead.\n\n" + " sequence instead, but will still save.\n\n" " WARNING: In the process of loading, all contents of the system, userdata\n" " and SD card images will be OVERWRITTEN with the contents they\n" " held when the snapshot was made. Unless saved in a different\n" " snapshot, any changes since will be lost!\n\n" - " If you want to create a snapshot, connect to the emulator console:\n\n" + " If you want to create a snapshot manually, connect to the emulator console:\n\n" " telnet localhost <port>\n\n" @@ -694,13 +695,23 @@ static void help_no_snapshot(stralloc_t* out) { PRINTF( - " This forces the emulator to perform a full boot sequence, rather than\n" - " loading the default snapshot. It overrides the '-snapshot' parameter.\n" + " This inhibits both the autoload and autosave operations, forcing\n" + " emulator to perform a full boot sequence and losing state on close.\n" + " It overrides the '-snapshot' parameter.\n" " If '-snapshot' was specified anyway, a warning is raised.\n\n" ); } static void +help_no_snapshot_load(stralloc_t* out) +{ + PRINTF( + " Prevents the emulator from loading the AVD's state from the snapshot\n" + " storage on start.\n\n" + ); +} + +static void help_no_snapshot_save(stralloc_t* out) { PRINTF( diff --git a/android/main-ui.c b/android/main-ui.c index 9366efd..16762a5 100644 --- a/android/main-ui.c +++ b/android/main-ui.c @@ -1520,14 +1520,18 @@ int main(int argc, char **argv) if (!opts->no_snapshot) { char* snapshot_name = opts->snapshot ? opts->snapshot : "default-boot"; - args[n++] = "-loadvm"; - args[n++] = snapshot_name; + if (!opts->no_snapshot_load) { + args[n++] = "-loadvm"; + args[n++] = snapshot_name; + } if (!opts->no_snapshot_save) { args[n++] = "-savevm-on-exit"; args[n++] = snapshot_name; } } else if (opts->snapshot) { dwarning("option '-no-snapshot' overrides '-snapshot', continuing with boot sequence"); + } else if (opts->no_snapshot_load || opts->no_snapshot_save) { + D("ignoring redundant option(s) '-no-snapshot-load' and/or '-no-snapshot-save' implied by '-no-snapshot'"); } } else if (opts->snapshot || opts->snapstorage) { dwarning("option '-no-snapstorage' overrides '-snapshot' and '-snapstorage', " diff --git a/android/main.c b/android/main.c index 677980b..03bd472 100644 --- a/android/main.c +++ b/android/main.c @@ -1412,14 +1412,18 @@ int main(int argc, char **argv) if (!opts->no_snapshot) { char* snapshot_name = opts->snapshot ? opts->snapshot : "default-boot"; - args[n++] = "-loadvm"; - args[n++] = snapshot_name; + if (!opts->no_snapshot_load) { + args[n++] = "-loadvm"; + args[n++] = snapshot_name; + } if (!opts->no_snapshot_save) { args[n++] = "-savevm-on-exit"; args[n++] = snapshot_name; } } else if (opts->snapshot) { dwarning("option '-no-snapshot' overrides '-snapshot', continuing with boot sequence"); + } else if (opts->no_snapshot_load || opts->no_snapshot_save) { + D("ignoring redundant option(s) '-no-snapshot-load' and/or '-no-snapshot-save' implied by '-no-snapshot'"); } } else if (opts->snapshot || opts->snapstorage) { dwarning("option '-no-snapstorage' overrides '-snapshot' and '-snapstorage', " |