Install the complete linux kernel source code tutorial on linux hair styles such as Debian and Ubuntu

Source: Internet
Author: User

I need to download and install the full tree kernel source code for my Debian or Ubuntu for compiling a customized kernel. So what are the feasible methods to download the complete kernel source code on Debian or Ubuntu?

Before installing the complete kernel source code for your Linux system, you must first ask if you really need to do so. If you just try to compile a kernel module or customize the driver for the kernel, you do not need the complete kernel source code tree. You only need to install some header files corresponding to the kernel. This is enough.

 

 

You need a complete kernel source code tree only when you need to generate a customized kernel and some default kernel settings in the kernel source code need to be adjusted.

Here we will explain how to download and install the full tree kernel source code in the Debian or Ubuntu Library. You can.

Install the complete kernel source code on Debian

Before downloading the kernel source code, install dpkg-dev, which contains the development tool suite you need to generate the source code on Debian. In addition, dpkg-dev is also included in the dpgk-source tool used to decompress the Debian source code package and automatically patch it.

$ Sudo apt-get install dpkg-dev

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

$ Apt-get source linux-image-$ (uname-r)

_Xxxx.dsc. These files will be downloaded and stored in the current directory. The. dsc file shows how to patch the kernel source code.

After the download is complete, the above Command will automatically call the tool dpkg-source to decompress the downloaded kernel source code to the current directory, and patch it according to the. dsc file.

The final complete kernel source tree will be displayed in the current directory in the form of a "linux-X.X.XX.

 

 

Install the complete kernel source code on Ubuntu

If you want to install the complete kernel source code, the above practices on Debian still work on Ubuntu.

There is another way to install the complete kernel source code on Ubuntu. In fact, you can check the kernel source code tree maintained by Canonical for different Ubuntu distributions.

$ Sudo apt-get install git

$ 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 view the code in the Git "ubuntu-trusty" repository.

 

 

Once your query of the Git repository is complete, run the following command to install an important development kit to access the dependencies required to generate the kernel source code tree.

$ Sudo apt-get build-dep linux-image-$ (uname-r)

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.