Specific hardware may need to recompile the Linux kernel and needs. Compile Linux kernel, the provisions of the steps need to compile the kernel process involves several important documents. For example, RedHat Linux (placed in the directory for each distribution may be different), in the / boot directory there are some documents related to Linux kernel into / boot execute: ls-l. RedHat Linux kernel compiled one of the people on the System.map, vmlinuz, initrd-2.4.7-10.img impression may be more profound, because the process of compiling the kernel files related to the establishment of such an operation. So how these documents are produced? What effect?
vmlinuz is a bootable compressed kernel. "Vm" representatives "Virtual Memory". Linux supports virtual memory, unlike the old DOS operating system such as a 640KB memory limit. Linux can use hard disk space as virtual memory, hence the name "vm". vmlinuz is the Linux kernel executable, which is located in / boot / vmlinuz, which is generally a soft link.
There are two ways the establishment of vmlinuz. First, the kernel is compiled by "make zImage" to create, and then: "cp / usr / src / linux -2.4/arch/i386/linux / boot / zImage / boot / vmlinuz" generated. zImage for the case of a small core, its existence is for backward compatibility. Second, compile the kernel make bzImage command to create, and then: "cp / usr/src/linux-2.4/arch/i386/linux/boot/bzImage / boot / vmlinuz" generated. bzImage is the compressed kernel image, note, bzImage not with bzip2 compression, bzImage misleading in bz, bz, said "big zImage". bzImage of b is "big" means.
zImage (vmlinuz), and bzImage (vmlinuz) is compressed with gzip. Not only are they a compressed file, and in the beginning of both files embedded gzip decompression code. So you can not use gunzip or gzip-dc unpack vmlinuz.
Core file contains a mini gzip to decompress the kernel and boot it. The difference between the two is that the old zImage kernel to extract the low end of memory (first 640K), bzImage kernel to extract the high memory (1M or more.) If the kernel is small, then one can use zImage or bzImage, two ways to boot the system is running is the same. Using a large kernel bzImage, not by zImage.
vmlinux is the uncompressed kernel, vmlinuz is the compressed file vmlinux.
initrd is the "initial ramdisk" shorthand. initrd is generally used for temporary hardware to the real kernel vmlinuz boot can take over and continue to guide the state. initrd-2.4.7-10.img is mainly used to load the ext3 file system and other scsi device driver. For example, using a scsi hard drive, while the kernel vmlinuz and do not have the scsi hardware in the drive, then load scsi module, the kernel can not load the root file system, but the scsi module is stored in the root file system / lib / modules under the . To solve this problem, you can boot a kernel able to read the actual kernel and initrd boot problems with scsi initrd amendment. initrd-2.4.7-10.img is gzip compressed files.
initrd linuxrc script to achieve the installation file to load some modules and systems. initrd image file is created using the mkinitrd. mkinitrd utility to create initrd image file. This command is RedHat proprietary. Other Linux distributions may have a corresponding command. This is a very handy utility. See the specific circumstances to help: man mkinitrd.
System.map is a specific kernel kernel symbol table. It is your currently running kernel System.map links.
Kernel symbol table is how to create it? System.map is a "nm vmlinux" and not related to the symbols have been filtered out. For the examples in this article, compiling the kernel, System.map is created in / usr/src/linux-2.4/System.map. As follows:
nm / boot/vmlinux-2.4.7-10> System.map
The following lines from / usr/src/linux-2.4/Makefile:
nm vmlinux | grep-v '(compiled) | (. o $ $) |
([AUw] )|(.. ng $$)|( LASH [RL] DI) '| sort> System.map
Then copied to / boot:
cp / usr / src / linux / System.map / boot/System.map-2.4.7-10
During program design, some variables will be named the class name or function name symbol. Linux kernel is a complex block of code, there are many global symbols.
Linux kernel does not use a symbolic name, but by the address of the variable or function to identify the variable or function names. Such as not using size_t BytesRead such a symbol, but as c0343f20 that refer to this variable.
For people who use a computer, preferring to use those names such as size_t BytesRead, not like this name as c0343f20. Kernel is mainly written by c, so the compiler / linker allows us to use symbol names when encoding, when the kernel run time address.
However, in some cases, we need to know the address of symbols, or need to know the address of the corresponding symbols. This is done by the symbol table, all symbols with the symbol table is a list of their addresses. Variable name checkCPUtype in the kernel address c01000a5.
Symbol table to use Linux to 2 files:
/ Proc / ksyms
/ Proc / ksyms is a "proc file", created when the kernel boots. In fact, it is not really a file, it is just the kernel of data that gave people the illusion of a disk file, which is the file size is 0 can be seen. However, System.map is present in your actual file on the file system. When you compile a new kernel, the address of each symbol name to change your old System.map has wrong symbol information. Each kernel compile time to produce a new System.map, you should be replaced with new old System.map System.map.
Although the kernel itself does not really use System.map, but other programs such as klogd, lsof and ps such software requires a correct System.map. If you use the wrong or no System.map, klogd output will be unreliable, it failed to rule out the procedures will be difficult. There is no System.map, you may face some troubling message.
In addition a small number of drivers need System.map to resolve symbols, not specific to your currently running kernel to create the System.map they can not work properly.
Linux kernel log daemon klogd to implement the name - address resolution, klogd need to use the System.map. System.map should be placed on the use of its software can find its place. Executive: man klogd known, if not the System.map position as a variable to klogd, it will in the following order, in three places to find System.map:
/ Boot / System.map
/ Usr / src / linux / System.map
System.map also have version information, klogd can be smart to find the correct image (map) file.