Linux Kernel Compilation Guide

Source: Internet
Author: User
Tags ide hard drive
After Ubuntu 7.04 is installed, the keyboard sometimes becomes invalid due to poor performance in many places, such as no sound. The online cool-man said that the ultimate way to solve these problems is to compile the latest kernel, so he thought of compiling the Linux kernel by himself.

The purpose of this article is to allow cainiao to compile their own kernel. Of course, if you are too fond of cooking, such as just installing Ubuntu, you must first learn relevant tutorials. Otherwise, sudo/apt-Get/dpkg won't be used, let alone kernel encoding. If you think that sudo is not a cainiao, it means that you have a good virtue of self-satisfaction.

I. Why compile the latest kernel?
1. The new kernel has more powerful functions. For example, the IDE Hard Drive acceleration function provided by kernel 2.6.19
2. I like DIY and have a sense of accomplishment. Especially when uname-A is used, you can see your own name.
3. self-abuse. Nothing can abuse yourself and waste valuable time playing games better than coding the kernel. In particular, some people like to sit in front of the screen after issuing the compilation command (it is strongly recommended that people who think they have a lot of time to use this method)
4. learning and research
5. Other reasons.

2. Preparations before Compilation
1. Install related software. You may need to use the following software:
A) in Linux, what else can I compile without this?
B) Build-essential, which includes GCC, make, and other things.
C) kernel-package, which contains make-kpkg.
D) Qt library, mainly to use make xconfig graphical interface configuration, you want to install libqt3-headers, libqt3-mt-dev, etc.
E) libncurses5-dev, mainly with make menuconfig, I will use this.
F) GTK library for make gconfig. Install gtk2.0 and related Lib.

2. DownloadSource codeDecompress the package. Go to www.kernel.org. Be sure not to install patches. Click the "f" connection to get the sourceCodeThere should be more than 40 M. If there is only 6 m, the patch is used.

3. Configure the kernel
We recommend that you use the old configuration file/boot/config-XXXXX. After importing the old configuration file, modify the required parameters, save and exit.
Configuration is the most difficult and time-consuming step. If you are an impatient person and like to watch it out, I dare say that you must have a bad Kernel configuration, and if you use the default settings, I promise you will not be able to start the kernel. The default settings have several key points that must be modified.

To DIY your own kernel, you must understand what your machine is installed. Of course, the times have improved. You don't have to unpack the machine to view the hardware. You can use commands such as lspci/lshw/CAT/proc/cpuinfo to view the hardware configuration. Your motherboard manual and video card manual are useful. Don't lose them. Find them.

With regard to the configuration menu, this will fully reflect your skill in playing an English game. If you do not understand English, you can learn textbooks, look up the dictionary, or play CS and war3 in English.

You can search Baidu or Google for "Kernel configuration" and other words to find the relevantArticle, There are still many, but they cannot keep up with the times. Now 2.6.22 Linux

Here is a good Kernel configuration article
Http://forum.ubuntu.org.cn/weblog.php? W = 215

Iii. Start Compilation
Now we are working later. If you really understand the configuration menu, you are basically a success. If you do, you have to repeat this step 2nd times and 3rd Times.
1. Run the commandSudo make-kpkg cleanClear things.
2. Final compilation command:
Sudo make-kpkg -- initrd -- append-to-version =-custom kernel_image kernel_headers

Among them,-initrd must be required. append-to-version will generate multiple images, that is, the options will be displayed in the Start menu, and the following parameter is the image name. You can set it by yourself, it must end with a number. Finally, the image package and the header package are generated. You can also use binaryreplacement to combine image.headers.doc. source, which is the most complete package.
Then there is an endless compilation process (from 30 minutes to 4 hours, depending on the hardware speed ). You can watch the screen to spend time or play basketball. Machines can listen to songs and watch movies online.

4. Install the kernel
After compilation, there will be two. Deb installation packages under/usr/src.
Dpkg-I linux-image-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
Dpkg-I linux-headers-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb

Check/boot/GRUB/menu. List
Restart Detection
End

 

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.