Compile new kernel

Source: Internet
Author: User
Compile the new kernel-the Linux Release Technology-Debian information. See the following for details. Why do some people want to compile the new kernel? The default kernel of Debian already contains the vast majority of configurations, so it is not necessary to compile the new kernel. In addition, Debian provides multiple kernels for selection. Therefore, check whether the kernel image package suitable for your hardware exists. However, it is useful to compile the new kernel for the following reasons:
  • Supports some special hardware, or the default Kernel configuration conflicts with some hardware.
  • Use certain options that are not supported by the provided kernel (for example, support for high memory)
  • Optimize the kernel by deleting useless drivers to reduce startup time
  • Create an overall kernel instead of a modular Kernel
  • Run the latest kernel or the kernel in development
  • Learn more about linux Kernel


8.6.1. kernel image management


Don't be afraid to try to compile the kernel. It is interesting and cost-effective.
To compile the kernel In Debian mode, you need some software packages: fakeroot, kernel-package, linux-source-2.6 and other software packages that may have been installed (For a complete list, see/usr/share/doc/kernel-package/README.gz ).
This method will create a. deb file from your kernel source code, and if you have non-standard modules, they will also create their synchronization dependency. deb file. This is a good way to manage the kernel. The/boot directory will save the logs of the kernel, System. map, and the currently compiled Active configuration files.
Note that you may not YesCompile the kernel in "Debian mode", but we find that using a software package system to manage your kernel is indeed safer and easier to use. In fact, you can get the kernel source code directly from Linus, instead of the linux-source-2.6, and still use the kernel-package compilation method.
Note that you can find the complete document and use kernel-package in/usr/share/doc/kernel-package. This section only contains a simple Getting Started Guide.
After that, we assume that you have the right to operate your machine. You can extract the kernel source code to your home directory [22]. We also assume that your kernel version is 2.6.26. Make sure you are in the directory where you want to unbind the kernel source code and then use Tar xjf/usr/src/linux-source-2.6.26.tar.bz2Decompress and enter the directory just created by the linux-source-2.6.26.
Now, you can start to configure your kernel. If you have installed and configured and are running X11, run Make xconfigOtherwise, execute Make menuconfig(The libncurses5-dev must have been installed ). Please take some time to read online help and make careful choices. If you have any questions, it is usually better to include the uncertain Device Drivers (software used to manage hardware peripherals, such as Ethernet cards and SCSI controllers. Note: If you do not know other options that are not related to special hardware, it is best to keep the default value. Do not forget to select "Loadable module support" in "Kernel module loader" (they are not selected by default ). Otherwise, your Debian installation will encounter problems.
Clear the source code tree and restore the kernel-package parameter. That is, use Make-kpkg clean.
Now, compile the kernel: Fakeroot make-kpkg -- initrd -- revision = custom.1.0 kernel_image. The version "1.0" can be modified as needed; it is only used to track the version of your kernel compilation. Similarly, you can replace "custom" with any words you like (for example, host name ). It may take a long time to compile the kernel, depending on the performance of your machine.
Once the compilation is complete, you can install the customized kernel just like installing other software packages. Run the following command as root: Dpkg-I ../The linux-image-2.6.26-Subarchitecture_ Custom.1.0 _ amd64.deb. Where SubarchitectureThis part is an optional sub-structure, depending on the kernel options you have set. Dpkg-IThe kernel and other supporting files will be installed. For example, System. map may be installed to assist with kernel debugging, And/boot/config-2.6.26 will also be installed to include your current configuration. The new kernel package automatically updates the boot loader on the system and allows it to use the new kernel. If you have created a module package, you must also install it.
The following is the time to restart the system. Please carefully read all the warning information generated by the above steps, and then execute Shutdown-r now.
For more information about the Debian Kernel and the compiled Kernel, see Debian Linux Kernel Handbook. For more information about the kernel-package, see/usr/share/doc/kernel-package.


[22] You can unbind the kernel source code from other directories and compile the custom kernel, but no additional permissions are required.
Related Article

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.