From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVVCP-000383-VY for qemu-devel@nongnu.org; Tue, 10 Mar 2015 21:12:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVVCO-00011H-Uf for qemu-devel@nongnu.org; Tue, 10 Mar 2015 21:12:37 -0400 Received: from mail-ob0-x231.google.com ([2607:f8b0:4003:c01::231]:41446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVVCO-00011A-O9 for qemu-devel@nongnu.org; Tue, 10 Mar 2015 21:12:36 -0400 Received: by obcva8 with SMTP id va8so5719944obc.8 for ; Tue, 10 Mar 2015 18:12:36 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 10 Mar 2015 18:12:35 -0700 Message-ID: From: Alex Sun Content-Type: multipart/alternative; boundary=089e012277466e3e130510f8f67b Subject: [Qemu-devel] Dummy question for setting up a serial connection between host and guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --089e012277466e3e130510f8f67b Content-Type: text/plain; charset=UTF-8 I downloaded QEMU 2.2.0, and built a qemu-system-arm from there. I loaded a versatile kernel 2.6.32.5 and my own file system. #qemu-system-arm -pidfile /tmp/qemu_0_pids/0.pid -M versatilepb -option-rom efi-rtl8139.rom -initrd newinitrd -kernel vmlinuz-2.6.32-5-versatile -append "root=/dev/sda1 console=ttyAMA0" -hda new.qcow2 -drive file=fat:rw:./data -nographic -no-reboot I see following message while the kernel is booting: [ 3.873429] dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a AMBA/PL011 [ 3.884631] console [ttyAMA0] enabled [ 3.889783] dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a AMBA/PL011 [ 3.890646] dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a AMBA/PL011 I think the serial ports of ttyAMA[0-2] are enabled. Then I try to do serial redirection: #qemu-system-arm -pidfile /tmp/qemu_0_pids/0.pid -M versatilepb -option-rom efi-rtl8139.rom -initrd newinitrd -kernel vmlinuz-2.6.32-5-versatile -append "root=/dev/sda1 console=ttyAMA0" -hda new.qcow2 -drive file=fat:rw:./data -nographic -no-reboot *-serial stdio -serial pty* However, I get error message: QEMU 2.2.0 monitor - type 'help' for more information *(qemu) qemu-system-arm: -serial stdio: cannot use stdio by multiple character devices* It's weired to me. I don't think there is another one other than qemu itself holding the stdio. Then I try to do redirect serial to both pty: #qemu-system-arm -pidfile /tmp/qemu_0_pids/0.pid -M versatilepb -option-rom efi-rtl8139.rom -initrd newinitrd -kernel vmlinuz-2.6.32-5-versatile -append "root=/dev/sda1 console=ttyAMA0" -hda new.qcow2 -drive file=fat:rw:./data -nographic -no-reboot -redir tcp:5000::22 *-serial pty -serial pty* It works fine this time. I got following output: vvfat ./data chs 1024,16,63 QEMU 2.2.0 monitor - type 'help' for more information (qemu) char device redirected to /dev/pts/87 (label serial0) char device redirected to /dev/pts/88 (label serial1) Then I do `cat /dev/pts/86` I see the kernel boot progress messages. When the guest has booted, I ssh to guest and do following experiment: (1) on host: #cat /dev/pts88 on guest: #echo "alex" > /dev/ttyAMA1 I see "alex" on host. (2) on guest: #cat /dev/ttyAMA1 on host: #echo "alex" > /dev/pts88 I see nothing on guest... Why the serial connection is one-way (e.x. guest to host)? How to configure it as dual-way? Any advise on this is highly appreciated!! Thanks! Alex --089e012277466e3e130510f8f67b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I downloaded QEMU 2.2.0, and built a qemu-system-arm from = there.
I loaded a versatile kernel 2.6.32.5 and my own file system.

#qemu-system-arm -pidfile /tmp/qemu_0_pids/0.pid -M v= ersatilepb -option-rom efi-rtl8139.rom -initrd newinitrd -kernel vmlinuz-2.= 6.32-5-versatile -append "root=3D/dev/sda1 console=3DttyAMA0" -hd= a new.qcow2 -drive file=3Dfat:rw:./data -nographic -no-reboot

I see following message while the kernel is booting:
<= div>
[ =C2=A0 =C2=A03.873429] dev:f1: ttyAMA0 at MMIO 0x= 101f1000 (irq =3D 12) is a AMBA/PL011
[ =C2=A0 =C2=A03.884631] co= nsole [ttyAMA0] enabled
[ =C2=A0 =C2=A03.889783] dev:f2: ttyAMA1 = at MMIO 0x101f2000 (irq =3D 13) is a AMBA/PL011
[ =C2=A0 =C2=A03.= 890646] dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq =3D 14) is a AMBA/PL011

I think the serial ports of ttyAMA[0-2] are ena= bled.
Then I try to do serial redirection:

#qemu-system-arm -pidfile /tmp/qemu_0_pids/0.pid -M versatilepb -option-= rom efi-rtl8139.rom -initrd newinitrd -kernel vmlinuz-2.6.32-5-versatile -a= ppend "root=3D/dev/sda1 console=3DttyAMA0" -hda new.qcow2 -drive = file=3Dfat:rw:./data -nographic -no-reboot -serial stdio -serial pty=

However, I get error message:
= QEMU 2.2.0 monitor - type 'help' for more information
= (qemu) qemu-system-arm: -serial stdio: cannot use stdio by multiple charact= er devices

It's weired to me. I don&= #39;t think there is another one other than qemu itself holding the stdio.= =C2=A0

Then I try to do redirect serial to both pt= y:
#qemu-system-arm -pidfile /tmp/qemu_0_pids/0.pid -M versatilep= b -option-rom efi-rtl8139.rom -initrd newinitrd -kernel vmlinuz-2.6.32-5-ve= rsatile -append "root=3D/dev/sda1 console=3DttyAMA0" -hda new.qco= w2 -drive file=3Dfat:rw:./data -nographic -no-reboot -redir tcp:5000::22=C2= =A0-serial pty -serial pty

It works fin= e this time. I got following output:
vvfat ./data chs 1024,1= 6,63
QEMU 2.2.0 monitor - type 'help' for more informatio= n
(qemu) char device redirected to /dev/pts/87 (label serial0)
char device redirected to /dev/pts/88 (label serial1)

Then I do `cat /dev/pts/86` I see the kernel boot progres= s messages.
When the guest has booted, I ssh to guest and do foll= owing experiment:
(1) =C2=A0on host:
#cat /dev/pts88

on guest:
#echo "alex" > /dev= /ttyAMA1

I see "alex" on host.

(2) on guest:
#cat /dev/ttyAMA1

on host:
#echo "alex" > /dev/pts88

I see nothing on guest...

Why the = serial connection is one-way (e.x. guest to host)? How to configure it as d= ual-way?

Any advise on this is highly appreciated!= !

Thanks!
Alex
--089e012277466e3e130510f8f67b--