The three documents Linux kernel

2010-11-09  来源:本站原创  分类:OS  人气:78 

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?

A, vmlinuz

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.

Second, initrd-xxximg

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.

Third, System.map

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

System.map

/ 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

/ System.map

/ Usr / src / linux / System.map

System.map also have version information, klogd can be smart to find the correct image (map) file.

相关文章
  • The three documents Linux kernel 2010-11-09

    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

  • Linux kernel of the three documents 2010-11-09

    May need specific hardware and needs to recompile the Linux kernel. Compile the Linux kernel, the provisions of the steps need to compile the kernel process involves several important documents. For example for RedHat Linux (the directory to place ea

  • linux kernel learning materials 2010-04-02

    Recent self-Linux kernel side of things, the past two days under the shallow of the kernel boot process, in this record. Here, the Linux boot loader is not involved in virtual environment, that system does not run on top of the hypervisor. Linux thro

  • Linux Kernel Design and Implementation Notes - Kernel Synchronization 2010-06-19

    8.1 Critical areas and critical conditions of competition - to access and manipulate shared data in the code. Conditions of competition - if two threads may be in the same implementation of a critical area, then this is the program contains a bug. If

  • Linux kernel file Cache management mechanism introduced 2010-08-18

    1 Introduction Since its inception, Linux was continuously improved and popularity, now it has become one of the mainstream of general operating system, used well or very broad, Ta with Windows, UNIX Together account for nearly all the operating syst

  • linux kernel compilation reserved 2010-09-18

    Reprinted from http://www.newsmth.net/pc/pccon.php?id=10002501&nid=339754 Now popular ODL (only disk linux) to do the kernel part of those contents of the article does not describe this. I was doing, after the completion of order information. BY THE

  • Linux kernel and driver programming - Linux Proc File System reveal the mystery of 2010-10-12

    Abstract This paper introduces the Linux proc file system in some detail. Proc file system, first introduced the basic concept / stored / read time / loading, and then describes how to use the proc file system reads the system / kernel in a variety o

  • View Linux kernel. CPU. Memory and other components version of the commands and methods 2010-10-14

    This article comes from, " Wong Po's blog "blog, be sure to keep this source http://huangbao.blog.51cto.com/725279/152679 View Kernel version: uname-a more / etc / * release more / etc / redhat-release more / proc / version View CPU Information:

  • IPSEC Linux kernel implementation (1) --- reserved 2010-11-15

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, for any commercial purposes is strictly prohibited. MSN: [email protected] Source: http://yfydz.cublog.cn 1. Introdu

  • Linux kernel, some basic operations 2011-01-10

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, for any commercial purposes is strictly prohibited. msn: [email protected] Source: http://yfydz.cublog.cn 1. Preface

  • Linux kernel work queue (work_queue) operation 2011-01-10

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, for any commercial purposes is strictly prohibited. msn: [email protected] Source: http://yfydz.cublog.cn 1. Preface

  • Linux kernel implementation of the memory cache 2011-01-10

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, Used for any commercial purposes is strictly prohibited. msn: [email protected] Source: http://yfydz.cublog.cn 1. Pr

  • Linux kernel traffic control (1) 2011-01-10

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, Used for any commercial purposes is strictly prohibited. msn: [email protected] Source: http://yfydz.cublog.cn 1. Pr

  • Linux kernel traffic control (18) 2011-01-10

    Linux kernel traffic control (18) Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, for any commercial purposes is strictly prohibited. msn: [email protected] Source:

  • Linux kernel traffic control (24) 2011-01-10

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, for any commercial purposes is strictly prohibited. msn: [email protected] Source: http://yfydz.cublog.cn 8.10 mirre

  • Linux kernel and driver programming - Linux Proc File System opened the mystery 2010-10-12

    Abstract This paper introduces the Linux proc file system in some detail. First introduced the basic concepts of the proc file system / storage location / read time / loading mode, and then describes how to use the proc file system read the system /

  • Linux Kernel IPSEC implementation (1) 2011-01-10

    This document Copyleft owned yfydz all use under the GPL, can be freely copied, reproduced, reprinted, please maintain the integrity of the document, for any commercial purposes is strictly prohibited. msn: [email protected] Source: http://yfydz.

  • linux kernel file structure 2011-07-21

    1, Linux kernel source code is usually installed in / usr / src / linux under, and it has a very simple numbering convention: the core of any even number (the two numbers is even, for example, 2.0.30) is a stable The core issue, and any odd number of

  • Reproduced (the initial compilation linux kernel 3.0 kernel -) 2011-09-04

    The initial compilation linux kernel 3.0 kernel ~ 2011-07-24 21:21 The first kernel, the network found a tutorial ~ With so he tried to play with the mentality of a kernel compile. . . . Anyway, I do not expect to be able to compile a good or a small

  • Android has moved from the core Linux kernel code base to remove 2010-03-29

    News source: http://www.kroah.com/log/linux/android-kernel-problems.html As the Android kernel code is now gone from the Linux kernel, as of the 2.6.33 kernel release, I'm starting to get a lot of questions about what happened, and what to do next wi