]> code.ossystems Code Review - openembedded-core.git/commitdiff
runqemu: Add a tcpserial option
authorRandy Witt <randy.e.witt@linux.intel.com>
Mon, 24 Aug 2015 07:25:03 +0000 (00:25 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 24 Aug 2015 22:45:25 +0000 (23:45 +0100)
The option was added so that the qemurunner could start a second tcp
serial port without adding machine conditional logic to qemurunner.

The issue that made this necessary was that when "virt" is passed to
qemu-system-aarch64, the normal mechanism for specifying a tcp serial
port does not work. This is because the hardware for the "virt" machine
is hardcoded in the device tree blob and the addition devices must be
virtio devices.

So runqemu can specify virtio for qemuarm64 whereas it seems all other
qemu machines work with the "-serial tcp*" option.

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/qemurunner.py
scripts/runqemu
scripts/runqemu-internal

index e976fd0819f14f8b979d708a8bf775dc1f6db460..33f31852a77def4a316f94eca58dd6c7705003a2 100644 (file)
@@ -92,7 +92,7 @@ class QemuRunner:
         # Set this flag so that Qemu doesn't do any grabs as SDL grabs interact
         # badly with screensavers.
         os.environ["QEMU_DONT_GRAB"] = "1"
-        self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial tcp:127.0.0.1:{} -serial tcp:127.0.0.1:{}"'.format(threadport, self.serverport)
+        self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial tcp:127.0.0.1:{}"'.format(threadport)
         if qemuparams:
             self.qemuparams = self.qemuparams[:-1] + " " + qemuparams + " " + '\"'
 
@@ -102,7 +102,7 @@ class QemuRunner:
             fcntl.fcntl(o, fcntl.F_SETFL, fl | os.O_NONBLOCK)
             return os.read(o.fileno(), 1000000)
 
-        launch_cmd = 'runqemu %s %s %s' % (self.machine, self.rootfs, self.qemuparams)
+        launch_cmd = 'runqemu tcpserial=%s %s %s %s' % (self.serverport, self.machine, self.rootfs, self.qemuparams)
         # FIXME: We pass in stdin=subprocess.PIPE here to work around stty
         # blocking at the end of the runqemu script when using this within
         # oe-selftest (this makes stty error out immediately). There ought
index 09c507dc7a23123964ed5a9a367c5e7bd6337d7c..82711606f66c53eeb3f12c453e9b90c39a16f81a 100755 (executable)
@@ -68,6 +68,7 @@ SCRIPT_QEMU_OPT=""
 SCRIPT_QEMU_EXTRA_OPT=""
 SCRIPT_KERNEL_OPT=""
 SERIALSTDIO=""
+TCPSERIAL_PORTNUM=""
 KVM_ENABLED="no"
 KVM_ACTIVE="no"
 
@@ -150,6 +151,9 @@ while true; do
             SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
             SERIALSTDIO="1"
             ;;
+        "tcpserial="*)
+            TCPSERIAL_PORTNUM=${arg##tcpserial=}
+            ;;
        "biosdir="*)
             CUSTOMBIOSDIR="${arg##biosdir=}"
            ;;
index d74332203787428593da46591a4cc99a96d78fd5..b317358f941e59bca93675d18ca1abce5af5fda1 100755 (executable)
@@ -620,6 +620,14 @@ if [ "x$QEMUOPTIONS" = "x" ]; then
     return 1
 fi
 
+if [ $TCPSERIAL_PORTNUM != "" ]; then
+    if [ "$MACHINE" = "qemuarm64" ]; then
+        QEMUOPTIONS="$QEMUOPTIONS -device virtio-serial-device -chardev socket,id=virtcon,port=$TCPSERIAL_PORTNUM,host=127.0.0.1 -device virtconsole,chardev=virtcon"
+    else
+        QEMUOPTIONS="$QEMUOPTIONS -serial tcp:127.0.0.1:$TCPSERIAL_PORTNUM"
+    fi
+fi
+
 PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
 
 QEMUBIN=`which $QEMU 2> /dev/null`