Reprint: Linux has a question: How to install the complete kernel source on Debian or Ubuntu

Source: Internet
Author: User

Http://linux.cn/article-5015-1.html

question : I need to download and install the full tree-structured kernel source for my Debian or Ubuntu to compile a custom kernel. So what are the possible ways to download the full kernel source on Debian or Ubuntu?

Before you install the complete kernel source for your Linux, ask yourself if you really need to do this. If you are simply trying to compile a kernel module or customize the driver for the kernel, you do not need the full kernel source tree. You just need to install some header files corresponding to the kernel, which is enough.

Only if you need to build a custom kernel, and kernel source code in some of the kernel default settings to be adjusted by you, you need the full kernel source tree.

This will answer how to download and install the full tree-structured kernel source in a Debian or Ubuntu library . You can download the official kernel source code in https://www.kernel.org/pub/linux/kernel/, but using the distribution software repository allows you to download the kernel source with patches.

Install the complete kernel source on Debian

Before downloading the kernel source code, install Dpkg-dev, which contains the kit of development tools you need to build the source on Debian. Not only that, Dpkg-dev is also included in the tool Dpgk-source for extracting Debian source packages and patching them automatically.

    1. $ sudo apt-get install dpkg-dev

Then, run the following command to download the full kernel source code.

    1. $ apt-get source Linux-image-$(uname -R)

There are also kernel patches (LINUX_X.X.X+XXX.DEBIAN.TAR.XZ) and source control files (linux_) that accompany the full kernel source (LINUX_X.X.XX.ORIG.TAR.XZ) XXXX.DSC), these will be downloaded and stored in the current directory. The. DSC file will indicate how to patch the kernel source code.

When the download is complete, the above command will automatically invoke the tool Dpkg-source to extract the downloaded kernel source into the current directory, while the patch is under the. dsc file.

The final complete kernel source tree will be presented as "linux-x.x.xx" in the current directory.

Install the full kernel source on Ubuntu

If you want to install the full kernel source, the above on the Debian set of practices on Ubuntu still works.

There is another way to install the full kernel source on Ubuntu. In fact, you can check the kernel source tree maintained by canonical for different editions of Ubuntu.

    1. $ sudo apt-get install git
    2. $ git clone git://kernel.ubuntu.com/ubuntu/ubuntu-$ (lsb_release--codename | cut-f2 ). Git

For example, if you are using Ubuntu 14.04, the above command will look at the code in Git's "Ubuntu-trusty" repository.

Once you have finished querying your git repository, use the following command to install the important development packages that you need to rely on to generate the kernel source tree.

    1. $ sudo apt-get build-DEP linux-image-$(uname -R )

Via:http://ask.xmodulo.com/install-full-kernel-source-debian-ubuntu.html

Reprint: Linux has a question: How to install the complete kernel source on Debian or Ubuntu

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.