Hi, Peter Maydell, Thank you for the advice. So I uncommented the stdio_in_use guard, and used this option (because the second uart will be used)
-chardev null,mux=off,id=char0 -serial chardev:char0 -chardev stdio,mux=off,id=char1 -serial chardev:char1 And it gives me : qemu-system-aarch64: cannot use stdio by multiple character devices I tried setting mux=on or removing '-serial chardev:char0'. But the message is the same. The only way I can suppress the error seems to be removing the 'stdio_in_use' guard. I don't know how to 'not connect anything' to my first UART. Can you give me more specific option? p.s. : by the way I'm running from u-boot-spl (using -kernel elf at 0x4000000) which jumps to loaded linux(by -device loader option at 0x80200000) with dtb at 0x80000000 (also using -device loader option). I think in this case only my loaded dtb is used and the qemu-generated fdt is not used at all, is this correct? Best regards, Chan Kim >-----Original Message----- >From: Peter Maydell <peter.mayd...@linaro.org> >Sent: Wednesday, July 20, 2022 7:44 PM >To: Chan Kim <c...@etri.re.kr> >Cc: qemu-discuss <qemu-discuss@nongnu.org> >Subject: Re: linux shell comes out to qemu-monitor when I enter anything. >(I have two uarts) > >On Wed, 20 Jul 2022 at 11:27, Chan Kim <c...@etri.re.kr> wrote: >> >> Hello qemu experts, >> >> In my virtual machine I have two uart and I want to use the >> input/output in my host machine. >> For that I commented out these lines in qemu_chr_open_stdio function >> in chardev/char-stdio.c. (qemu-6.2.0) >> >> /* >> if (stdio_in_use) { >> error_setg(errp, "cannot use stdio by multiple character devices"); >> return; >> } >> */ > >Don't do that, there is a reason why that guard is there. >If you want multiple chardevs connecting to stdio you need to multiplex >them (otherwise, which one should input from the terminal go to?). > >> And used this option for stdio. >> >> -chardev stdio,mux=on,id=char0 -serial chardev:char0 -serial >> chardev:char0 >> >> And two serial ports are generated and is multiplexed into stdio backend. >> Actually in the software on the virtual machine, the first uart is >> never written and only the second uart is written to. But the dtb >> contains two uarts so I had to generate two frontends anyway. > >If you don't care about one of the UARTs, then just don't connect a chardev >to it (or equivalently, connect an instance of the 'null' chardev, which >throws away anything sent to it). > >-- PMM