Hello all,
I have launched QEMU on p4080 with below options:
root@p4080ds:~# qemu-system-ppc -s -S -enable-kvm -nographic -m 512 -M ppce500 -cpu e500mc -kernel uImage -initrd rootfs.ext2.gz -append "root=/dev/ram rw console=ttyS0,115200"
But don't see kernel come up with it and in order to debug it further, I have attached gdb .
root@p4080ds:~# gdb vmlinux -ex 'target remote localhost:1234'
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-fsl-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/root/vmlinux...done.
Remote debugging using localhost:1234
0x00000000 in ?? ()
(gdb) b kvm_vcpu_ioctl
Breakpoint 1 at 0xc002ce60: file arch/powerpc/kvm/../../../virt/kvm/kvm_main.c, line 1963.
(gdb) p kvm_vcpu_ioctl
Cannot access memory at address 0xc002ce60
(gdb)
But I don't understand what "0x00000000 in ?? ()" & "Cannot access memory at address 0xc002ce60" implies to?
Thanks,
Manish Tiwari.
解決済! 解決策の投稿を見る。
Hello Manish Tiwari,
For setting up a debug stub to debug a guest OS, please refer to the following.
First vmlinux needs to be built with the same code of guest uImage including gdb information(CONFIG_DEBUG_INFO).
The cross gdb should be included in your cross toolchain, we use cross gdb to link with gdbserver (through qemu stub).
1. Startup first guest kernel on first console:
qemu-system-ppc -enable-kvm -nographic -m 512 -M ppce500 -kernel uImage -initrd rootfs.ext2.gz -append "root=/dev/ram rw loglevel=7 console=ttyS0,115200" -serial tcp::4444,server,telnet -net nic
<qemu> gdbserver
Waiting for gdb connection on device 'tcp::1234'
when you finish gdb test , input 'q' letter to quit from monitor.
<qemu> q
2. On the second console:
telnet 192.168.1.xx 4444
startup guest booting
3. On the third console:
a. start gdb and enter in gdb shell
$ powerpc-linux-gnu-gdb vmlinux
(gdb)
b. configuration to your architecture
(gdb) set architecture powerpc:e500
c. conncet to remote target(qemu/guest)
(gdb) target remote gdbserver_ip:gdbserver_port
Remote debugging using 192.168.1.xx:1234
epapr_ev_idle_start () at arch/powerpc/kernel/epapr_hcalls.S:36
36 arch/powerpc/kernel/epapr_hcalls.S: No such file or directory.
Now you can start to debug guest.
(gdb) break
guest will be paused.
(gdb) c
guest will continue...
(gdb) q
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Manish Tiwari,
Please refer to the following regarding qemu guest setting up and gdb debug.
Kernel configuration
Host kernel:
Enabling KVM
[*] Virtualization --->
For e500v2-based systems:
[*] KVM support for PowerPC E500 processors
[*] KVM in-kernel MPIC emulation
<*> Host kernel accelerator for virtio net (EXPERIMENTAL)
For e500mc/E5500/E6500 systems:
[*] KVM support for PowerPC E500MC/E5500/E6500 processors
[*] KVM in-kernel MPIC emulation
<*> Host kernel accelerator for virtio net (EXPERIMENTAL)
Enabling Virtual Networking
Networking support --->
Networking options --->
<*> 802.1d Ethernet Bridging
Device Drivers --->
[*] Network device support --->
[*] Network core driver support
<*> Universal TUN/TAP device driver support
Platform support
Freescale Book-E Machine Type
QEMU generic e500 platform
Guest kernel:
Enabling Network and Block Virtual I/O
Device Drivers --->
Virtio drivers --->
PCI driver for virtio devices
Device Drivers --->
[*] Block devices --->
<*> Virtio block driver
Device Drivers --->
[*] Network device support --->
[*] Network core driver support
<*> Virtio network driver
Qemu set up command
qemu-system-ppc -enable-kvm -nographic -m 512 -M ppce500 -kernel uImage -initrd rootfs.ext2.gz -append "root=/dev/ram rw loglevel=7 console=ttyS0,115200" -serial tcp::4444,server,telnet -net nic -S
<qemu> c
after guest bootuping, you can quit qemu monitor by input 'q' letter.
<qemu> q
on guest console:
telnet 192.168.1.xxx 4444
Note "-S" option:
Do not start CPU at startup (you must type 'c' in the monitor). This can be useful if
debugging.
Thanks,
Yiping