[CentOS-virt] What kernel source and how to download it

Fri Nov 27 10:58:10 UTC 2009
Manuel Wolfshant <wolfy at nobugconsulting.ro>

Mauro Gatti wrote:
> Hi all,
> I am running CentOS 5.3 under xen on a VPS machine (so I have a 
> limited control on the machine)
> I am playing with openswan and KLIPS and I need to build the ipsec.ko 
> kernel module.
> I would need to download kernel source but I am really confused about 
> what source I have to get.
>
> uname -r tells:
> 2.6.18-128.7.1.el5xen
Just for the record, that is the kernel from Centos 5.4/ updates  ( and 
it is a good thing that you use it)


>
> ls /lib/modules tells:
> ls /lib/modules       
> 2.6.18-128.7.1.el5xen  2.6.18-164.2.1.el5  2.6.18-164.6.1.el5  
> 2.6.18-53.1.13.el5xen
>
> I have no sources in /usr/src/kernels
>
> Is there a source code named "2.6.18-128.7.1.el5xen" which I can 
> download or should I install kernel-devel source using yum?

the package is called kernel-xen-devel  (to be in sync with kernel-xen 
which you are using)


> If I used yum I would download 2.6.30.9...
You would not. There is no 2.6.30 in the Centos repositories


> yum info kernel-devel 
> Loaded plugins: fastestmirror
> Loading mirror speeds from cached hostfile
> Available Packages
> Name       : kernel-devel
> Arch       : i686
> Version    : 2.6.18
> Release    : 164.6.1.el5
> Size       : 5.2 M
> Repo       : updates
> Summary    : Development package for building kernel modules to match 
> the kernel.
> URL        : http://www.kernel.org/
> License    : GPLv2
> Description: This package provides kernel headers and makefiles 
> sufficient to build modules
>            : against the kernel package.
>
> and kernel.org has only source code from 2.6.18.1 to 2.6.18.8
>
you should not look at the stock kernels when using centos.