Construct a simple Linux system menuos

Source: Internet
Author: User

Chen Zhiwei 20135125

Original works reproduced please indicate the source

"Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000

Experimental guidance

Open the shell using the virtual machine of the lab building:

    1. CD linuxkernel/
    2. Qemu-kernel linux-3.18.6/arch/x86/boot/bzimage -initrd rootfs.img

Debug kernel with GDB trace

    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

Open another Shell window

    1. gdb
    2. file  Linux-3.18.6/vmlinux #  in GdB interface targe  Remote before loading symbol table
    3. (GDB) Target remote:1234 #  establish a connection between GDB and Gdbserver, press c  Let Linux on Qemu continue to run
    4. break start_kernel #  Breakpoints can be set before Target remote, or after

Understanding and experience of experimental results:

After analyzing the Start_kernel () function, I found that Start_kernel () called a series of initialization functions to complete the kernel itself. These actions are public, and others need to be configured to execute.

As the Monensin teacher said, the Start_kernel () function is equivalent to the MAIN.C function in the C language function, and Start_kernel () will persist after startup and Rest_init in Kernel_init and create process number 1th. That is, the INIT process, the first user-state process.

Construct a simple Linux system menuos

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.