Serial debug output via Qemu

I found interesting the idea of using Qemu for serial output debugging available on this page : Serial Debugging | Haiku Project

Confirmed with the below, testing a USB network dongle driver and getting the logs in Haiku host system to simplify the retrieve of the kernel error log:

The command line used to redirect the file:

qemu-system-x86_64 -accel nvmm -m 2048 \
  -drive file=haiku-test-beta6.qcow2,format=qcow2 \
  -nic user \
  -usb \
  -device usb-host,vendorid=0x0bda,productid=0xf179 \
  -serial file:/tmp/haiku-serial.log

The logs are retrieved in a second terminal:
tail -f /tmp/haiku-serial.log

Note : host and QEmu must use the same Haiku version. When a serial port is not available on the host machine (like on modern laptop), it’s like having one in this situation:)

4 Likes

Serial Debugging | Haiku Project doesn’t mentions VMware, but a similar setup is also usable on at least Win10:

I set up the VM on VWware so the Serial Port VM option Use named pipe: == \\.\pipe\vmware, with the following two “drop down” choices being: “This end is the server.” and the next: “The other end is an application”.

Then, as the “client” of the serial connection, I use PuTTY (need to start it with admin privileges), where I’ve setup a serial connection using: \\.\pipe\vmware as “Serial line”.

This setup with VMware is specially helpful in cases of KDLs while using the VMware graphics drivers, as, at least under VMware, they stop refreshing the screen, so you can’t see your interactions with the KDL prompt (works OK on VirtualBox while using the same VMware graphics driver),

Edit: instructions tested on VMware Workstation 17.6.x.

For users of VMware Player… try editing your .vmx file similarly to the following:

serial0.fileName = "\\.\pipe\vmware"
serial0.fileType = "pipe"
serial0.present = "TRUE"
serial0.yieldOnMsrRead = "TRUE"
3 Likes

Why not just use -serial stdio?

1 Like

To save the log in a dedicated file in addition to have it displayed in the Terminal.

For VMware on macOS (I’d assume it’s the same on Linux) I use the following .vmx config:

serial0.present = "TRUE"
serial0.pipe.endPoint = "server"
serial0.fileType = "pipe"
serial0.yieldOnMsrRead = "TRUE"
serial0.startConnected = "TRUE"
serial0.fileName = "/tmp/haiku_kdl_pipe"

Then run

socat -d -d /tmp/haiku_kdl_pipe tcp-listen:9999 & \
telnet 127.0.0.1 9999

Alternatively, you can also connect via PTY. To do so, first run:

socat -d -d /tmp/haiku_kdl_pipe pty &

the command above will output the PTY device path, use screen to connect to it:

screen /dev/ttys001