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>
Showing
- Makefile 1 addition, 0 deletionsMakefile
- builtin-run.c 12 additions, 0 deletionsbuiltin-run.c
- hw/serial.c 26 additions, 20 deletionshw/serial.c
- include/kvm/term.h 6 additions, 5 deletionsinclude/kvm/term.h
- term.c 57 additions, 14 deletionsterm.c
- virtio/console.c 3 additions, 3 deletionsvirtio/console.c
Loading
Please register or sign in to comment