[Reprinted for backup] Linux kernel Compilation

Source: Internet
Author: User

[Reprint backup] source file address: http://www.kerneltravel.net /? P = 72

 

 

Step 1 install necessary tools

Install necessary packages first.
Includes: libncurses5-dev (required by menuconfig) and essential
Sudo apt-get install build-essential kernel-package
Sudo apt-get install make
Sudo apt-get install gcc
In addition, check whether the system has two such commands
Mkinitramfs mkisofs
These two tools are used to generate *. imgfile during kernel compilation. If not, install it.

Step 2 download the kernel

Download the new kernel to/usr/src at www.kernel.org.
What I download is linux-2.6.24.tar.gz (the original kernel is 2.6.20-15-generic)

Step 3 preparations before Compilation

View the current kernel version
Helight @ helight-desktop:/$ uname-

Linux helight-desktop 2.6.20-15-generic #1 SMP Mon Aug 25 17:32:09 UTC 2008 i686 GNU/Linux

Helight @ helight-desktop:/$

 

We recommend that you download a kernel higher than the current version.

Decompress linux-2.6.24.tar.gz to linux-2.6.24
Cd/usr/src

Sudo tar zxvf linux-2.6.24.tar

Cd linux-2.6.24/


Step 4 start Compilation

Cd/usr/src/linux-2.6.24 // all of the following work is done under/usr/src/linux-2.6.24
Sudo make menuconfig // Ncurses is required if menuconfig is used, or
Sudo make xconfig

Sudo make menuconfig // menuconfig is generally used

 

Save after configuration (A Kernel configuration file saved in the system is named. config under/usr/src/linux-2.6.24, you can save it elsewhere)
You can also cp the original config-2.6.xx in the/boot directory to the current directory, in make menuconfig is to use this configuration file.
Sudo make dep // maybe the system will prompt that make dep is unnecessary now, so I will not use the next 2.6.24 compilation.
Sudo make clean // clear the old data. This step is not required for the unzipped kernel source code.

Sudo make-j2 can be compiled in two threads, but I used make-j4 to find that nine make processes are working in the system. Therefore, this parameter may not work.
Sudo make bzImage // compile the kernel and save it to/usr/src/linux-2.6.24/arch/i386/boot/
Sudo make modules // compilation Module
Sudo make modules_install // installation Module
Sudo mkinitramfs-o/boot/initrd-2.6.24.img 2.6.24

At this time, you may be prompted to not find such a folder "/lib/firmware/2.6.24". You need to create such a folder manually.

Sudo mkdir/lib/firmware/2.6.24
Sudo make install // install the kernel

After the installation is complete, add the following files under/boot (use ls-l * 24 * to view the files)

Helight @ helight-desktop:/boot $ ls-l * 24 *

-Rw-r-1 root 85203 config-2.6.24

-Rw-r-1 root 85203 config-2.6.24.old

-Rw-r-1 root 37968871 initrd-2.6.24.img

-Rw-r-1 root 4014080 initrd. img-2.6.24

-Rw-r-1 root 932315 System. map-2.6.24

-Rw-r-1 root 932315 System. map-2.6.24.old

-Rw-r-1 root 1858864 vmlinuz-2.6.24

-Rw-r-1 root 1858864 vmlinuz-2.6.24.old

Helight @ helight-desktop:/boot $

Add a new startup Item to/boot/grub/menu. lst. For example, add the following text to my menu. lst:

Title Ubuntu, kernel 2.6.24

Root (hd0, 0)

Kernel/boot/vmlinuz-2.6.24root = UUID = d7e2cf74-ebf5-4c78-ac2c-9f85a9809eae ro

Initrd/boot/initrd-2.6.24.img


Restart.

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.