[Top][All Lists]

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

Re: [Qemu-discuss] How to commucation by serial ports between host and t

From: Mike Lovell
Subject: Re: [Qemu-discuss] How to commucation by serial ports between host and target?
Date: Mon, 02 Apr 2012 13:12:32 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20120313 Lightning/1.0b2 Thunderbird/3.1.20

On 03/28/2012 08:02 PM, Parmenides wrote:

     When debugging the linux kernel with kgdb, it is necessary to
commucation between the host and the target. I started the qemu with:

               qemu -m 64M -kernel arch/x86/boot/bzImage -initrd
~/image.cpio.gz  -net nic -net tap,ifname=tap0 -vnc :1 -serial

and think the target will redirect its serial port to the host's
/dev/ttyS0. I set the serial ports

               stty ispeed 115200 ospeed 115200 -F /dev/ttyS0

in the target, and

               stty ispeed 115200 ospeed 115200 -F /dev/ttyS0


               cat /dev/ttyS0

in the target, and

               echo hello>  /dev/ttyS0

But, it seems that the commucation does not work. How to make the host
and the target commucation by their serial ports? Thx.

i think the problem is that you are using the physical serial port on the host instead of using a virtual device. unless you were to have a loopback device on the physical serial port of the host, the bits going out of it aren't going to be able to be read by the same device.

try using '-serial pty' on the guest. that will have qemu get a new pty allocated to it that it will use for serial communication. it will say something like "char device redirected to /dev/pts/11" when qemu is started. you can then read and write from the filename given and the result will be sent to and read from the guest. here is what i just tried.

qemu-system-x86_64 -enable-kvm -m 2048 -smp 2 -serial pty -drive file=/my/vm/disk.qcow2
char device redirected to /dev/pts/11

cat /dev/ttyS0

echo 'this is a test' > /dev/pts/11

'this is a test' then shows up in the guest. so give that a try. there are many other options you can use for serial ports including sockets and named pipes. the qemu man page has info about those.


reply via email to

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