From 7edb0d612567915d22a949e106ea02fc61c878da Mon Sep 17 00:00:00 2001 From: martin qi Date: Sat, 28 Feb 2015 21:35:12 +0800 Subject: [PATCH 1/3] Update and rename translated/tech to translated/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md --- ... full kernel source on Debian or Ubuntu.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 translated/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md diff --git a/translated/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md b/translated/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md new file mode 100644 index 0000000000..1296b0f975 --- /dev/null +++ b/translated/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md @@ -0,0 +1,58 @@ +Linux有问必答:如何在Debian或Ubuntu上安装完整的内核源码 +================================================================================ +> **问题**:我需要为我的Debian或Ubuntu下载并安装完整树结构的内核源码以供编译一个定制的内核。那么在Debian或Ubuntu上有什么可行的方法来下载完整的内核源码呢? + +在给你的Linux安装完整内核源码之前,先问问自己是否真的需要这样做。如果你仅仅是尝试去编译一个内核模块或是为内核定制驱动,你并不需要完整的内核源码树。你只需要安装[一些与内核对应的头文件][1],这样就足够了。 + +只有在你需要生成一个定制的内核,而且内核源码中的一些内核默认设置要被你调整了的情况下,你才需要完整的内核源码树。 + +这里将会解答如何**在Debian或Ubuntu的库中下载并安装完整树结构的内核源码**。虽然你可以在这个网站[https://www.kernel.org/pub/linux/kernel/][2]下载官方的内核源码,但是发行版软件仓库可以允许你下载包含补丁的内核源码。 + +### 在Debian上安装完整的内核源码 ### + +在下载内核源码之前,先安装dpkg-dev,其中包含你在Debian上生成源代码时需要的开发工具套件。不仅如此,dpkg-dev中还包含在用来解压Debian源码包并自动打补丁的工具dpgk-source。 + + $ sudo apt-get install dpkg-dev + +然后,运行以下命令下载完整的内核源码。 + + $ apt-get source linux-image-$(uname -r) + +伴随着完整内核源码(linux_X.X.XX.orig.tar.xz)的还有一些可用的内核补丁(linux_X.X.X+XXX.debian.tar.xz)和源码控制文件(linux_XXXX.dsc),这些都将被下载并存储到当前目录。在.dsc文件中会指出如何给内核源码打补丁。 + +当下载完成,以上的命令将会自动调用工具dpkg-source将下载的内核源码解压到当前的目录中,与此同时更具.dsc文件来下补丁。 + +最终完整的内核源码树将会以"linux-X.X.XX"的形式呈现在当前目录中。 + +![](https://farm9.staticflickr.com/8676/16341110300_b4f059eeb0_b.jpg) + +### 在Ubuntu上安装完整内核源码 ### + +如果你想安装完整内核源码的话,以上在Debian上的那一套做法在Ubuntu上仍然奏效。 + +在Ubuntu上还有另一套方法安装完整内核源码。事实上,你可以查一下由Canonical为Ubuntu不同发行版维护的内核源码树。 + + $ sudo apt-get install git + $ git clone git://kernel.ubuntu.com/ubuntu/ubuntu-$(lsb_release --codename | cut -f2).git + +举个例子,如果你使用的是Ubuntu14.04,以上的命令将会查看Git的"ubuntu-trusty"仓库中的代码。 + +![](https://farm9.staticflickr.com/8642/16526856391_de636ff9b8_c.jpg) + +一旦在你对Git仓库的查询结束后,使用以下的命令来安装用来访问生成内核源码树所需依赖的重要开发包。 + + $ sudo apt-get build-dep linux-image-$(uname -r) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-full-kernel-source-debian-ubuntu.html + +作者:[Dan Nanni][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://ask.xmodulo.com/install-kernel-headers-linux.html +[2]:https://www.kernel.org/pub/linux/kernel/ From d9246bbbdea839879993958ec5a8c55600cd026e Mon Sep 17 00:00:00 2001 From: martin qi Date: Sat, 28 Feb 2015 21:39:32 +0800 Subject: [PATCH 2/3] Delete 20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md --- ... full kernel source on Debian or Ubuntu.md | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 sources/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md diff --git a/sources/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md b/sources/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md deleted file mode 100644 index 65b3a08c48..0000000000 --- a/sources/tech/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md +++ /dev/null @@ -1,60 +0,0 @@ -translating by martin. - -Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu -================================================================================ -> **Question**: I need to download and install a full kernel source tree to compile a custom kernel for my Debian or Ubuntu system. What is a proper way to download full kernel source on Debian or Ubuntu? - -Before installing full kernel source on your Linux system, ask yourself whether you really need the full kernel source. If you are trying to compile a kernel module or a custom driver for your kernel, you do not need the full kernel source. You only need to install [matching kernel header files][1], and that's it. - -You need the full kernel source tree only if you want to build a custom kernel after modifying the kernel code in any way and/or tweaking default kernel options. - -Here is how to **download and install full kernel source tree from Debian or Ubuntu repositories**. While you can download the official kernel source code from [https://www.kernel.org/pub/linux/kernel/][2], using distro's repositories allows you to download a kernel source with the maintainer's patches applied to it. - -### Install Full Kernel Source on Debian ### - -Before downloading kernel source, install dpkg-dev, which contains a suite of development tools needed to build Debian source packages. Among other things, dpkg-dev contains dpgk-source tool which can extract a Debian source package and automatically apply patches. - - $ sudo apt-get install dpkg-dev - -Next, run the following command to download full kernel source. - - $ apt-get source linux-image-$(uname -r) - -Along with the full kernel source (linux_X.X.XX.orig.tar.xz), any available kernel patches (linux_X.X.X+XXX.debian.tar.xz) and source control file (linux_XXXX.dsc) will also be downloaded and stored in the current directory. The .dsc file instructs how the patches are applied to the kernel sources. - -Upon the completion of download, the above command will automatically invoke dpkg-source tool, which will unpack the downloaded kernel source in the current directory, and apply downloaded patches according to .dsc file. - -The final full kernel source tree will be available in the current directory as "linux-X.X.XX". - -![](https://farm9.staticflickr.com/8676/16341110300_b4f059eeb0_b.jpg) - -### Install Full Kernel Source on Ubuntu ### - -If you want to install full kernel source, the Debian way described above should work on Ubuntu as well. - -There is another way to download full kernel source on Ubuntu. You can actually check out the kernel source tree maintained by Canonical for different Ubuntu releases. - -$ 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 check out code from "ubuntu-trusty" Git repository. - -![](https://farm9.staticflickr.com/8642/16526856391_de636ff9b8_c.jpg) - -Once you check out the Git repository, use the following command to install necessary development packages to meet the build dependencies for the kernel source tree. - - $ sudo apt-get build-dep linux-image-$(uname -r) - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/install-full-kernel-source-debian-ubuntu.html - -作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://ask.xmodulo.com/author/nanni -[1]:http://ask.xmodulo.com/install-kernel-headers-linux.html -[2]:https://www.kernel.org/pub/linux/kernel/ From a606951d16fa23112efc8526df089a0041dd8f0c Mon Sep 17 00:00:00 2001 From: martin qi Date: Sat, 28 Feb 2015 21:42:39 +0800 Subject: [PATCH 3/3] translated