Ubuntu10.04 kernel Compilation

Source: Internet
Author: User

Http://blog.csdn.net/gavin_dinggengjia/article/details/6334556

1. Download the source code

Uname-a check that the kernel version is Linux Ubuntu 2.6.32-24-generic. If you only want to compile the existing version of the kernel, you can download 2.6.32. If you want to upgrade the kernel version, you can download the updated version.
The official website of the linuxlinuxsource code is www.kernel.org. Download The 2.6.321_kernel code (linux-2.6.32.tar.bz2) and download the directory, for example,/home/gengjia/download.

 

2. Extract

CD/home/gengjia/download (locate the downloaded directory)
Tar zxvf linux-2.6.32.tar.bz2 (decompress to generate a linux-2.6.32-29 directory)

CP linux-2.6.32-29/usr/src/linux-2.6.32-29 (copy the Kernel File directory to the system kernel path/usr/src /)

 

3. Use the. config file of the original kernel version
CP/usr/src/linux-2.6.32-24-generic/. config usr/src/linux-2.6.32-29 (the first step of the original kernel version has been viewed)

 

4. configuration, compilation, and installation
CD/usr/src/linux-2.6.32-29

Sudo SU (switch to root permission)

Make mrproper! Otherwise it will take too much time to re-compile the kernel .)

Make menuconfig

The last two items in the main menu of kernel options:

Load a Kernel configuration...
Save a Kernel configuration...
Select the first item load..., which means that you can use the current Kernel configuration detail sheet to set the kernel to be compiled, save the item, and exit the configuration interface.

Make

Make modules_install

Make install

 

5. Generate initrd

Update-initramfs-K 2.6.32-29-C

NOTE: If mkinitramfs is used, the following error will be reported after restart:

Fatal: cocould not load/lib/modules/.../modules. Dep

 

6. Update the grub Startup Menu
Update-grub

 

You can also modify the Startup File by yourself.

Vim/boot/GRUB/grub. cfg
Add my grub. cfg as follows:
Menuentry '(QOS) Ubuntu, Linux 2.6.32-29' -- class Ubuntu -- class GNU-Linux -- class GNU -- class OS {
Recordfail
Insmod ext2
Set root = '(hd1, 9 )'
Search -- no-floppy -- FS-UUID -- set 501d3a42-1d52-4438-99bf-e679da605867
Linux/vmlinuz-2.6.32-29 root = UUID = 33883099-83a5-49f3-9c12-ee6a4d90da9e Ro quiet splash
Initrd/initrd. img-2.6.32-29
}
# The following are the boot items of the original 2.6.32 kernel.
Menuentry 'ubuntu, Linux 2.6.32-24-generic '-- class Ubuntu -- class GNU-Linux -- class GNU -- class OS {
Recordfail
Insmod ext2
Set root = '(hd1, 9 )'
Search -- no-floppy -- FS-UUID -- set 501d3a42-1d52-4438-99bf-e679da605867
Linux/vmlinuz-2.6.32-24-generic root = UUID = 33883099-83a5-49f3-9c12-ee6a4d90da9e Ro quiet splash
Initrd/initrd. img-2.6.32-24-generic
}

 

At this point, the kernel compilation is complete. Restart the machine to see if there is a new startup Item. It takes patience to compile the kernel. During the first compilation, various errors may occur, but don't be discouraged. It will certainly succeed!

Share:
  • Previous Article: Ubuntu install problem the configuration defaults for gnome power manager have not been installed correctly, please contact your
  • Next article: modifying the Linux kernel causes network unavailability
  • Http://blog.csdn.net/gavin_dinggengjia/article/details/6334556

    1. Download the source code

    Uname-a check that the kernel version is Linux Ubuntu 2.6.32-24-generic. If you only want to compile the existing version of the kernel, you can download 2.6.32. If you want to upgrade the kernel version, you can download the updated version.
    The official website of the linuxlinuxsource code is www.kernel.org. Download The 2.6.321_kernel code (linux-2.6.32.tar.bz2) and download the directory, for example,/home/gengjia/download.

     

    2. Extract

    CD/home/gengjia/download (locate the downloaded directory)
    Tar zxvf linux-2.6.32.tar.bz2 (decompress to generate a linux-2.6.32-29 directory)

    CP linux-2.6.32-29/usr/src/linux-2.6.32-29 (copy the Kernel File directory to the system kernel path/usr/src /)

     

    3. Use the. config file of the original kernel version
    CP/usr/src/linux-2.6.32-24-generic/. config usr/src/linux-2.6.32-29 (the first step of the original kernel version has been viewed)

     

    4. configuration, compilation, and installation
    CD/usr/src/linux-2.6.32-29

    Sudo SU (switch to root permission)

    Make mrproper! Otherwise it will take too much time to re-compile the kernel .)

    Make menuconfig

    The last two items in the main menu of kernel options:

    Load a Kernel configuration...
    Save a Kernel configuration...
    Select the first item load..., which means that you can use the current Kernel configuration detail sheet to set the kernel to be compiled, save the item, and exit the configuration interface.

    Make

    Make modules_install

    Make install

     

    5. Generate initrd

    Update-initramfs-K 2.6.32-29-C

    NOTE: If mkinitramfs is used, the following error will be reported after restart:

    Fatal: cocould not load/lib/modules/.../modules. Dep

     

    6. Update the grub Startup Menu
    Update-grub

     

    You can also modify the Startup File by yourself.

    Vim/boot/GRUB/grub. cfg
    Add my grub. cfg as follows:
    Menuentry '(QOS) Ubuntu, Linux 2.6.32-29' -- class Ubuntu -- class GNU-Linux -- class GNU -- class OS {
    Recordfail
    Insmod ext2
    Set root = '(hd1, 9 )'
    Search -- no-floppy -- FS-UUID -- set 501d3a42-1d52-4438-99bf-e679da605867
    Linux/vmlinuz-2.6.32-29 root = UUID = 33883099-83a5-49f3-9c12-ee6a4d90da9e Ro quiet splash
    Initrd/initrd. img-2.6.32-29
    }
    # The following are the boot items of the original 2.6.32 kernel.
    Menuentry 'ubuntu, Linux 2.6.32-24-generic '-- class Ubuntu -- class GNU-Linux -- class GNU -- class OS {
    Recordfail
    Insmod ext2
    Set root = '(hd1, 9 )'
    Search -- no-floppy -- FS-UUID -- set 501d3a42-1d52-4438-99bf-e679da605867
    Linux/vmlinuz-2.6.32-24-generic root = UUID = 33883099-83a5-49f3-9c12-ee6a4d90da9e Ro quiet splash
    Initrd/initrd. img-2.6.32-24-generic
    }

     

    At this point, the kernel compilation is complete. Restart the machine to see if there is a new startup Item. It takes patience to compile the kernel. During the first compilation, various errors may occur, but don't be discouraged. It will certainly succeed!

    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.