Http://blog.chinaunix.net/uid-20729583-id-1884617.html
Http://www.linuxidc.com/Linux/2014-08/105510.htm
Linux kernel code debugging is very cumbersome, usually add printk, or with Jtag debugging. The method here is to use QEMU to debug the Linux kernel. Because QEMU implements a GDB server itself, it is very convenient to use GDB to tune the kernel.
This is also very helpful for learning from the kernel.
To minimize the time spent on QEMU settings, use the following kernel image directly:
http://free-electrons.com/community/demos/qemu-arm-directfb/
1. Installation of QEMU
This can go to Qemu's official website to download the compilation, if you have a distribution on hand with the corresponding QEMU package, it can also be installed directly.
CentOS Word reference in front of CentOS rpm additional package source
2. Download the corresponding kernel image
Download from: http://free-electrons.com/pub/qemu/demos/arm/directfb/1.0/There's a vmlinuz-qemu-arm-2.6.20 in there.
3. Start QEMU
Start with the following command:
$ qemu-system-arm-m versatilepb-m 16-kernel vmlinuz-qemu-arm-2.6.20-append "Clocksource=pit quiet rw"-s-s
4. Debugging the Kernel
This requires a Vmlinux file containing debug information, which can be compiled directly http://free-electrons.com/pub/qemu/demos/arm/directfb/1.0/src/linux-2.6.20.tar.7z
If you do not want to compile, you can use a compiled Vmlinux file:
------------------------------------------Split Line------------------------------------------
FTP Address: ftp://ftp1.linuxidc.com
User name: ftp1.linuxidc.com
Password: www.linuxidc.com
Linuxidc.com\8 in 2014 \ Debug Linux kernel code with QEMU
Download method See http://www.linuxidc.com/Linux/2013-10/91140.htm
------------------------------------------Split Line------------------------------------------
Then execute the following command:
$ arm-none-linux-gnueabi-gdb Vmlinux
In the GDB console, enter:
(GDB) Target remote:1234
(GDB) B start_kernel
(GDB) C
At this point the program execution will fall on the breakpoint Start_kernel you set. Ok. Then you can debug the kernel code at will!
Ubuntu 12.04 does not find the QEMU command http://www.linuxidc.com/Linux/2012-11/73419.htm
Install Qemu+efi BIOS on Arch Linux http://www.linuxidc.com/Linux/2013-02/79560.htm
QEMU's translation framework and debugging Tools http://www.linuxidc.com/Linux/2012-09/71211.htm
a detailed description of QEMU : please click here
QEMU : please click here.
This article permanently updates the link address : HTTP://WWW.LINUXIDC.COM/LINUX/2014-08/105510TM
debugging Linux kernel code with QEMU