summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@linux.intel.com>2015-09-28 15:38:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-29 15:15:48 +0100
commit988369afed85281f3ed9b2f3eeb30f5408498bb9 (patch)
treeac95061e50c298ad34dcedb21fcf88f8b2659711 /scripts
parentd2e1cf176b2a705f3e4bd4ab7c35bb1de5dc6985 (diff)
downloadopenembedded-core-988369afed85281f3ed9b2f3eeb30f5408498bb9.tar.gz
openembedded-core-988369afed85281f3ed9b2f3eeb30f5408498bb9.tar.bz2
openembedded-core-988369afed85281f3ed9b2f3eeb30f5408498bb9.zip
runqemu-internal: Make sure two serial ports always exist
Since inittab for qemu images now always tries to start getty on a second serial device, make sure that device exists. Otherwise the following message will be spammed: INIT: Id "S1" respawning too fast: disabled for 5 minutes [YOCTO #8374] Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu-internal32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index d6b1102008..078545e931 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -700,6 +700,38 @@ if [ "x$SERIALSTDIO" = "x1" ]; then
stty intr ^]
fi
+
+# Preserve the multiplexing behavior for the monitor that would be there based
+# on whether nographic is used.
+if echo "$QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" | grep -- "-nographic"; then
+ FIRST_SERIAL_OPT="-serial mon:stdio"
+else
+ FIRST_SERIAL_OPT="-serial mon:vc"
+fi
+
+# qemuarm64 uses virtio for any additional serial ports so the normal mechanism
+# of using -serial will not work
+if [ "$MACHINE" = "qemuarm64" ]; then
+ SECOND_SERIAL_OPT="$SCRIPT_QEMU_EXTRA_OPT -device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
+else
+ SECOND_SERIAL_OPT="-serial null"
+fi
+
+# We always want a ttyS1. Since qemu by default adds a serial port when
+# nodefaults is not specified, it seems that all that would be needed is to
+# make sure a "-serial" is there. However, it appears that when "-serial" is
+# specified, it ignores the default serial port that is normally added.
+# So here we make sure to add two -serial if there are none. And only one
+# if there is one -serial already.
+NUM_SERIAL_OPTS=`echo $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/ /\n/g' | grep --count -- -serial`
+
+if [ "$NUM_SERIAL_OPTS" = "0" ]; then
+ SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $FIRST_SERIAL_OPT $SECOND_SERIAL_OPT"
+elif [ "$NUM_SERIAL_OPTS" = "1" ]; then
+ SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT"
+fi
+
+
echo "Running $QEMU..."
# -no-reboot is a mandatory option - see bug #100
if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then