2019-2020-1 20199326 "Linux kernel principle and Analysis" in the fourth week of work

The fourth week of learning content

Paodingjieniu Linux kernel analysis Chapter Three: MenuOS construction

Linux kernel analysis third experiment

I learned some knowledge

  • The operating system two sword: 1 interrupt context switching - Save and restore the site of the field 2. The process context switch
  • Linux kernel version naming rules: ABCD, A represents a substantial change of the kernel, B refers to a number of major changes to the kernel, C is the real version of the kernel, D is security patches and bug fixes
  • linux kernel source directory structure:
    • arch the contents of the Linux kernel can support different CPU and architecture, we use computers are basically the x86 architecture, so only need to focus on x86 file directory can be
    • Linux storage system block code stored on the device management block
    • crypto holiday store it C language code encryption algorithms, such as crc32, md5, sha1, etc.
    • document store some documents
    • drivers drive directory, stored inside a linux kernel to support all the hardware driver source code
    • firmware firmware
    • Achieve fs file system, which lists the Linux supports various file systems
    • include header file directories stored public header files
    • init initialization code is stored at the start of the Linux kernel, which main.c source file is the starting point of the entire Linux kernel boot
    • ipc is inter-process communication, storage is supported by the IPC linux code implementation
    • kernel kernel, the kernel file to store some of the core code itself needs
    • lib public libraries, some public libraries
    • mm is the memory management memory management, storage management code linux kernel
    • net relevant code storage network, such as TCP / IP stack
    • readme is a document that discusses what is Linux, Linux can run on hardware that and other issues.
  • Linux kernel analysis of the more important is the source files in the directory under the arch x86 directory, main.c init directory under the next kernel scheduling and process-related code, there are other memory management, networking, file system codes

Content Experiments

Follow-up analysis of the Linux kernel boot process

1. Start menuos

cd LinuxKernel/
qemu -kernel linux-3.18.6/arch/x86/boot/bzImage -initrd rootfs.img

Start effect is shown

2. Use gdb debugging kernel tracing

qemu -kernel linux-3.18.6/arch/x86/boot/bzImage -initrd rootfs.img -s -S

Open another shell window, enter the input of the next Linuxkernel directory gdb
set breakpoints in gdb

file linux-3.18.6/vmlinux  #加载符号表
target remote:1234  #建立gdb和gdbserver之间的连接
break start_kernel  #设置断点
c   #让qemu上的linux继续运行
break rest_init #设置另一个断点
c  #继续执行

FIG implementation of the results

Guess you like

Origin www.cnblogs.com/funmary/p/11619990.html