Linux server kernel compilation foundation - a few important redhat Linux kernel file introductions

xiaoxiao2021-03-06  46

Linux server kernel compilation foundation - a few important redhat Linux kernel file introductions

Mynix compiled from www.linux.org Linux Howto Kernel Howto in the network, many servers use Linux systems. In order to further improve the performance of the server, it may be necessary to recompile the Linux kernel based on specific hardware and requirements. Compiling the Linux kernel and needs to be performed according to the prescribed steps, and several important files are involved in the compiled kernel. For example, for Redhat Linux, there are some files related to the Linux kernel in the / boot directory, enter / boot execution: ls -l, as shown.

The person compiled the Redhat Linux kernel may be deeply impressed by the system.map, vmlinuz, initrd-2.4.7-10.img, because the compiled kernel is involved in the establishment of these files. So how did these documents produce? What role is there? This article describes this.

1. VMLinuz VMLinuz is bootable, compressed kernel. "VM" represents "Virtual Memory". Linux supports virtual memory, unlike old operating systems such as DOS, 640KB memory restrictions. Linux can use the hard disk space as a virtual memory, so the name "VM". VMLinuz is an executable Linux kernel, which is located / boot / vmlinuz, which is generally a soft link, such as a soft link of VMLinuz-2.4.7-10 in the figure. VMLinuz has two ways. First, the compile core is created by "make zimage" and then generated by: "cp /usr/src/linux-2.4/Arch/i386/linux/boot/zimage / boot / vmlinuz". ZIMAGE is suitable for small kernels, and its existence is to rearward compatibility. Second, the kernel is created by the command Make Bzimage, and then passed: "cp /usr/src/linux-2.4/Arch/i386/linux/boot/bzimage / boot / vmlinuz" is generated. Bzimage is a compressed kernel image, it is important to note that BziMage is not compressed with BZIP2, BZImage is easily misunderstood, BZ represents "BIG ZIMAGE". BZIMAGE is "BIG" meaning. Zimage (VMLinuz) and Bzimage (VMLinuz) are compressed with Gzip. They are not only a compressed file, but also in the beginning of these two files, Gzip decompression code is embedded. So you can't use Gunzip or Gzip -DC to unpack VMLinuz. The kernel file contains a miniature Gzip to extract the kernel and boot it. The difference between the two is that the old zimage decompressed core to low-end memory (first 640K), Bzimage decompressed kernel to high-end memory (more than 1M). If the kernel is relatively small, one of Zimage or BziMage can be used, and the system runs in two ways is the same. The large kernel adopts BZImage, and Zimage cannot be used. VMLinux is an uncompressed kernel, VMLinuz is a VMLinux compressed file.

2. INITRD-X.X.X.IMG Initrd is the story of "Initial Ramdisk". Initrd is generally used to tempted boot hardware to actual kernel VMLinuz to take over and continue to boot. Initrd-2.4.7- 10 in the figure mainly is used to load file systems such as EXT3 and the driver of SCSI devices. For example, use the SCSI hard disk, and the kernel VMLinuz does not driver this SCSI hardware, then the kernel cannot load the root file system before being loaded into the SCSI module, but the SCSI module is stored under / lib / modules of the root file system. In order to solve this problem, you can guide an initrd core that can read the actual kernel and use initrd to correct SCSI boot issues. INITRD-2.4.7-10.IMG is a file compressed with gzip. Here, look at this file. The operation steps are shown below: From the contents of the Linuxrc script, the initrd implementation is loaded with some modules. And install the file system, etc.. The initrd image file is created using Mkinitrd. The MKinitrd utility can create an initrd image file. This command is the redhat. Other Linux distributions may have a corresponding command. This is a very convenient utility. For details, please see help: Man Mkinitrd The following command creates the initrd image file: 3. System.map system.map is a specific kernel kernel symbol table. It is the link to System.map in your current running kernel. How is the kernel symbol table creation? System.map is created by "NM VMLinux" and is not related to the symbol. For the examples in this article, compile the core, System.map creates in /usr/src/linux-2.4/system.map. Like this:

NM /BOOT/VMLINUX-2.4.7-10> System.map

The following line from /usr/src/linux-2.4/makefile:

转载请注明原文地址:https://www.9cbs.com/read-82560.html

New Post(0)