In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
What are the three kernel files in the linux server? in order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
As long as the linux system has been used by users, they should know its powerful functions. But maybe users don't know about some files in the linux kernel.
The use of Linux servers is very common. In order to further improve the performance of the server, you may need to recompile the Linux kernel according to specific hardware and requirements. Compiling the Linux kernel needs to follow the prescribed steps, and several important files are involved in the process of compiling the kernel. For example, for RedHatLinux, there are some files related to the Linux kernel in the / boot directory, go to / boot to execute: ls-l. People who have compiled the RedHatLinux kernel may be impressed by the System.map, vmlinuz, and initrd-2.4.7-10.img in it, because the compilation of the kernel involves operations such as the creation of these files. So how did these files come into being? What's the use? This article briefly introduces three kernel files in linux.
1. Vmlinuz
Vmlinuz is a bootable, compressed kernel. "vm" stands for "VirtualMemory". Linux supports virtual memory, unlike older operating systems such as DOS, which have 640KB memory limitations. Linux can use hard disk space as virtual memory, hence the name "vm". Vmlinuz is the executable Linux kernel, located in / boot/vmlinuz, which is usually a soft link.
There are two ways to establish vmlinuz. First, when compiling the kernel, it is created by "makezImage" and then generated by: "cp/usr/src/linux-2.4/arch/i386/linux/boot/zImage/boot/vmlinuz". ZImage is suitable for small kernels, and it exists for backward compatibility. Second, the kernel is created by the command makebzImage when compiling, and then generated by: "cp/usr/src/linux-2.4/arch/i386/linux/boot/bzImage/boot/vmlinuz". BzImage is a compressed kernel image, it should be noted that bzImage is not compressed with bzip2, bz in bzImage is easily misleading, and bz stands for "bigzImage". The b in bzImage means "big".
Both zImage (vmlinuz) and bzImage (vmlinuz) are compressed with gzip. They are not only a compressed file, but also have gzip unzipped code embedded in the beginning of both files. So you can't unpack vmlinuz with gunzip or gzip-dc.
The kernel file contains a miniature gzip to extract the kernel and boot it. The difference between the two is that the old zImage decompresses the kernel to low-end memory (* 640K) and bzImage decompresses the kernel to high-end memory (more than 1m). If the kernel is small, you can use either zImage or bzImage, both of which boot the system at the same runtime. Large kernels use bzImage, not zImage.
Vmlinux is the uncompressed kernel and vmlinuz is the compressed file of vmlinux.
II. Initrd-x.x.x.img
Initrd is an abbreviation for "initialramdisk". Initrd is generally used to temporarily boot the hardware to a state where the actual kernel vmlinuz can take over and continue to boot. Initrd-2.4.7-10.img is mainly used to load the drivers of file systems such as ext3 and scsi devices. For example, if you are using a scsi hard disk and the kernel vmlinuz does not have a driver for this scsi hardware, the kernel cannot load the root file system until the scsi module is mounted, but the scsi module is stored under / lib/modules of the root file system. To solve this problem, you can boot an initrd kernel that can read the actual kernel and fix the scsi boot problem with initrd. Initrd-2.4.7-10.img is a file compressed with gzip.
Linuxrc this script initrd implementation loads some modules and installs the file system and so on. The initrd image file is created using mkinitrd. The mkinitrd utility can create initrd image files. This command is proprietary to RedHat. Other Linux distributions may have commands accordingly. This is a very convenient utility. For details, please see help: manmkinitrd.
III. System.map
System.map is a kernel symbol table for a specific kernel. It is a link to the System.map of the kernel you are currently running.
How is the kernel symbol table created? System.map is generated by "nmvmlinux" and irrelevant symbols are filtered out. For the example in this article, when the kernel is compiled, the System.map is created at / usr/src/linux-2.4/System.map. Like this:
Nm/boot/vmlinux-2.4.7-10 > System.map
The following lines are from / usr/src/linux-2.4/Makefile:
Nmvmlinux | grep-v'\ (compiled\)\ |\ (\ .o $\)\ |\ ([aUw]\)\ |\ (\. Ng$\)\ |\ (Lash [RL] DI\)'| sort > System.map
Then copy to / boot:
Cp/usr/src/linux/System.map/boot/System.map-2.4.7-10
When programming, symbols such as variable names or function names are named. The Linux kernel is a complex block of code with many global symbols.
Instead of using symbolic names, the Linux kernel identifies variable or function names by the address of the variable or function. For example, instead of using symbols like size_tBytesRead, you refer to this variable like c0343f20.
For people who use computers, they prefer names like size_tBytesRead to names like c0343f20. The kernel is mainly written in c, so the compiler / connector allows us to use symbolic names when coding and addresses when the kernel is running.
However, in some cases, we need to know the address of the symbol, or the symbol corresponding to the address. This is done by a symbol table, which is a list of all symbols along with their addresses. The variable name checkCPUtype is at the kernel address c01000a5.
The Linux symbol table uses 2 files:
/ proc/ksyms System.map
/ proc/ksyms is a "procfile" that is created during kernel boot. In fact, it's not really a file, it's just a representation of kernel data, but it gives people the illusion of a disk file, as can be seen from its file size of 0. However, System.map is the actual file that exists on your file system. When you compile a new kernel, the address of each symbol name changes, and your old System.map has the wrong symbolic information. Every time the kernel compiles a new System.map, you should replace the old System.map with the new System.map.
Although the kernel itself doesn't really use System.map, other programs such as klogd,lsof and ps need a correct System.map. If you use the wrong or no
The output of System.map,klogd will be unreliable, which makes it difficult to troubleshoot the program. Without System.map, you may be faced with some annoying prompts.
A few other drivers need System.map to parse symbols, and they won't work without a System.map created for the specific kernel you're running.
Linux's kernel log daemon, klogd, requires System.map for klogd to perform name-to-address resolution. System.map should be placed where the software that uses it can find it. Execution: manklogd knows that if System.map is not given to klogd as a variable, it will look for System.map in three places in the following order:
/ boot/System.map / System.map / usr/src/linux/System.map
System.map also has version information, and klogd can intelligently find the correct image (map) file.
The answers to the questions about what are the three kernel files in the linux server are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.