Redirect serial output if `hvc0` is on

This commit is contained in:
Ruihan Li 2026-01-29 10:31:06 +08:00 committed by Tate, Hongliang Tian
parent a4f77b12b6
commit 6d2ff13a63
2 changed files with 5 additions and 3 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ target/
# qemu log file
qemu.log
qemu-serial.log
# packet dump file
virtio-net.pcap

View File

@ -49,7 +49,10 @@ else
fi
if [ "$CONSOLE" = "hvc0" ]; then
CONSOLE_ARGS="-device virtconsole,chardev=mux"
# Kernel logs are printed to all consoles. Redirect serial output to a file to avoid duplicate logs.
CONSOLE_ARGS="-device virtconsole,chardev=mux -serial file:qemu-serial.log"
else
CONSOLE_ARGS="-serial chardev:mux"
fi
if [ "$1" = "tdx" ]; then
@ -75,7 +78,6 @@ if [ "$1" = "tdx" ]; then
$CONSOLE_ARGS \
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \
-monitor chardev:mux \
-serial chardev:mux \
-d guest_errors \
"
echo $QEMU_ARGS
@ -89,7 +91,6 @@ COMMON_QEMU_ARGS="\
--no-reboot \
-nographic \
-display vnc=0.0.0.0:${VNC_PORT:-42} \
-serial chardev:mux \
-monitor chardev:mux \
-chardev stdio,id=mux,mux=on,signal=off,logfile=qemu.log \
$NETDEV_ARGS \