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

Richard W.M. Jones rjones at redhat.com
Wed May 18 15:11:04 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 30cf01a..a6f06ee 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -434,6 +434,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 05ab6a6..9f76afa 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -1159,6 +1159,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_version_ge (&params->data->qemu_version, 2, 7, 0)) {
+      /* 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