Ubuntu 10.04 compile and install the latest Linux-2.6.34 Kernel

Source: Internet
Author: User

Step 1: Prepare

Open the terminal and obtain the root permission: sudo Su
Then install the tool required for Kernel Compilation:

Apt-Get install build-essential kernel-package libncurses5-dev libqt3-headers

Build-essential (basic programming library (GCC, make, etc)

Kernel-package (some configuration files and tools for generating kernel-image in the Debian system)
Libncurses5-dev (meke menuconfig the one to call)
Libqt3-headers (make xconfig to call)
Install other tools as prompted during upgrade

Step 2: Download the kernelSource codeLinux-2.6.34.tar.gz
Go to www.kernel.org to download the latest linux-2.6.34.tar.gz kernel.
Assume that the file is downloaded to the root directory, and then decompress it to the/usr/src/linux-2.6.34 directory.
CD/usr/src
Tar zxvf/root/linux-2.6.34.tar.gz
After decompression, a new folder linux-2.6.34 is generated in/usr/src

Step 3: Configure
Copy the Kernel configuration file in use/usr/src/linux-headers-2.6.32-22-generic/. config to the/usr/src/linux-2.6.34 directory
CP/usr/src/linux-headers-2.6.32-22-generic/. config/usr/src/linux-2.6.34
Run:
CD/usr/src/linux-2.6.34
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...
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.

Step 4: Compile and install the new kernel
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)
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.34

Step 5: update the grub boot list.
sudo gedit/boot/GRUB/grub. CFG
my grub. add the following to CFG:
menuentry 'ubuntu 10.04, linux 2.6.34 '-- 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.34 root = UUID = Ro quiet splash
initrd/initrd. img-2.6.34
}< BR ># The following is the original 2.6.32 kernel boot item
menuentry 'ubuntu, linux 2.6.32-22-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-22-generic root = UUID = Ro quiet splash
initrd/initrd. img-2.6.32-22-generic
}

So far, the entire kernel compilation is complete.

However, when you restart the system, although the startup Item 2.6.34 of the new kernel is added to the boot menu, the startup may fail and the following prompt appears:

Warning: Can't open directory/lib/modules/2.6.34/modules. Dep, no such files or directory

At this time, we should not be discouraged. Playing Linux requires courage and perseverance to eat crabs. Haha. Calm down, choose to start and log on to the system from the old kernel, and then run the following command (to avoid input errors, you 'd better copy the following command). After modification, the new kernel can be started successfully.

######################################
Sudo SU (ensure that the root permission is obtained; otherwise, the system prompts that the permission is insufficient and the task cannot be completed successfully)
CD/boot
CP initrd. img-2.6.34 initrd-2.6.34.old (make a backup just in case, haha)
Depmod-
Update-initramfs-K 2.6.34-C
CD/tmp
Gzip-DC/boot/initrd. img-2.6.34 | cpio-ID
Touch lib/modules/2.6.34/modules. Dep
Find./| cpio-h newc-o>/boot/initrd. img-2.6.34.new
Gzip/boot/initrd. img-2.6.34.new
CD/boot
MV initrd.img-2.6.34.new.gz initrd. img-2.6.34

######################################

After completing the preceding operations, restart the system and select a new kernel to start. A small English window will pop up. Select grub update grub ....... (because you can't remember it, you can't remember it.) This item updates grub, and then selects the top one, as if it was resum. Do you know if I remember correctly? haha, please be careful. After the installation is complete, restart the computer and the GRUB menu will be updated to many boot items, just like when ub10.04 is installed, but you can log on to the system and then modify/boot/GRUB/grub. CFG to simplify it. The compilation and installation work has been completed successfully. Thank you for your support!

(Original address:
Http://www.linuxidc.com/Linux/2010-05/26263.htm)

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.