Ubuntu compilation of Linux3.0-rc4 Kernel

Source: Internet
Author: User
After a long Linux kernel version of 2.6, the main version is + 1. Now the 3.0RC4 version has been released. Recently, it was reported that 3.0 is faster than 2.6.39, if you don't mind being a mouse, try to download the source code of LinuxKernel3.0 and compile it by yourself. The following describes how to compile LinuxKernel3.0RC4 in Ubuntu10.10. Because the kernel compilation process is similar

After a long Linux kernel version of 2.6, the main version + 1 has finally been released. Now, version 3.0 RC4 has been released. Recently, it was reported that version 3.0 is faster than version 2.6.39, if you don't mind being a mouse, try to download the Linux Kernel 3.0 source code and compile it yourself.

The following describes how to compile Linux Kernel 10.10 RC4 in Ubuntu 3.0. Because the kernel compilation process is similar, the following process is also applicable to other releases (for example, the Red Hat system's Fedora 15. Below I will also note the similarities and differences of using Fedora 15 for compilation ), because 3.0 is not an official version, you may not be able to start the computer using the new kernel compiled by yourself, so you need to keep the current kernel.

1. Download and decompress the Linux Kernel 3.0 RC4 source code
To the official http://kernel.org/download, get the linux-3.0-rc4.tar.bz2 file, move it to any folder you have the permission to read and write, run the following command to decompress and enter the decompressed Folder:
$ Tar-jxvf linux-3.0-rc4.tar.bz2
$ Linux-3.0-rc4 cd

2. Configure kernel compilation Parameters
First install the ncurses tool, which is dependent on the character edition Configuration tool:
$ Apt-get install libncurses5 libncurses5-dev # (Ubuntu environment)
$ Sudo yum install ncurses-devel # (Fedora environment)

Because the new version of the Configuration tool will automatically find the configuration information of the current system environment (that is, the file starting with config-XXX in/boot), you can run the character version of the Configuration tool directly:
$ Make menuconfig

There are many configuration options here. If you are trying, you don't have to worry about it. Select "Save" under the menu and exit. The configuration tool will generate a ". config file.

3. Start Compilation
$ Make

The compilation process ranges from 10 minutes to 1 or 2 hours, depending on the speed at which your computer runs. If the CPU is 4-core, you can add the "-j4" parameter after the make command to make the compilation program use 4-core compilation at the same time, so that the compilation time can be reduced by times.

If the compilation process is accidentally interrupted and you want to re-compile, You need to execute the following command to clear the compilation site and then compile it:
$ Make mrproper

(This is a long wait process)

4. Install the compiled modules and Kernel
After the kernel is compiled, run the following command to install modules:
$ Sudo make modules_install

The preceding Command copies the compiled modules to the "/lib/modules/3.0.0-rc4" folder, where "3.0.0-rc4" is the kernel version, you will see the modules of other kernel versions in the "/lib/modules" folder, including the current system environment. Do not manually delete these folders.

Then install the compiled kernel image file:
$ Sudo make install

The above Command copies the "arch/x86/boot/bzImage" file in the compilation folder to "/boot", and also copies config and System. the map file will eventually contain the following three files in "/boot:
/Boot/config-3.0.0-rc4
/Boot/System. map-3.0.0-rc4
/Boot/vmlinuz-3.0.0-rc4

Is an initrd. img file missing (initial ram disk file )? Run the following command to create one:
$ Sudo mkinitramfs 3.0.0-rc4-o/boot/initrd. img-3.0.0-rc4 # (Ubuntu environment)
$ Sudo mkinitrd initramfs-3.0.0-rc4.img 3.0.0-rc4 # (Fedora environment)

5. Modify the GRUB boot menu and add a project to start with the new kernel.
You can use the automatic generation tool of GRUB2 to complete this step.
$ Sudo update-grub2 # (Ubuntu environment)
$ Sudo grub2-mkconfig # (Fedora environment)

If you do not want to modify the GRUB boot menu (not sure about the new kernel), you can manually specify the new kernel when starting Linux as follows:
Restart the computer, Press ESC on the GRUB menu interface (if you do not see it, then restart the computer), press "c" to enter the command mode, and set the partition of the Startup File first, suppose "/boot" is in the first partition of the first hard disk. If it is in another partition, change the number "1" below to "2, 3, 5, 6, 7 ......" And so on:
Set root = (hd0, 1)

Specify the kernel image and virtual ram disk file location:
Linux/boot/vmlinuz-3.0.0-rc4 root =/dev/sda1
Initrd/boot/initrd. img-3.0.0-rc4

Note: In GRUB command mode, you can press the "TAB" key to automatically complete the task. Do not enter one word or more. Finally, enter "boot" to start. The following is a "system monitor" using the 3.0 kernel ":

As to whether the speed is faster than 2.6.x, it may be, but it is a bit difficult to detect.

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.