Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] runqemu: change terminal's INTR key in 'serial' mode
@ 2012-12-21 13:00 Trevor Woerner
  2012-12-21 13:03 ` Trevor Woerner
  0 siblings, 1 reply; 4+ messages in thread
From: Trevor Woerner @ 2012-12-21 13:00 UTC (permalink / raw)
  To: openembedded-core

If you are using an image in '-serial stdio' mode, temporarily change the
terminal's interrupt character to 'Ctrl-]' for the duration of the image
run. In this way, hitting 'Ctrl-C' for something running in the image
doesn't accidentally abort the entire qemu session.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 scripts/runqemu          | 2 ++
 scripts/runqemu-internal | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/scripts/runqemu b/scripts/runqemu
index 190e3b4..9418ebd 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -64,6 +64,7 @@ LAZY_ROOTFS=""
 SCRIPT_QEMU_OPT=""
 SCRIPT_QEMU_EXTRA_OPT=""
 SCRIPT_KERNEL_OPT=""
+SERIALSTDIO=""
 
 # Determine whether the file is a kernel or QEMU image, and set the
 # appropriate variables
@@ -138,6 +139,7 @@ while true; do
         "serial")
             SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
             SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
+            SERIALSTDIO="1"
             ;;
         "qemuparams="*)
             SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 7fbe0a0..10d5a5f 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -444,6 +444,7 @@ if [ "$MACHINE" = "qemush4" ]; then
         #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
+        SERIALSTDIO="1"
     fi
     if [ "$FSTYPE" = "nfs" ]; then
         if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
@@ -453,6 +454,7 @@ if [ "$MACHINE" = "qemush4" ]; then
         fi
         KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
+        SERIALSTDIO="1"
     fi
 fi
 
@@ -565,6 +567,11 @@ then
 fi
 fi
 
+if [ "x$SERIALSTDIO" = "x1" ]; then
+        echo "Escape character is '^]'"
+        stty intr ^]
+fi
+
 echo "Running $QEMU..."
 # -no-reboot is a mandatory option - see bug #100
 if [ "$FSTYPE" = "vmdk" ]; then
-- 
1.8.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] runqemu: change terminal's INTR key in 'serial' mode
  2012-12-21 13:00 Trevor Woerner
@ 2012-12-21 13:03 ` Trevor Woerner
  0 siblings, 0 replies; 4+ messages in thread
From: Trevor Woerner @ 2012-12-21 13:03 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Fri, Dec 21, 2012 at 8:00 AM, Trevor Woerner <twoerner@gmail.com> wrote:
> +if [ "x$SERIALSTDIO" = "x1" ]; then
> +        echo "Escape character is '^]'"
> +        stty intr ^]
> +fi


