当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 7 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [wiki]内核编译指南
帖子发表于 : 2005-05-31 23:34 
论坛管理员

注册: 2005-03-27 0:06
帖子: 10116
系统: Ubuntu 12.04
送出感谢: 7
接收感谢: 128
Intro

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.

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".

$ 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.

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).

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.

$ 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).

-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.

$ 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.

$ 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.

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. How revisions are handled using this method?

How to handle ABI changes? --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 has changed! Refusing to continue; please update the ABINAME accordingly. Differences:"

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.

Editing .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.)

Build Process --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.


_________________
当净其意如虚空,远离妄想及诸取,令心所向皆无碍


最后由 oneleaf 编辑于 2005-06-07 15:19,总共编辑了 1 次

页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2005-06-01 20:33 
头像

注册: 2005-04-10 16:54
帖子: 2625
地址: 温州大学
送出感谢: 0 次
接收感谢: 1
Intro
介绍

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 编辑于 2005-06-02 19:44,总共编辑了 3 次

页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2005-06-02 11:10 

注册: 2005-05-07 23:57
帖子: 3025
送出感谢: 0 次
接收感谢: 0 次
厉害呢。firehare。好样的。


_________________
独自看一看大海
总想起身边走在路上的朋友
Lenovo E290-420[Celeron-M420/256M/60G/Intel GMA950]


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2005-06-02 12:05 
头像

注册: 2005-04-10 16:54
帖子: 2625
地址: 温州大学
送出感谢: 0 次
接收感谢: 1
yongyi 写道:
厉害呢。firehare。好样的。


没有呢!
主要是这次英语没考好,
一时冲动狂练!
等一个月后就难说了!
呵呵!!


_________________
我心无畏,源自于我心无知。
图片


页首
 用户资料  
 
5 楼 
 文章标题 :
帖子发表于 : 2005-06-07 15:18 
论坛管理员

注册: 2005-03-27 0:06
帖子: 10116
系统: Ubuntu 12.04
送出感谢: 7
接收感谢: 128
http://www.ubuntu.org.cn/docs/UserDocum ... ument_view


_________________
当净其意如虚空,远离妄想及诸取,令心所向皆无碍


页首
 用户资料  
 
6 楼 
 文章标题 : 我照着做了一下,发现错误!
帖子发表于 : 2005-12-30 17:01 

注册: 2005-12-07 10:32
帖子: 48
送出感谢: 0 次
接收感谢: 0 次
scripts/kconfig/mconf.c:91: 错误:对 ‘current_menu’ 的静态声明出现在非静态声明之后
scripts/kconfig/lkc.h:63: 错误:‘current_menu’ 的上一个声明在此
make[2]: *** [scripts/kconfig/mconf.o] 错误 1
make[1]: *** [defconfig] 错误 2
make[1]: Leaving directory `/usr/src/linux-source-2.6.8.1-2.6.8.1/debian/build/linux-source-2.6.8.1'
make: *** [build] 错误 2


页首
 用户资料  
 
7 楼 
 文章标题 :
帖子发表于 : 2006-07-29 18:51 
头像

注册: 2005-07-02 14:41
帖子: 4133
系统: Ubuntu 14.04 (Kylin)
送出感谢: 53
接收感谢: 11
http://wiki.ubuntu.org.cn/内核编译指南


_________________
https://weakish.github.io


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 7 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译