Random recording (QEMU emulation Linux kernel)

Source: Internet
Author: User


"Disclaimer: Copyright all, welcome reprint.  Do not use for commercial purposes. Contact mailbox: feixiaoxing @163.com "


From the beginning of graduate school, I see kernel time is not short. Although the code read a lot, the principle of the book also read a lot, but always think that understanding is not very thorough. debugging kernel It is best to be able to run a single step, just like debugging a normal run file.

After using Qemu a while ago, it is really convenient to debug kernel with QEMU.


(1) Installing QEMU


sudo apt-get install QEMU-KVM

sudo apt-get install Qemu



(2) Compiling kernel


Cp/boot/config-3.8.0-19-generic. config

Make Menuconfig, save

Make Bzimage-j4



(3) file system directly using the Linux distribution's own RAM file system


Cp/boot/initrd.img-3.8.0-19-generic initrd.img



(4) Simulation kernel, start


Qemu-kernel BZIMAGE-INITRD initrd.img



(5) False assumption debugging bzimage, how to do?


Client:qemu-kernel BZIMAGE-INITRD Initrd.img-s-S

Gdb:gdb Vmlinux

Target remote:1234

b Start_kernel

C



(6) Simulation of x86 environment under dual-core


Qemu-kernel BZIMAGE-INITRD INITRD.IMG-SMP 2
QEMU uses multi-threaded methods to emulate multicore, each of which represents a core.

It's really interesting to be able to debug multi-core x86 CPUs with debugging multithreaded methods.




Random recording (QEMU emulation Linux kernel)

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.