Hold on. This should be "Interrupt charater".



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] runqemu: change terminal's INTR key in 'serial' mode
@ 2012-12-21 13:04 Trevor Woerner
  2012-12-22 20:19 ` Scott Garman
  0 siblings, 1 reply; 4+ messages in thread
From: Trevor Woerner @ 2012-12-21 13:04 UTC (permalink / raw)
  To: openembedded-core

If you are using an image in '-serial stdio' mode, temporarily change the
terminal's interrupt character to 'Ctrl-]' for the duration of the image
run. In this way, hitting 'Ctrl-C' for something running in the image
doesn't accidentally abort the entire qemu session.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 scripts/runqemu          | 2 ++
 scripts/runqemu-internal | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/scripts/runqemu b/scripts/runqemu
index 190e3b4..9418ebd 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -64,6 +64,7 @@ LAZY_ROOTFS=""
 SCRIPT_QEMU_OPT=""
 SCRIPT_QEMU_EXTRA_OPT=""
 SCRIPT_KERNEL_OPT=""
+SERIALSTDIO=""
 
 # Determine whether the file is a kernel or QEMU image, and set the
 # appropriate variables
@@ -138,6 +139,7 @@ while true; do
         "serial")
             SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
             SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
+            SERIALSTDIO="1"
             ;;
         "qemuparams="*)
             SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 7fbe0a0..a11220d 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -444,6 +444,7 @@ if [ "$MACHINE" = "qemush4" ]; then
         #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
+        SERIALSTDIO="1"
     fi
     if [ "$FSTYPE" = "nfs" ]; then
         if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
@@ -453,6 +454,7 @@ if [ "$MACHINE" = "qemush4" ]; then
         fi
         KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
+        SERIALSTDIO="1"
     fi
 fi
 
@@ -565,6 +567,11 @@ then
 fi
 fi
 
+if [ "x$SERIALSTDIO" = "x1" ]; then
+        echo "Interrupt character is '^]'"
+        stty intr ^]
+fi
+
 echo "Running $QEMU..."
 # -no-reboot is a mandatory option - see bug #100
 if [ "$FSTYPE" = "vmdk" ]; then
-- 
1.8.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] runqemu: change terminal's INTR key in 'serial' mode
  2012-12-21 13:04 [PATCH] runqemu: change terminal's INTR key in 'serial' mode Trevor Woerner
@ 2012-12-22 20:19 ` Scott Garman
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Garman @ 2012-12-22 20:19 UTC (permalink / raw)
  To: openembedded-core

On 12/21/2012 05:04 AM, Trevor Woerner wrote:
> If you are using an image in '-serial stdio' mode, temporarily change the
> terminal's interrupt character to 'Ctrl-]' for the duration of the image
> run. In this way, hitting 'Ctrl-C' for something running in the image
> doesn't accidentally abort the entire qemu session.
>
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>

Nice addition - thanks a bunch for this!

Acked-by: Scott Garman <scott.a.garman@intel.com>

> ---
>   scripts/runqemu          | 2 ++
>   scripts/runqemu-internal | 7 +++++++
>   2 files changed, 9 insertions(+)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 190e3b4..9418ebd 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -64,6 +64,7 @@ LAZY_ROOTFS=""
>   SCRIPT_QEMU_OPT=""
>   SCRIPT_QEMU_EXTRA_OPT=""
>   SCRIPT_KERNEL_OPT=""
> +SERIALSTDIO=""
>
>   # Determine whether the file is a kernel or QEMU image, and set the
>   # appropriate variables
> @@ -138,6 +139,7 @@ while true; do
>           "serial")
>               SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
>               SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
> +            SERIALSTDIO="1"
>               ;;
>           "qemuparams="*)
>               SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
> diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
> index 7fbe0a0..a11220d 100755
> --- a/scripts/runqemu-internal
> +++ b/scripts/runqemu-internal
> @@ -444,6 +444,7 @@ if [ "$MACHINE" = "qemush4" ]; then
>           #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
>           KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
>           QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
> +        SERIALSTDIO="1"
>       fi
>       if [ "$FSTYPE" = "nfs" ]; then
>           if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
> @@ -453,6 +454,7 @@ if [ "$MACHINE" = "qemush4" ]; then
>           fi
>           KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
>           QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
> +        SERIALSTDIO="1"
>       fi
>   fi
>
> @@ -565,6 +567,11 @@ then
>   fi
>   fi
>
> +if [ "x$SERIALSTDIO" = "x1" ]; then
> +        echo "Interrupt character is '^]'"
> +        stty intr ^]
> +fi
> +
>   echo "Running $QEMU..."
>   # -no-reboot is a mandatory option - see bug #100
>   if [ "$FSTYPE" = "vmdk" ]; then
>


-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-22 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-21 13:04 [PATCH] runqemu: change terminal's INTR key in 'serial' mode Trevor Woerner
2012-12-22 20:19 ` Scott Garman
  -- strict thread matches above, loose matches on Subject: below --
2012-12-21 13:00 Trevor Woerner
2012-12-21 13:03 ` Trevor Woerner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox