Linux Kernel compilation in Linux

Source: Internet
Author: User
For details about how to compile the Linux kernel in the Linux system-Linux general technology-Linux programming and kernel information, see the following. I. kernel Introduction

Kernel is the core of an operating system. It manages system processes, memory, device drivers, files, and network systems, and determines system performance and stability.

An important feature of Linux is its open source code. All kernel source programs can be found in/usr/src/linux. Most application software is designed to comply with GPL, you can obtain the source code. Any software engineer in the world can add code that he thinks is excellent. One obvious benefit of this is the fast fixing of Linux vulnerabilities and the use of the latest software technology. The Linux kernel is the most direct representative of these features.

Imagine what the source program with the kernel means to you? First, we can understand how the system works. By reading the source code, we can understand the operating principle of the system, which is simply a fantasy in Windows. Secondly, we can tailor the system to suit our own situation, so we need to re-compile the kernel. What is the situation in Windows? I believe that many people have been inexplicably confused by the increasing size of Windows. Again, we can modify the kernel to meet our own needs. What does this mean? Yes, it is equivalent to developing an operating system on your own, but most of the work is done. All you have to do is add and implement the functions you need. In Windows, unless you are the core technical staff of Microsoft, you don't have to worry about it.

Ii. kernel version number

Since the Linux source program is completely open, anyone who follows GPL can modify the kernel and publish it to others. The development of Linux uses the market model (bazaar, which corresponds to the cathedral-church model). To ensure that these disordered development processes can be carried out in an orderly manner, Linux uses a dual-tree system. One tree is a stable tree, and the other is a non-stable tree or a development tree ). Some new features and experimental improvements will be implemented in the Development tree first. If the improvements made in the Development tree can also be applied to the stability tree, the same improvements will be made in the stability tree after tests in the Development tree. Once the development tree has been sufficiently developed, the development tree will become a new stable tree. The development number is reflected in the source program version number. The source program version number is in the form of x. y. z: for a stable tree, y is an even number. For a development tree, y is bigger than the corresponding stable tree (therefore, it is an odd number ). So far, the highest version of the stability tree is 2.4.18; the latest version of the Development tree is 2.5.10.

Iii. Why re-compile the kernel?

Linux, as a free software, is constantly updated with the support of many enthusiasts. The new kernel fixes bugs in the old kernel and adds many new features. If you want to use these new features or customize a more efficient and stable kernel based on your system, you need to recompile the kernel.

Generally, the updated kernel supports more hardware, provides better process management capabilities, and runs faster and more stably. It also fixes many vulnerabilities found in earlier versions, it is necessary for Linux users to regularly upgrade and update the system kernel.

In order to correctly set the kernel compilation configuration options and compile only the code of the functions required by the system, the following four considerations are generally taken:

1. Self-compiled kernels run faster (with less code)

2. The system will have more memory (the kernel part will not be exchanged to the virtual memory)

3. Compilation of unnecessary functions into the kernel may increase the vulnerability exploited by system attackers.

4. compiling a function into a module is slower than compiling it into the kernel.

Iv. kernel compilation Mode

To support a certain part of functions, such as the network, you can compile the corresponding part into the kernel (build-in) or compile the part into a module ), dynamic call. If it is compiled into the kernel, the corresponding functions can be automatically supported when the kernel is started. This advantage is convenient and fast, and the machine starts once, you can use this feature. The disadvantage is that it will make the kernel huge. Whether you need this feature or not, it will exist. This is the common practice of Windows, we recommend that you compile the frequently used parts directly into the kernel, such as the NIC. If it is compiled into a module, the corresponding. o file will be generated and can be dynamically loaded during use. The advantage is that the kernel will not be too large, but you have to call these modules by yourself.

V. Obtain and update the new kernel version

The official website for Linux kernel release is http://www.kernel.org.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.