KernelBuildpackageHowto

简介:
ntro 
介绍 
This page tells how to rebuild the Ubuntu Linux kernel package. This is the most straightforward way of compiling your own Ubuntu kernel, but it's also rather heavyweight. If you plan on doing any kernel developing or debugging, you'd probably be happier following the KernelByHandHowto. It's a bit more involved, but a lot more flexible. 
本页谈论如何重建Ubuntu Linux内核包。这是自己编译Ubuntu内核最直接的方法,但它也是相当重量级的方法。如果你打算做一些内核开发或调试的话,你也许会更高兴地按照本指南来做。它更复杂一点但也更灵活。 
Setup 
安装 
We will build everything in the "linux" directory (or whatever you want to call it) in your home directory. The steps that must be run as root are prefixed by "sudo". 
我们将在你用户目录中构建“Linux”目录下的任何东西(或是你想调用的)。下面的步骤必须做为根用户(通过前面用"sudo")来运行。 
$ sudo apt-get build-dep linux-source-2.6.8.1 
$ mkdir ~/linux 
$ cd ~/linux 
$ apt-get source linux-source-2.6.8.1 
$ cd linux-source-2.6.8.1-2.6.8.1 
Note that this technique can take a lot of disk space, especially if you don't disable any flavours (see below). My tree, with all flavours enabled, takes up 1.6 GB. It might take even more disk space during the compile. 
注意:这种方式需要很大的磁盘空间,尤其是在你想要一些特色时(看下面)。My tree在实现全部特色时,需要1.6G。它可能在编译期间甚至需要更多的磁盘空间。 
Configure 
配置 
At this point, you may want to change your kernel's configuration. Modify the appropriate file in debian/config/ARCH/ (i.e., if my current kernel is named "linux-image-2.6.8.1-3-686", I would edit debian/config/i386/686). 
到这一步,你也许想改变你的内核配置。在debian/config/ARCH/(比如我当前的内核是“linux-image-2.6.8.1-3-686”,那么我将编辑debian/config/i386/686)目录中修改相应的文件。 
You will probably also want to delete the other configurations that you don't care about. Or, at least, move them into another directory. Otherwise, you'll build every flavour from scratch -- a very time consuming process. The following example disables every flavour except for 686. 
你可能也想删除其它那些你不关心的配置。或者至少将它们移到另一个目录中。否则,你将从头构建每一个--这是一个非常耗时的过程。下面的示例就是就是除了686之外,不构建任何特色。 
$ cd debian/config/i386 
$ mkdir disabled 
$ mv * disabled 
$ mv disabled/686 . 
Build 
构建 
Now that the source is installed and configured, build it. If you didn't limit the flavours above, this could take a very long time (about 7 hours on my 1 GHz? laptop). 
现在源已经被安装和配置好了,构建它。如果你不对上述特色进行限制的话,它需要花费相当长的时间(在我的1Ghz的本本上花了大约七小时)。 
-B says to only create the architecture-dependent binary files, and -uc and -us say that the files shouldn't be cryptographically signed. -rfakeroot allow you to do everything as a regular (non-root) user. 
-B 是说只构建依赖结构的两进制文件,-uc和-us 是指这些文件不能被加密,-rfakerroot 允许你作为一般(非根)用户去做任何事。 
$ cd ~/linux/linux-source-2.6.8.1-2.6.8.1 
$ dpkg-buildpackage -B -uc -us -rfakeroot 
Install 
安装 
Now install the brand new package. 
现在安装新的包 
$ cd ~/linux 
$ sudo dpkg -i linux/linux-image-2.6.8.1-3-686_2.6.8.1-16_i686.deb 
Build Link 
构建链接 
If you are going to build any out-of-tree 2.6 drivers, they will probably require links to the build environment from /lib/modules. You will need to set these up by hand. Of course, replace USER with your user name, or otherwise enure that you specify a full path to the linux directory you used to build the package. 
如果你打算构建一些额外的2.6驱动,它们可能要求从/lib/modues链接到构建环境里。你需要手动设置它们。当然用你的用户名重置USER,否则请确实指定你用来构建包的Linux目录的绝对路径。 
$ sudo ln -s /home/USER/linux/linux-source-2.6.8.1-2.6.8.1/debian/build/build-686 /lib/modules/2.6.8.1-3-686/build 
$ sudo ln -s /home/USER/linux/linux-source-2.6.8.1-2.6.8.1/debian/build/build-686 /lib/modules/2.6.8.1-3-686/source 
Bootloader 
启动引导 
You should set up your bootloader as recommended in the Bootloader section of the KernelCompileHowto. 
你将设置你的启动引导,就象KernelCompileHowto中启动引导那节所建议的那样。 
Reboot 
重启 
And reboot the computer! 
然后重启计算机 
Questions 
问题 
What about revisions numbers? When building with make-kpkg, you can use --revision=custom.xx to create your custom kernel revision. 
什么是修订版本号?当用make-kpkg构建时,你可以有--revision=custom.xx来创建你们自定义内核修订版本。 
How revisions are handled using this method? 
通过这种方式怎样处理修订版本? 
How to handle ABI changes? 
怎样处理ABI改变? 
--mukesh agrawal, Sat, 14 May 2005 19:28:29 +0100 
I tried building a kernel by following the above instructions. But the kernel had some ABI changes (I disabled the kernel's loop block device support, so that I could build loop-aes). The build system spit out the following error 
我尝试按上面的介绍来构建内核。但内核有一些ABI的改变(我使内核的环回块设备支持无效,以便我可以建构loop-aes)。构建系统显示下列错误: 
"ABI has changed! Refusing to continue; please update the ABINAME accordingly. Differences:" 
“ABI被改动!不能继续;请更新相应的ABINAME。不同之处:” 
but didn't give any hint on where/how to change the ABINAME. I tried what seemed like the most obvious thing (editing debian/abi/<kernel-version>/abiname), but that edit seems to have been clobbered by the build system. 
但没有给出任何的关于在哪里和怎样改动ABINAME。我试了很多似乎是最明显的地方(编辑debian/abi/<kernel-version>/abiname),但编辑之事对编译系统无效。 
Editing .config --mukesh agrawal, Sat, 14 May 2005 19:34:19 +0100 
编辑.config --mukesh agrawal, Sat, 14 May 2005 19:34:19 +0100 
AFAIK, this build process doesn't let you run make config in the build tree. So is the recommended approach to run make config in your own tree, and then copy the .config file over? (Editing .config by hand seems like a bad idea.) 
就我所知,该处理过程并非让你在构建树中运行make config。而是建议在你自己的树中作近似处理,然后拷贝并覆盖.config文件?(手动编辑.config看上去并不是好的办法) 
Build Process --mukesh agrawal, Sat, 14 May 2005 19:36:40 +0100 
构建处理 --mukesh agrawal, Sat, 14 May 2005 19:36:40 +0100 
Seems like this build process always cleans out the tree before building. Could someone confirm, and add a note to this effect? Because the build time is so long for the Ubuntu .config, it is useful to know beforehand that you really need to get your source and .config the way you want them before building. The document currently hints at this, by saying the process is "heavyweight", but I think stating this explicitly would be useful. 

该构建过程总是在构建之前清理树的。有人能对该效果进行确认和添加记录吗?因为构建Ubuntu的.config文件的时间相当长,它对于你在构建前预先知道如何如你所愿地得到你的源和.config文件来说是十分有用的。本文档也提示了这一点,说该过程是“重量级的”,但我想明确地说明这一点也将是有帮助的。



本文转自 firehare 51CTO博客,原文链接:http://blog.51cto.com/firehare/588198,如需转载请自行联系原作者

相关文章
|
1月前
|
前端开发 JavaScript 搜索推荐
解密: SPA 与 MPA
单页面应用(SPA)是一种Web应用架构,其中所有的内容和功能都包含在单一的HTML页面中。这种应用在用户与界面交互时不会进行全页刷新,而是通过动态更新页面上的局部内容来提供流畅的用户体验。多页面应用(MPA)是一种传统的Web应用程序架构,它由多个页面组成,每个页面都是一个独立的文档,通常包含自己的一套JavaScript、CSS等资源。当用户在应用中导航时,浏览器会重新加载整个页面和相关的资源。
|
1月前
|
SQL 分布式计算 HIVE
ApacheHudi使用问题汇总(一)
ApacheHudi使用问题汇总(一)
11 0
|
7月前
|
人工智能 供应链
PPA322B HIEE300016R2 HIEE400235R1
PPA322B HIEE300016R2 HIEE400235R1
43 0
PPA322B HIEE300016R2 HIEE400235R1
|
XML 数据格式
PAT有几个pat
字符串APPAPT中包含了两个单词“PAT”,其中第一个PAT是第2位§,第4位(A),第6位(T);第二个PAT是第3位§,第4位(A),第6位(T)。 现给定字符串,问一共可以形成多少个PAT?
80 0
|
算法
PAT条条大路通罗马
Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.
92 0
|
Web App开发
XPathHelper使用
XPathHelper使用
106 0