Linux Kernel compilation and configuration process

Source: Internet
Author: User

During the past two days, I had to re-compile the kernel. Now we can record the process of compiling and configuring the kernel.

Operating System: Ubuntu 10.04

Steps:

1. download the required kernel package and decompress it to/usr/src;

2 CD to the kernel source code root directory, run make mrproper to clear the last compiled result file and configuration file;[Optional]

3. Go to the kernel source code root directory and run make oldconfig to generate the kernel based on common configurations;
-There are other options, such as defconfig, which is the default configuration.

4. Run make menuconfig (ncurses software package is required). This is the kernel configuration in menu mode. You can choose to compile built-in (set *) or the kernel module (set to m );
-Other menu configurations, such as xconfig

5. Confirm the dependency make Dep;[Optional]

6. Compile the kernel image file and make bzimage. This step takes about 0.5 ~ 1 hour;

7. Compile the kernel module. The component previously selected as the kernel module is now compiled and run make modules;

8. Install the kernel module and run make modules_install. In this step, put the compiled kernel module under/lib/modules/kernel version/to load the corresponding kernel module after the new kernel is started;

9 create the kernel image file to be loaded, this step is to put the compiled kernel under the/boot directory, execute mkinitramfs-O/boot/initrd-linux2.6.XX.img 2.6.xx;

10. Install the kernel and run make install to copy all kernel-related files to/boot;

11. In the last step, configure grub to boot the system from the new kernel. In general, this step varies by system. In ubuntu10.04, You need to modify/boot/GRUB/grub. CFG (the previous version was to modify menu. LST). The syntax rules are easy to understand.
-You must note that the system may still need to put two soft links vmlinuz and initrd under the root directory (I .e. IMG can be modified to the corresponding new kernel image file under/boot.

 

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.