[OE-core] [PATCH 1/2] runqemu: disable graphic when no DISPLAY

Robert Yang liezhi.yang at windriver.com
Thu Jun 25 09:24:31 UTC 2015


Disable graphic when no DISPLAY rather than print an error like:
[snip]
Could not initialize SDL(No available video device) - exiting
[snip]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 scripts/runqemu |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 09c507d..d9e91af 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -70,6 +70,7 @@ SCRIPT_KERNEL_OPT=""
 SERIALSTDIO=""
 KVM_ENABLED="no"
 KVM_ACTIVE="no"
+GRAPHIC="yes"
 
 # Determine whether the file is a kernel or QEMU image, and set the
 # appropriate variables
@@ -142,8 +143,7 @@ while true; do
 	    ISOFS=true
 	    ;;
         "nographic")
-            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
-            SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
+            GRAPHIC="no"
             ;;
         "serial")
             SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
@@ -291,6 +291,13 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
     fi
 fi
 
+# Disable graphic when no DISPLAY or -nographic is specified.
+if [ -z "$DISPLAY" -o "$GRAPHIC" = "no" ]; then
+    echo "Disabling graphic."
+    SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
+    SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
+fi
+
 machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
 # MACHINE is now set for all cases
 
-- 
1.7.9.5




More information about the Openembedded-core mailing list