]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/poky-qemu-internal: call stty sane before exit
authorKhem Raj <raj.khem@gmail.com>
Thu, 17 Mar 2011 23:33:43 +0000 (16:33 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 31 Mar 2011 14:38:46 +0000 (15:38 +0100)
When qemu is booted into console with -nographics
then after exiting the terminal line settings are messed
up. This patch calls stty sane to restore the terminal
settings to default.

stty is part of coreutils which is installed on all
host distros hence there is no need to warn about it
being available or not

Signed-off-by: Khem Raj <raj.khem@gmail.com>
scripts/poky-qemu-internal

index 8fd1834ca8cad0745b02f2d24d34855db7b6829a..c88d71178b5dc54adf1fe8130d1fd84e61e7b29d 100755 (executable)
@@ -189,6 +189,9 @@ cleanup() {
         echo "poky-export-rootfs stop $ROOTFS"
         poky-export-rootfs stop $ROOTFS
     fi
+    # If QEMU crashes or somehow tty properties are not restored
+    # after qemu exits, we need to run stty sane
+    stty sane
 }
 
 n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
@@ -458,8 +461,7 @@ 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'"'
-# If QEMU crashes, we need to run stty sane
-$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || stty sane
+$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT"
 
 
 cleanup