Account Links: Cart | Register | Log In

Skip to content

Red Hat Knowledgebase
Red Hat Knowledgebase Search
Article translations:
Currently Being Moderated

从哪里可以获取红帽企业Linux4的内核源代码的软件包

Article ID: 11846 - Created on: Jul 22, 2008 6:00 PM - Last Modified:  Oct 10, 2008 12:23 PM

下面的信息由红帽公司提供,但是超出了我们的服务协议书( https://www.redhat.com/support/service/sla/ ) 和支持流程。按照这个文章所做的操作,会导致你的任何配置,设置和已安装的应用得不到红帽支持服务的支持。这个文章的目的是提供为你完成自己系统的需要提供相关的信息。使用这个文章中的信息可能造成的问题由用户自己来承担。

 

与红帽企业Linux2.1和3不同,在红帽企业Linux4的发行版中没有提供kernel-source软件包。同时提供一个kernel-source软件包和一个kernel.src.rpm包是多余的。需要使用内核源代码的用户可以使用kern el.src.rpm软件包。

 

在红帽企业Linux4中,kernel-devel软件包包括了内核的头文件。因此在编译第三方内核模块时不再需要内核源代码的软件包。你可以在一个终端上以root身份使用下面的命令来安装一个kernel-devel软件包

 



#up2date kernel-devel

 

为了编译与当前使用的内核版本不同的模块你并不需要一个完全的源代码树。你只需简单地把你的Makefile文件指向/lib/modules/'uname -r'/build,就可以了。更加详细的解释可以在Release Notes中找到。

 

如果你不是编译一个内核的模块,而是由于某种原因需要内核的源代码,你可以在一个终端上以root身份使用下面的命令来来得到:

 



# up2date redhat-rpm-config rpm-build
# up2date --get-source kernel
# rpm -ivh /var/spool/up2date/kernel*.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild -bp --target=i686 kernel-2.6.spec
# cp -a /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 /usr/src
# ln -s /usr/src/linux-2.6.9 /usr/src/linux

注:这样将会建立一个基于x86架构的源代码树。对于不同的平台(比如x86_64),需要传递适当的参数(比如: rpmbuild -bp --target=x86_64 kernel-2.6.spec)

 

一旦完成,一个指向最新的2.6内核的源代码树的链接就产生了:

 



# ls -lt /usr/src
total 28
lrwxrwxrwx   1 root root   12 Mar  2 16:36 linux -> linux-2.6.9/
drwxr-xr-x  20 root root 4096 Mar  2 16:21 linux-2.6.9
这些步骤在红帽企业Linux 4的发行注释中也可以得到:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/

 

Feedback from users like yourself is a critical factor in helping us make the Red Hat Knowledgebase as useful as possible.

More Like This

  • Retrieving data ...