On 2023/6/9 17:27, Bin Meng wrote:
Hi,

On Tue, Jun 6, 2023 at 9:26 PM Ying-Chun Liu (PaulLiu)
<paul...@debian.org> wrote:

This is an implementation of single-character virtio-console. Part of the
patch is based on barebox implementations.

To test the patch, we can build qemu_arm64_defconfig target. Enable
CONFIG_VIRTIO_CONSOLE. And run qemu-system-aarch64 with
  -device virtio-serial-pci,id=virtio-serial0 \
  -chardev file,id=charconsole0,path=/tmp/serialconsolelog \
  -device virtconsole,chardev=charconsole0,id=console0 \


With this command, it still uses the on-board UART but not
virtio-console. Would you please post test instructions on using
virtio-console as the U-Boot serial console? Thanks!


Hi Bin,

Yes. The way to test this is.
I compile U-boot for qemu_arm64_defconfig
Enable the following configs manually.
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CONSOLE_MUX=y
CONFIG_SYS_CONSOLE_IS_IN_ENV=y

Now run qemu with the following commands.
qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \
-device virtio-serial-pci,id=virtio-serial0 \
-chardev file,id=charconsole0,path=/tmp/serialconsolelog \
-device virtconsole,chardev=charconsole0,id=console0 \
-bios /tmp/uboot-qemu-clang/u-boot.bin

In U-boot prompt,
we run
1. virtio scan
2. coninfo
In coninfo, we can see there is a new console device called virtio-console#XX
Then.
3. setenv stdout pl011@9000000,virtio-console#XX
And then all the output will also be output to /tmp/serialconsolelog on host.

This is the minimum example of testing the driver.
If we want to test it more then we might need to modify the -chardev to not use 
a file.
For example, we can use a telnet server.
-chardev socket,id=charconsole0,host=127.0.0.1,port=10023,telnet=on,server

After set stdin and stdout to pl011@9000000,virtio-console#XX
We can use "telnet localhost 10023" to access the U-boot prompt in qemu.

Yours,
Paul

Reply via email to