[Libguestfs] [PATCH 2/2] launch: Use -bios bios-fast.bin where supported.

Richard W.M. Jones rjones at redhat.com
Tue May 17 15:29:41 UTC 2016


This is a cut-down version of the SeaBIOS configuration optimized for
booting a Linux kernel with the -kernel option on x86.  It was added
in qemu 2.7.  Use it if available.
---
 src/launch-direct.c  | 6 ++++++
 src/launch-libvirt.c | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/launch-direct.c b/src/launch-direct.c
index 0eece9c..397672a 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -449,6 +449,12 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
   ADD_CMDLINE ("-initrd");
   ADD_CMDLINE (initrd);
 
+  if (guestfs_int_qemu_supports_bios (g, data->qemu_data, "bios-fast.bin")) {
+    /* Use the fast variant of SeaBIOS. */
+    ADD_CMDLINE ("-bios");
+    ADD_CMDLINE ("bios-fast.bin");
+  }
+
   /* Add a random number generator (backend for virtio-rng).  This
    * isn't strictly necessary but means we won't need to hang around
    * when needing entropy.
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index 67cbde2..1f5e87c 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -1162,6 +1162,15 @@ construct_libvirt_xml_boot (guestfs_h *g,
 	} end_element ();
       }
     }
+#if defined(__i386__) || defined(__x86_64__)
+    /* XXX libvirt should provide a way to detect if bios-fast.bin exists */
+    else if (guestfs_int_qemu_version_ge (params->data->qemu_data, 2, 7)) {
+      /* Use the fast variant of SeaBIOS. */
+      start_element ("loader") {
+        string ("bios-fast.bin");
+      } end_element ();
+    }
+#endif
 
     start_element ("kernel") {
       string (params->kernel);
-- 
2.7.4




More information about the Libguestfs mailing list