您的位置:首页 > 运维架构 > Linux

centos6.5 系统内核版本获取

2015-04-20 16:50 363 查看
最近需要修改内核的一部分功能,但是在linux源码网站https://www.kernel.org/上找不到具体的版本号,于是用直接wget,mark一下,又获得新技能了。

查看系统的讷内核版本:

[code][root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


然后再输入用wget获取redhat的rpm包

[code][root@localhost ~]# wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6ComputeNode/en/os/SRPMS/kernel-2.6.32-431.el6.src.rpm --2015-04-19 23:51:10--  ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6ComputeNode/en/os/SRPMS/kernel-2.6.32-431.el6.src.rpm            => “kernel-2.6.32-431.el6.src.rpm”
Resolving ftp.redhat.com... 209.132.183.61
Connecting to ftp.redhat.com|209.132.183.61|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/redhat/linux/enterprise/6ComputeNode/en/os/SRPMS ... done.
==> SIZE kernel-2.6.32-431.el6.src.rpm ... 95465895
==> PASV ... done.    ==> RETR kernel-2.6.32-431.el6.src.rpm ... done.
Length: 95465895 (91M) (unauthoritative)

100%[======================================>] 95,465,895   357K/s   in 4m 9s   

2015-04-19 23:55:25 (375 KB/s) - “kernel-2.6.32-431.el6.src.rpm” saved [95465895]


查看下载的rpm包,并获取其中的linux内核源码文件

[code][root@localhost ~]# ls
anaconda-ks.cfg  Downloads           kernel-2.6.32-431.el6.src.rpm  Public     Videos
Desktop          install.log         Music                          rpmbuild
Documents        install.log.syslog  Pictures                       Templates
[root@localhost ~]# rpm -ivh kernel-2.6.32-431.el6.src.rpm


执行完 rpm指令后,会创建文件夹其中包含内核tar包

[code][root@localhost rpmbuild]# cd ~/rpmbuild/SOURCES/
[root@localhost SOURCES]# ls
check-kabi                   config-powerpc64-rhel        genkey
config-debug                 config-powerpc-generic       kabitool
config-debug-rhel            config-powerpc-generic-rhel  kernel-abi-whitelists.tar.bz2
config-framepointer          config-s390x                 linux-2.6.32-431.el6.tar.bz2


这样就获得了系统中的内核源码文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: