Experimental requirements:
Booting from Start_kernel to init process using GDB trace debug kernel
Detailed analysis of the process initiated from Start_kernel to Init process and the combination of experiments to write a signed blog, and in the blog post "real name (and the name of the final application certificate must be consistent) + Original works reproduced please specify the source +" Linux kernel Analysis "MOOC Course/http mooc.study.163.com/course/ustc-1000029000 ", the specific requirements of the blog content are as follows:
Topic self-proposed, the content revolves around the Linux kernel boot process, namely starts from Start_kernel to the INIT process;
You need to use an experiment in your blog
The execution of the Start_kernel function needs to be carefully analyzed in the blog content
The summary section needs to clarify its understanding of the "Linux system startup process", especially how the idle process, process 1th is coming.
3) Please submit the blog post URL to the NetEase cloud classroom MOOC Platform Linux kernel Analysis Mooc course, edited into a link can be directly clicked open.
Open the shell with a virtual machine in the lab building
cd LinuxKernel/qemu -kernel linux-3.18.6/arch/x86/boot/bzImage -initrd rootfs.img
After the kernel boot is completed, enter the menu program, support three commands help, version and quit, you can add more commands, for elective "Software Engineering C Coding practice" of children's shoes should be a piece of cake.
Debug kernel with GDB trace
The help command I chose here
qemu -kernel linux-3.18.6/arch/x86/boot/bzImage -initrd rootfs.img -s -S # 关于-s和-S选项的说明: -S freeze CPU at startup (use ’c’ to start execution) -s shorthand for -gdb tcp::1234 若不想使用1234端口,则可以使用-gdb tcp:xxxx来取代-s选项
冻结qemu
Open another Shell window
输入 gdb
(gdb)file linux-3.18.6/vmlinux # 在gdb界面中targe remote之前加载符号表
(gdb)target remote:1234 # 建立gdb和gdbserver之间的连接,按c 让qemu上的Linux继续运行
起初一直出现连接超时的问题
(gdb)break start_kernel # 断点的设置可以在target remote之前,也可以在之后
设置断点 程序执行到断点处
实验结束。
Lab Three: Trace analysis of the boot process of the Linux kernel-----20135108 li Zeyuan