if (onQEMU()) {
/* look for virtio-serial logging on a QEMU machine. */
- printf("Loading virtio_pci module... ");
+ printf("Loading virtio modules.
");
+
+ if (mlLoadModule("virtio_console", NULL)) {
+ /* not really an error: it is built in on i386 */
+ printf("Can't load virtio_console module (built-in?).
");
+ }
+
if (mlLoadModule("virtio_pci", NULL)) {
+ /* this is necessary though */
fprintf(stderr, "Error loading virtio_pci module.
");
- sleep(5);
} else {
- printf("done.
");
- }
- if (!access(VIRTIO_PORT, W_OK)) {
- /* that means we really have virtio-serial logging */
- *virtiolog = VIRTIO_PORT;
- ++ret;
+ int wait = 0;
+ while (access(VIRTIO_PORT, W_OK) && wait < 3) {
+ /* wait up to 3 seconds for the port to appear */
+ sleep(1);
+ ++wait;
+ }
+ if (access(VIRTIO_PORT, W_OK)) {
+ /* still can't see */
+ fprintf(stderr, "Not initializing virtio logging "
+ "though we are on a kvm virt machine "
+ "(waited for %d seconds).
", wait);
+ } else {
+ /* that means we really have virtio-serial logging */
+ *virtiolog = VIRTIO_PORT;
+ ++ret;
+ }
}
}
return ret;
}
-/*
+/*
* Use anything you can find to determine if we are running on a QEMU virtual
* machine.
*/
diff --git a/scripts/mk-images b/scripts/mk-images
index 7d842f4..5f239fe 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -100,7 +100,7 @@ fi
TOPDIR=$(cd $TOPDIR; pwd)