Trace analysis of the boot process of the Linux kernel

Source: Internet
Author: User

Trace Analysis of the boot process of the Linux kernelShahuzy 20122137Original works reproduced please specify the source + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000 first, the contents of the experiment:Use the GDB trace debug kernel to boot from Start_kernel to init process. second, the experimental process: (attached)first into the experimental building environment, into the Linuxkernel folder, you can see the file linux-3.18.6 has been compiled to complete the previous work has been completed. Based on the prompt code, we'll start it. Code:
    1. CD linuxkernel/
    2. Qemu-kernel LINUX-3.18.6/ARCH/X86/BOOT/BZIMAGE-INITRD rootfs.img

The kernel boot is complete and the executable file init is executed. Enter help and see three commands. at this point, the Linux system is built.
Next we use GDB to trace the kernel running process, add the parameter-s-s in the previous code, start the kernel again. Code:
    1. Qemu-kernel LINUX-3.18.6/ARCH/X86/BOOT/BZIMAGE-INITRD Rootfs.img-s-S # Description of the-s and-s options:
    2. #-S Freeze CPU at startup (with ' C ' to start execution)
    3. #-S Shorthand for-gdb tcp::1234 If you do not want to use port 1234, you can use-GDB tcp:xxxx to replace the-s option
Visible, the window run is frozen.
Alternatively, open a window and use GDB to load the kernel image with the symbol table, link GDB server, set breakpoints to track the kernel.
This concludes the experiment. As for your own Linux environment, the speed limit has not been built successfully.
ㄒoㄒ)/~~ Three, experimental summary: Through this experiment, the first time to understand the code of the Linux kernel, through the kernel boot, freeze, recovery and tracking more in-depth of the Start_kernel function execution.

Trace analysis of the boot process of the 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.