Linux 2.6 kernel compilation and Installation)

Source: Internet
Author: User

4. obtain a complete kernel source code.

Obtain a complete kernel source code

Download the desired kernel from www.kernel.org. The latest stable version of the kernel is 2.6.11.9.

 

 

Figure 1 download the latest original code from kernel.org

 

 

 

Preparations before configuration

Copy the downloaded source code package to any directory. Here we copy it ~ /Kernelsource/(to avoid using the root account temporarily ). Then enter ~ /Kernelsource directory, decompress:

Tar-jxvf Linux- 2.6.11.9.tar.bz2

Then we will get a directory named Linux- 2.6.11.9, which contains the source code of the kernel to be compiled. Enter this directory.

Cd ~ /Kernelsource/Linux- 2.6.11.9

It is worth noting that many books have said that the kernel must be decompressed to/usr/src.

In/usr/src, it is unnecessary to create a symbolic link named Linux to point to it. First, it is not necessary to compile the kernel in/usr/src, it works everywhere. Second, the source code tree pointed to by the/usr/src/Linux Symbolic Link is usually associated with the C library on your system, you shouldn't change it either.

 

 

 

Configure the kernel

This step is crucial. The purpose of Self-compiling the kernel is to customize a kernel suitable for your CPU and hardware devices. However, before we go further, I would like to mention some things about using the Kernel configuration tool first. We have five ways to configure the kernel: (The following illustration shows how to configure each configuration method)

1. Make config

This is an interactive text program based on the console. The system will ask you questions one by one. You will answer questions one by one and cannot repent. It is estimated that the average person will quit without the end and will not be recommended.

2. Make menuconfig

This is a text mode and menu-driven configuration program. It has a simple graphical interface and is easy to configure. It is my favorite configuration method.

Figure 2 menuconfig

The advantages of the above two methods are that they do not require the support of X. Of course, if you prefer the GUI environment, the following two methods can meet your needs:

3. Make xconfig

This is a configuration program written with QT. It is intuitive and clear to configure the kernel in the GUI. It is recommended for beginners.

Figure 3 xconfig

4. Make gconfig

If you prefer the GTK configuration style, use it.

Figure 4 gconfig

Finally, let's talk about two lazy methods:

5. Make defconfig

This is the default configuration of the kernel based on your machine type, saving you from the trouble of configuring the kernel. Some people say this is the default configuration of Linus on the x86 machine, but I am not sure. In addition, after many tests, this item will hardly be configured with a fully functional kernel, especially for non-Intel CPU recognition, USB flash drive support, NTFS partition support, and ADSL usage issues are not very satisfactory. Therefore, it is not recommended.

6. Make oldconfig

This is a non-interactive script. Use your current kernel settings as the configuration standard to re-compile the new kernel. It is a good choice if you just want to upgrade it easily.

You can choose one of the above six methods to open the Kernel configuration interface. Here, I use make xconfig. Next, go to the real Kernel configuration section.

When you open xconfig to face a series of configuration options, you don't need to worry about it. Many configurations have been set by default, and what we need to do is remove those that you don't want, modify those that do not meet our needs. Because these default options are intended for most users, some of them may not fit your own situation. We only need to modify them. As a desktop application, the entire Kernel configuration process can be divided into several parts: Code maturity level, module support, hardware devices, and general system options. Next, let's take a closer look at each part. It should be noted that some kernel configurations are related to the system hardware, so here I can only use my own computer configuration for example, for details, refer to the help provided by the Configuration tool.

1. Code maturity options

This option is used to tell the configuration program whether to display kernel features that are still in the test phase. If this option is selected, it is displayed. Otherwise, it is hidden. Users of desktop applications may wish to open it and test some new kernel features.

(Figure 5

 

 

 

2 module support

The design of the module is a major feature of Linux. It can expand the function of the kernel during runtime, which is very helpful for reducing the kernel size and learning kernel programming in the future. Therefore, you must select the upper and lower parts.

Figure 6 Module support

It is explained here that any configuration tool that can be selected as a dot project is the part that can be compiled into a module. If it is selected as a pair of hooks, it is the part that needs to be compiled into the kernel, the same below.

 

 

 

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.