[poky] [PATCH 1/1] qemu: Use mesa's libGL rather than nVidia's to avoid segfault of qemu

Zhai Edwin edwin.zhai at intel.com
Thu Mar 17 05:22:46 PDT 2011


From: Zhai Edwin <edwin.zhai at intel.com>

Proprietary nVidia driver introduce its own libGL that precede mesa's.
qemu has segfault if linked with it. This fix try to use mesa's libGL
if ldd find qemu linked with nVidia libGL.

[YOCTO #649]
[YOCTO #698]


Signed-off-by: Zhai Edwin <edwin.zhai at intel.com>
---
 scripts/poky-qemu-internal |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
index 3638a65..1f09fe7 100755
--- a/scripts/poky-qemu-internal
+++ b/scripts/poky-qemu-internal
@@ -436,10 +436,24 @@ else
     echo "Warning: distccd not present, no distcc support loaded."
 fi
 
+# qemu got segfault if linked with nVidia's libgl
+GL_LD_PRELOAD=$LD_PRELOAD
+
+if ldd $QEMUBIN | grep -i nvidia &> /dev/null
+then
+    echo "************** !!!Warning!!! **************
+    You installed nVidia's libGL.so that probably lead qemu segfault!
+    Pls. uninstall proprietary nVidia driver or make mesa libgl precede nvidia's."
+
+    # To avoid segfault of qemu, skip nVidia's libGL and use mesa's instead
+    echo "Skip nVidia's libGL!"
+    GL_LD_PRELOAD="/usr/lib/libGL.so $LD_PRELOAD"
+fi
+
 echo "Running $QEMU..."
 # -no-reboot is a mandatory option - see bug #100
 echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
-$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true
+LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true
 
 cleanup
 
-- 
1.7.1




More information about the poky mailing list