Upgrade and compile your own kernel-Debian

Source: Internet
Author: User
Upgrade and compile your own kernel-Debian-general Linux technology-Linux programming and kernel information. For more information, see the following section. First, we need to introduce that kernel compilation in other operating systems is usually cumbersome. However, due to Debian's powerful dpkg package management system, kernel upgrades and compilation become much easier. This article will teach you how to compile your own Linux 2.6 kernel with grsecurity step by step. Grsecurity is a Linux kernel patch that patches and enhances security for some Linux kernel security vulnerabilities.


First, use apg-get to automatically download and install some necessary software packages, including the kernel-package and ncurses-dev required for compiling the kernel. If an error occurs during kernel compilation and production, indicating that a software package does not exist, use the apt-get install command to download and install the package.

Apt-get install kernel-package ncurses-dev fakeroot wget bzip2 make patch

Cd/usr/src
Wget http://www.kernel.org/pub/linux/... ux-2.6.11.7.tar.bz2
Tar-xjf linux-2.611.7.tar.bz2

Go to the http://www.kernel.org to view the latest kernel version.

Then download grsecurity. Note that you must select the grsecurity version corresponding to the kernel version. (Grsecurity website)

Wget http://www.grsecurity.org/grsecu... 0504111924.patch.gz
Gunzip grsecurity-2.1.5-2.6.11.7-200504111924.patch.gz

Run the following command to patch the new kernel with grsecurity

Patch-p0 <./grsecurity-2.1.5-2.6.11.7-200504111924.patch

OK. Switch to the directory of the new kernel.

Cd linux-2.6.11.7

To save time, run the following command to obtain the configuration from the existing kernel:

Make oldconfig

After executing this command, you will be asked some questions based on the differences between the new and old kernels. If you are not sure, use the default value (Press enter directly ).

After completing the preceding steps, run the Kernel configuration program.

Make menuconfig

If your Debian has X, you can also use make xconfig to configure the kernel. Please configure it according to the actual situation. If you are not sure, keep the default value.

In Security Options, select Grsecurity and set it to medium. Then, according to grsecurity's official recommendation, set MAC system integration to [None] in Security Options> PaX Control.

Now, the Kernel configuration is complete. Press ESC multiple times to exit the Kernel configuration page (Select yes when the system asks whether to save the new Kernel configuration ).

Run the following command to generate a new kernel!

Make-kpkg clean
Fakeroot make-kpkg -- initrd -- append-to-version = noobu -- revision = 1.0 kernel_image

Fakeroot is used to temporarily obtain the root permission during kernel generation. If you directly use the root account, you can omit fakeroot .? Append-to-version defines the kernel package name, similar to the kernel-image-2.6.11.7-noobu. And? Revision defines the version of the software package.

Now the system starts to generate a new kernel, and a lot of text will flash on the screen. Note: if an error occurs during the generation process, run make clean and use make menuconfig to reconfigure the kernel. Generally, you need to carefully read the error information, find the error module, and then remove it.

After the kernel is successfully generated, a deb package is generated under the/usr/src directory. Example kernel-image-2.6.11.7-noobu_1.0_i386.deb

Run the following command to install the new kernel!

Dpkg-I kernel-image-2.6.11.7-noobu_1.0_i386.deb

Then Debian will install the new kernel and update the Grub configuration file. After you restart (shutdown-r now), the system will boot to the new kernel.

Run uname-a to check whether the name of the new kernel is displayed.

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.