Commit e1123015 authored by Markus Armbruster's avatar Markus Armbruster Committed by Anthony Liguori

pc: Make -no-fd-bootchk stick across boot order changes

Option -no-fd-bootchk asks the BIOS to attempt booting from a floppy
even when the boot sector signature isn't there, by setting a bit in
RTC CMOS.  It was added back in 2006 (commit 52ca8d6a).

Two years later, commit 0ecdffbb added monitor command boot_set.
Implemented by new function pc_boot_set().  It unconditionally clears
the floppy signature bit in CMOS.

Commit e0f084bf added -boot option once to automatically change the
boot order on first reset.  Reuses pc_boot_set(), thus also clears the
floppy signature bit.  Commit d9346e81 took care to preserve this

Thus, -no-fd-bootchk applies to any number of boots.  Except it
applies just to the first boot with -boot once, and never after
boot_set.  Weird.  Make it stick instead: set the bit according to
-no-fd-bootchk in pc_boot_set().
Signed-off-by: default avatarMarkus Armbruster <>
Reviewed-by: default avatarAnthony Liguori <>
Signed-off-by: default avatarAnthony Liguori <>
parent 083b79c9
......@@ -266,7 +266,7 @@ static int boot_device2nibble(char boot_device)
return 0;
static int set_boot_dev(ISADevice *s, const char *boot_device, int fd_bootchk)
static int set_boot_dev(ISADevice *s, const char *boot_device)
int nbds, bds[3] = { 0, };
......@@ -292,7 +292,7 @@ static int set_boot_dev(ISADevice *s, const char *boot_device, int fd_bootchk)
static int pc_boot_set(void *opaque, const char *boot_device)
return set_boot_dev(opaque, boot_device, 0);
return set_boot_dev(opaque, boot_device);
typedef struct pc_cmos_init_late_arg {
......@@ -407,8 +407,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
cpu_hotplug_cb.cpu_added_notifier.notify = rtc_notify_cpu_added;
/* set boot devices, and disable floppy signature check if requested */
if (set_boot_dev(s, boot_device, fd_bootchk)) {
if (set_boot_dev(s, boot_device)) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment