The Computer Oracle

How to redirect QEMU -serial output to both a file and the terminal or a port?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs

--

Chapters
00:00 How To Redirect Qemu -Serial Output To Both A File And The Terminal Or A Port?
00:56 Accepted Answer Score 13
01:35 Thank you

--

Full question
https://superuser.com/questions/1373226/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#qemu

#avk47



ACCEPTED ANSWER

Score 13


Recently, I ran into the exactly same problem and found a solution:

According to QEMU 3.1.0 documentation, you can use a chardev with options stdio and logfile and redirect your serial into it.

qemu-system-x86_64 -chardev stdio,id=char0,logfile=serial.log,signal=off \
  -serial chardev:char0

Moreover, if you use mux=on option within chardev, you can redirect a monitor (mon), another serial or other interfaces supporting chardev backend into it simultaneously:

qemu-system-x86_64 -chardev stdio,id=char0,mux=on,logfile=serial.log,signal=off \
  -serial chardev:char0 -mon chardev=char0

See the example in the doc. link above.