Compile Linux kernel 2.6.36-rc4 in Ubuntu

Source: Internet
Author: User
In fact, I don't understand anything, because the senior brother told me to compile the kernel first for a small task, So Baidu Google made a bunch of articles to compile the kernel, then we started to patch and compile the Linux kernel for the first time in our life. First, declare the command used below. If you are not logged on as a root user, add sudo1. to download the latest Linux kernel source code http://www.kernel.org/, and I decompress 2.6.36-rc44242.to remove tar-jxvflinu from usr/src.

In fact, I don't understand anything, because the senior brother told me to compile the kernel first for a small task, So Baidu Google made a bunch of articles to compile the kernel, then we started to patch and compile the Linux kernel for the first time in our life.

First, declare the command used below. If you do not log on as the root user, add sudo

1. download the latest Linux kernel source code at http://www.kernel.org/and I will download 2.6.36-rc4.

2. decompress the package to/usr/src.

Tar-jxvf linux-2.6.36-rc4.tar.bz2

To facilitate subsequent operations, change the name of the decompressed folder to linux-kernel.

Music linux-2.6.36-rc4 linux-kernel

3. Install the required software package:

Apt-get install kernel-package libncurses5-dev fakeroot build-essential

4. Configure the kernel

Cd linux-kernel

Make menuconfig

A configuration page is displayed.

Note that there are two items at the end of the main menu: load a kernel configuration...

Save a kernel configuration...

First select the first load..., which means that you can use the current Kernel configuration details to set the kernel to be compiled, then select save to save, and finally exit the configuration interface.

5. patch the kernel source code (optional)

(My patch was changed by my senior guy, so there were some problems. You can skip this part directly, and someone else put the patch before configuring the kernel, I don't know whether the two are ordered)

Cd/usr/src/linux-kernel

Patch-p1 <../cpufreq_stat.patch (or patch-p1-I ../cpufreq_stat.patch)

However, I installed a patch with an error, a message similar to "Hunk #3 FAILED at 2387. This means that the patch cannot be correctly installed and the patch program cannot be passed through in a fuzzy manner. This will generate a. rej file that causes patch failure and generate a. orig file to display some unmodifiable raw content to you.

I don't know if this is the cause. This is the case with the old brother's patch. He modified the cpufreq_stats.c of 2.6.32 and then generated a patch, but my version is the kernel of 2.6.36. I don't know if this is the reason. Later, I used the meld tool to compare the cpufreq_stats.c and 2.6.36 cpufreq_stats.c files modified by brother 2.6.32, and found that apart from the elder brother's modification section, the others will check for a header file, so the line is added and the cpufreq_stats.c is replaced directly.

6. Compile

Run: sudo make mrproper (clear the old files that have been compiled before. If this is the first compilation, do not execute it)

Execute: sudo make (compile, you can add-j4, if your CPU is dual-core, enough, because it can increase the speed)

(An error occurred during compilation, saying that the macro cputime64_add should have two parameters, but only one is actually given. It turns out that the comma between the two parameters is incorrectly written as a plus sign. After modification, re-compile)

(Compilation is in progress .. Very slow .. I don't know how the result is. It's not finished yet)

[Then: sudo make install

Sudo make modules (compilation module)

Sudo make modules_install (installation module)

Finally, create the initrd file:

Mkinitramfs-o/boot/initrd. img-2.6.36]

Related Article

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.