qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: using xterms for connecting to multiple uarts of the virtual machine


From: Chan Kim
Subject: RE: using xterms for connecting to multiple uarts of the virtual machine
Date: Mon, 17 Oct 2022 11:44:40 +0900

Hello all,

I solved the problem. 
The biggest problem was my interrupt number in the virtual machine (SPI
number) was different from the dtb, so I matched the uart interrupt numbers.
And then I found my input to the linux shell in the xterm sometimes gets
routed to the guest linux shell and sometimes to the host linux shell.
(It gave me two different prompt shape for my enter key, and for the 'ls'
command, it sometimes shows my host file system and some times the VM's
busybox file system)
So I figured what I guessed was right(the xterm is used both for VM and my
host).

Because I didn't know how to prevent my host machine's shell from  working
with the xterms, I tried using telnet(I don't know where I saw it, I was
reading qemu document) and tried this option.  

-serial telnet:localhost:4321,server -serial telnet:localhost:4322,server
-nographic

This makes qemu machine wait for telnet connection at start.
Then in two other terminals, I opened telnet connections.
telnet localhost 4321
telnet localhost 4322
Now I see u-boot output in one terminal and VM's linux shell window in
another terminal and I can use the VM's linux shell to test the driver!
Hope this helps someone later.
Thank you!

Chan Kim


>-----Original Message-----
>From: Chan Kim <ckim@etri.re.kr>
>Sent: Friday, October 14, 2022 11:59 AM
>To: 'qemu-discuss@nongnu.org' <qemu-discuss@nongnu.org>
>Subject: using xterms for connecting to multiple uarts of the virtual
>machine
>
>Hello all,
>
>I once asked about this last March but gave it up to solve it to tackle
>other problems at that time.
>Our FPGA board has two uart ports and I used u-boot to port linux and it
>runs ok on real FPGA board including the busybox shell(the uart and linux
>output come out to different uart ports).
>I used qemu virtual machine to analyze the programs and solve some
problems.
>My virtual machine (modified from arm virt machine, 6.2.0) also has two
>uart ports.
>With loading dtb and linux kernel image on DRAM using '-device
>loader,file=..,addr=..' option, and using u-boot-spl program in the '-
>kernel' option, I can run u-boot program and it switches to linux until the
>busybox shell program comes out.
>The problem is, when I enter something in the emulated busybox shell, it
>comes out to qemu monitor. I guess this is because of serial port setting
>in qemu options.
>(But when I provide linux kernel image in -kernel option and use qemu-
>generated dtb, the kernel boots ok and shell runs ok too)
>
>Until now, I have been using this option (run running from u-boot).
>"-nographic -chardev stdio,mux=on,id=char0 -chardev stdio,mux=on,id=char1 -
>serial chardev:char0 -serial chardev:char1"
>
>Now I need to solve this one now to be able to do some simple driver
>tests(using loadable driver module).
>I found https://stackoverflow.com/questions/39373236/redirect-multiple-
>uarts-in-qemu (alexei's answer) and I'm trying to use xterm to connect to
>my two uart ports.
>I tried xterm -e /bin/sh - 'while true; sleep 100; done' but xterm window
>doesn't come up.
>So I executed 'xterm &' command 3 times and I can see there are 3 new
>device files generated (for example /dev/pts/25, /dev/pts/26 and
>/dev/pts/27) And I ran qemu from u-boot and used option "-serial
>/dev/pts/26 -serial /dev/pts/27" (no -chardev options) and could see the u-
>boot program output in one xterm (I guess /dev/pts/26) and linux output in
>another xterm (I guess /dev/pts/27).
>So the qemu serial outputs are connected to separate xterm applications but
>when I enter something in the linux shell, the input is taken by my ubuntu
>host's /bin/sh.
>How can I use xterm just to be used by virtual machine's serial ports? Or
>in different words, how can I disconnect xterm from my host machine's shell
>program?
>
>Thank you for reading.
>Chan Kim
>







reply via email to

[Prev in Thread] Current Thread [Next in Thread]