]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tools: Allow remapping guest TTY into host PTS
authorSasha Levin <levinsasha928@gmail.com>
Fri, 16 Sep 2011 08:49:13 +0000 (11:49 +0300)
committerSasha Levin <levinsasha928@gmail.com>
Fri, 16 Sep 2011 08:53:06 +0000 (11:53 +0300)
commitbdd986f2d394cf74b85c28166008a198fb88b6d0
treee0d691fdceef290c1dbb4417a5221ae112a14294
parent82927f66c280618ae5a3f843e3aeb79cfc6430d9
kvm tools: Allow remapping guest TTY into host PTS

This patch adds the '-tty' option to 'kvm run' which allows the user to
remap a guest TTY into a PTS on the host.

Usage:
        'kvm run --tty [id]'

The tty will be mapped to a pts and will be printed on the screen:
        '  Info: Assigned terminal 1 to pty /dev/pts/X'

At this point, it is possible to communicate with the guest using that pty.

This is useful for debugging guest kernel using KGDB:

1. Run the guest:
        'kvm run -k [vmlinuz] -p "kgdboc=ttyS1 kgdbwait" --tty 1'

And see which PTY got assigned to ttyS1.

2. Run GDB on the host:
        'gdb [vmlinuz]'

3. Connect to the guest (from within GDB):
        'target remote /dev/pty/X'

4. Start debugging! (enter 'continue' to continue boot).

Cc: David Evensky <evensky@dancer.ca.sandia.gov>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
tools/kvm/Makefile
tools/kvm/builtin-run.c
tools/kvm/hw/serial.c
tools/kvm/include/kvm/term.h
tools/kvm/term.c
tools/kvm/virtio/console.c