0
votes

I'm writing a kernel from scratch in Rust for 64-bit ARM devices. For testing purpose, I use Qemu virt machine.

Currently, I'm able to write characters from guest to host console through UART. Now I would like to do the opposite, i.e. send characters from host console to guest UART port. Is there a way to do this? Should I add some arguments to Qemu?

I run Qemu virt machine with the following arguments:

qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -serial pty -S -kernel target/aarch64-unknown-none/debug/cortex-a57

It gives me a new pty that I can attach with screen /dev/pts/mypty. Then I run the program tapping c in Qemu console. I would like to use the same pty (or a new one?) to write data to the guest.

2

2 Answers

1
votes

QEMU always redirects both input and output for a guest UART to the same place; this is true of all of '-serial stdio', '-nographic' (which does an implicit '-serial mon:stdio') and '-serial pty'. So you don't need to do anything extra. If UART input is not working then the problem seems likely to be a bug in your guest code.

0
votes

Just read the same TTY as Qemu redirects all input to the same place.