Using the big kill recruit Qemu to debug Linux kernel code

Source: Internet
Author: User

Linux debugging Kernel code is very cumbersome. They generally add printk, or use JTAG debugging.

The method here is to use QEMU in order to debug the Linux kernel.

Since QEMU implements GDB server itself, it can easily be used by GDB to tune the kernel.

is also very helpful.

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 will be able to go to Qemu's official website to download the compilation, assuming that the distribution you have 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 appropriate 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, for example:

$ 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

There is a need for a vmlinux file that includes debugging information. Ability to compile http://free-electrons.com/pub/qemu/demos/arm/directfb/1.0/src/linux-2.6.20.tar.7z directly

If you don't want to compile, you can use a compiled Vmlinux file: http://pan.baidu.com/s/1sjuJYc1

Then run the following command, for example:

$ arm-none-linux-gnueabi-gdb Vmlinux

In GDB, in console input:

(GDB) Target remote:1234

(GDB) B start_kernel

(GDB) C

This time, the program runs it will fall on the Start_kernel office where you set breakpoints. Ok. So, you can debug kernel arbitrary code!

Using the big kill recruit Qemu to debug Linux kernel code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.