[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[master] For x86_64 init must manually load virtio_console.



On i386 the module is built-in. Without the module virtio logging doesn't
work.

Resolves: rhbz#672527
---
 loader/init.c     |   35 ++++++++++++++++++++++++++---------
 scripts/mk-images |    2 +-
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/loader/init.c b/loader/init.c
index fb18113..7f49256 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -51,6 +51,7 @@
 #include <glib.h>
 
 #include "init.h"
+#include "../pyanaconda/isys/log.h"
 #include "copy.h"
 #include "devt.h"
 #include "devices.h"
@@ -345,24 +346,40 @@ static int getSyslog(gchar **addr, gchar **virtiolog) {
 
     if (onQEMU()) {
         /* look for virtio-serial logging on a QEMU machine. */
-        printf("Loading virtio_pci module... ");
+        printf("Loading virtio modules.\n");
+
+        if (mlLoadModule("virtio_console", NULL)) {
+            /* not really an error: it is built in on i386 */
+            printf("Can't load virtio_console module (built-in?).\n");
+        }
+
         if (mlLoadModule("virtio_pci", NULL)) {
+            /* this is necessary though */
             fprintf(stderr, "Error loading virtio_pci module.\n");
-            sleep(5);
         } else {
-            printf("done.\n");
-        }
-        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).\n", 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)
 
 # modules that are needed.  this is the generic "needed for every arch" stuff
-COMMONMODS="fat vfat nfs sunrpc lockd floppy cramfs loop edd pcspkr squashfs ipv6 8021q virtio_pci netconsole"
+COMMONMODS="fat vfat nfs sunrpc lockd floppy cramfs loop edd pcspkr squashfs ipv6 8021q virtio_pci virtio_console netconsole"
 UMSMODS="ums-jumpshot ums-datafab ums-freecom ums-usbat ums-sddr55 ums-onetouch ums-alauda ums-karma ums-sddr09 ums-cypress"
 USBMODS="$UMSMODS ohci-hcd uhci-hcd ehci-hcd usbhid mousedev usb-storage sd_mod sr_mod ub appletouch bcm5974"
 FIREWIREMODS="ohci1394 sbp2 fw-ohci fw-sbp2 firewire-sbp2 firewire-ohci"
-- 
1.7.3.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]