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:
- CD linuxkernel/
- 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:
- Qemu-kernel LINUX-3.18.6/ARCH/X86/BOOT/BZIMAGE-INITRD Rootfs.img-s-S # Description of the-s and-s options:
- #-S Freeze CPU at startup (with ' C ' to start execution)
- #-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