Qemu连接到特定的来宾UART设备 [英] Qemu connecting to specific guest UART device

查看:85
本文介绍了Qemu连接到特定的来宾UART设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用qemu-system-arm模拟嵌入式设备的固件.通过添加"console = ttyAMA0&",控制台的输出工作正常.到内核​​.在客户机上有一个二进制文件,该文件打开另一个串行端口以在/dev/ttyGS0上进行通信(双向),并在该端口上进行侦听.现在,我需要从主机连接到该端口,以将命令发送到二进制文件并接收输出.

I emulate the firmware of a embedded device with qemu-system-arm. The output of the console is working fine by appending "console=ttyAMA0" to the kernel. On the guest there is a binary which opens another serial port for communication (bi-directional) on /dev/ttyGS0 and listens on that port. Now I need to connect to this port from the host, to send commands to the binary and receive the output.

我已经尝试过创建字符设备和伪ttys等其他操作,但是我不知道如何为来宾定义串行设备.

I already tried different things like creating character devices and pseudo ttys, but I don't know how to define the serial device for the guest.

有没有办法做到这一点?预先感谢.

Is there a way to do this? Thanks in advance.

推荐答案

如果将多个-serial选项传递给QEMU,它们将被解释为定义要对UART 0、1、2等进行的操作.例如"-serial stdio -serial tcp :: 4444,server"会将UART 0发送到您的终端,并将UART 1连接到端口4444上的TCP服务器,然后您可以使用netcat或类似的实用程序进行连接.(您可以将串行输出连接到许多不同的后端,而不仅仅是stdio或TCP:请查看QEMU文档.)

If you pass multiple -serial options to QEMU they will be interpreted as defining what you want to do for UARTs 0, 1, 2, etc. So for example "-serial stdio -serial tcp::4444,server" will send UART 0 to your terminal and connect UART 1 to a TCP server on port 4444 which you can then connect to with netcat or similar utility. (You can connect serial output to a lot of different backends, not just stdio or TCP: check the QEMU documentation.)

(注意:当然,这取决于您的电路板模型,实际上创建了多个UART,并将它们正确连接到命令行选项.)

(NB: this relies on your board model actually creating multiple UARTs and wiring them up to the command line options correctly, of course.)

这篇关于Qemu连接到特定的来宾UART设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