mirror of https://gitee.com/openkylin/qemu.git
Add boot-once support
This allows to specify an exceptional boot order only for the first startup of the guest. After reboot, qemu will switch back to the default order (or what was specified via 'order='). Makes installing from CD images and then booting the freshly set up harddisk more handy. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
dda9b29f61
commit
e0f084bfc9
23
vl.c
23
vl.c
|
@ -2402,6 +2402,16 @@ static int parse_bootdevices(char *devices)
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void restore_boot_devices(void *opaque)
|
||||||
|
{
|
||||||
|
char *standard_boot_devices = opaque;
|
||||||
|
|
||||||
|
qemu_boot_set(standard_boot_devices);
|
||||||
|
|
||||||
|
qemu_unregister_reset(restore_boot_devices, standard_boot_devices);
|
||||||
|
qemu_free(standard_boot_devices);
|
||||||
|
}
|
||||||
|
|
||||||
static void numa_add(const char *optarg)
|
static void numa_add(const char *optarg)
|
||||||
{
|
{
|
||||||
char option[128];
|
char option[128];
|
||||||
|
@ -5111,9 +5121,10 @@ int main(int argc, char **argv, char **envp)
|
||||||
case QEMU_OPTION_boot:
|
case QEMU_OPTION_boot:
|
||||||
{
|
{
|
||||||
static const char * const params[] = {
|
static const char * const params[] = {
|
||||||
"order", NULL
|
"order", "once", NULL
|
||||||
};
|
};
|
||||||
char buf[sizeof(boot_devices)];
|
char buf[sizeof(boot_devices)];
|
||||||
|
char *standard_boot_devices;
|
||||||
int legacy = 0;
|
int legacy = 0;
|
||||||
|
|
||||||
if (!strchr(optarg, '=')) {
|
if (!strchr(optarg, '=')) {
|
||||||
|
@ -5131,6 +5142,16 @@ int main(int argc, char **argv, char **envp)
|
||||||
boot_devices_bitmap = parse_bootdevices(buf);
|
boot_devices_bitmap = parse_bootdevices(buf);
|
||||||
pstrcpy(boot_devices, sizeof(boot_devices), buf);
|
pstrcpy(boot_devices, sizeof(boot_devices), buf);
|
||||||
}
|
}
|
||||||
|
if (!legacy) {
|
||||||
|
if (get_param_value(buf, sizeof(buf),
|
||||||
|
"once", optarg)) {
|
||||||
|
boot_devices_bitmap |= parse_bootdevices(buf);
|
||||||
|
standard_boot_devices = qemu_strdup(boot_devices);
|
||||||
|
pstrcpy(boot_devices, sizeof(boot_devices), buf);
|
||||||
|
qemu_register_reset(restore_boot_devices,
|
||||||
|
standard_boot_devices);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_fda:
|
case QEMU_OPTION_fda:
|
||||||
|
|
Loading…
Reference in New Issue