aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/vl.c b/vl.c
index 86bdce07e3..e9d5a363ad 100644
--- a/vl.c
+++ b/vl.c
@@ -2729,7 +2729,8 @@ int main(int argc, char **argv, char **envp)
int snapshot, linux_boot;
const char *initrd_filename;
const char *kernel_filename, *kernel_cmdline;
- const char *boot_order;
+ const char *boot_order = NULL;
+ const char *boot_once = NULL;
DisplayState *ds;
int cyls, heads, secs, translation;
QemuOpts *hda_opts = NULL, *opts, *machine_opts, *icount_opts = NULL;
@@ -4029,39 +4030,36 @@ int main(int argc, char **argv, char **envp)
kernel_cmdline = qemu_opt_get(machine_opts, "append");
bios_name = qemu_opt_get(machine_opts, "firmware");
- boot_order = machine_class->default_boot_order;
opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
if (opts) {
- char *normal_boot_order;
- const char *order, *once;
Error *local_err = NULL;
- order = qemu_opt_get(opts, "order");
- if (order) {
- validate_bootdevices(order, &local_err);
+ boot_order = qemu_opt_get(opts, "order");
+ if (boot_order) {
+ validate_bootdevices(boot_order, &local_err);
if (local_err) {
error_report_err(local_err);
exit(1);
}
- boot_order = order;
}
- once = qemu_opt_get(opts, "once");
- if (once) {
- validate_bootdevices(once, &local_err);
+ boot_once = qemu_opt_get(opts, "once");
+ if (boot_once) {
+ validate_bootdevices(boot_once, &local_err);
if (local_err) {
error_report_err(local_err);
exit(1);
}
- normal_boot_order = g_strdup(boot_order);
- boot_order = once;
- qemu_register_reset(restore_boot_order, normal_boot_order);
}
boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
boot_strict = qemu_opt_get_bool(opts, "strict", false);
}
+ if (!boot_order) {
+ boot_order = machine_class->default_boot_order;
+ }
+
if (!kernel_cmdline) {
kernel_cmdline = "";
current_machine->kernel_cmdline = (char *)kernel_cmdline;
@@ -4228,6 +4226,16 @@ int main(int argc, char **argv, char **envp)
net_check_clients();
+ if (boot_once) {
+ Error *local_err = NULL;
+ qemu_boot_set(boot_once, &local_err);
+ if (local_err) {
+ error_report("%s", error_get_pretty(local_err));
+ exit(1);
+ }
+ qemu_register_reset(restore_boot_order, g_strdup(boot_order));
+ }
+
ds = init_displaystate();
/* init local displays */