Hi, I've been trying to compile some kernel modules for centos 6.5, specifically fore_200e atm driver (although I also have hardware to try nicstar and he ). This module is not included in the centos kernel or modules but is included in the stock kernel source.
Lots of articles on compiling or patching modules in general or compiling code not included in the kernel source, but not much on creating a module in the source but not included in a distro.
After reading some of the centos wiki articles on why I don't need the kernel source, I tried just compiling the module source on it's own, but when I tried to modprobe / insmod it, I get this error:- insmod: error inserting '/lib/modules/2.6.32-431.20.5.el6.x86_64/extra/fore_200e.ko': -1 Invalid module format
Google suggests this is because I am trying to compile against the wrong headers but as far as I can see, there is only one kernel and kernel headers on the system.
This is my os:-
Linux localhost.localdomain 2.6.32-431.20.5.el6.x86_64 #1 SMP Fri Jul 25 08:34:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
It's a vm used just for compiling the code, so obviously there isn't some real PCI bus hardware present but this should not cause the above error.
As a different track, I tried to compile a new kernel and modules. This is on a real machine, with a 32bit kernel, 2.6.32-431.20.5.el6.i686 #1 SMP, although the hardware is 64 bits. I thought to avoid any possible issues with either non-64 bit clean code or trying to compile 32 bit code on a 64 bit machine initially, I installed a 32 bit os.
With make menuconfig I could select the extra modules to compile. This seems to have worked ok, but the resulting kernel is kernel-2.6.32-1.i386.rpm, the src package is kernel-2.6.32-1.src.rpm but the running kernel is 2.6.32-431.20.5
Trying to install it gives:- [root@neptune ~]# rpm -ivh /home/andrew/rpmbuild/RPMS/i386/kernel-2.6.32-1.i386.rpm Preparing... ########################################### [100%] package kernel-2.6.32-71.el6.i686 (which is newer than kernel-2.6.32-1.i386) is already installed package kernel-2.6.32-431.20.5.el6.i686 (which is newer than kernel-2.6.32-1.i386) is already installed [root@neptune ~]#
I'm not sure why the new kernel isn't a later number.
I downloaded the latest centos source so the major numbers match, but I'm not sure why the minor numbers are 2.6.32-1 not 2.6.32-431.20.5 and note importantly, how to fix it.
I'm still not convinced that recompling the whole kernel just to get some new modules is the right way to go. My feeling is that my initial approach is the right way to go.
Any clues on the best direction to proceed?
Regards, Andrew.
On Sun, August 24, 2014 10:22 am, Andrew Stringer wrote:
With make menuconfig I could select the extra modules to compile. This seems to have worked ok, but the resulting kernel is kernel-2.6.32-1.i386.rpm, the src package is kernel-2.6.32-1.src.rpm but the running kernel is 2.6.32-431.20.5
Trying to install it gives:- [root@neptune ~]# rpm -ivh /home/andrew/rpmbuild/RPMS/i386/kernel-2.6.32-1.i386.rpm Preparing... ########################################### [100%] package kernel-2.6.32-71.el6.i686 (which is newer than kernel-2.6.32-1.i386) is already installed package kernel-2.6.32-431.20.5.el6.i686 (which is newer than kernel-2.6.32-1.i386) is already installed [root@neptune ~]#
You can just insist that you are installing older package like this:
rpm -ivh --oldpackage ...
I'm not sure why the new kernel isn't a later number.
You can change package version number (append to be precise) in rpm spec file (before you rebuild rpm).
I hope, this helps.
Valeri
++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
On Sun, Aug 24, 2014 at 8:22 AM, Andrew Stringer centos@rainsbrook.co.uk wrote:
Hi, I've been trying to compile some kernel modules for centos 6.5, specifically fore_200e atm driver (although I also have hardware to try nicstar and he ). This module is not included in the centos kernel or modules but is included in the stock kernel source.
I can give you a very easy solution. Install the CentOSPlus kernel. The ATM fore_200e driver is enabled in this kernel.
If you prefer using kernel module, then file a request with ELRepo ( http://elrepo.org ).
If you still wish to learn how to build a kernel module, we can help you.
Akemi
Hi Akemi,
On Sun, Aug 24, 2014 at 8:22 AM, Andrew Stringer centos@rainsbrook.co.uk wrote:
Hi, I've been trying to compile some kernel modules for centos 6.5, specifically fore_200e atm driver (although I also have hardware to try nicstar and he ). This module is not included in the centos kernel or modules but is included in the stock kernel source.
I can give you a very easy solution. Install the CentOSPlus kernel. The ATM fore_200e driver is enabled in this kernel.
If you prefer using kernel module, then file a request with ELRepo ( http://elrepo.org ).
Right answer and thanks for the speedy response.
I have installed the new kernel and progress has been made. Just for interest, I have started writing this up here:-
http://www.rainsbrook.co.uk/wiki/doku.php/rb/foreatmnic
If you still wish to learn how to build a kernel module, we can help you.
Yes, although not of huge interest now I have achieved what I wanted to, it would be of interst to find out what I was doing wrong.
Regards, Andrew.
On Sun, Aug 24, 2014 at 2:40 PM, Andrew Stringer centos@rainsbrook.co.uk wrote:
Hi Akemi,
On Sun, Aug 24, 2014 at 8:22 AM, Andrew Stringer
If you still wish to learn how to build a kernel module, we can help you.
Yes, although not of huge interest now I have achieved what I wanted to, it would be of interst to find out what I was doing wrong.
Hi Andrew.
Glad to hear you've got things working for you.
Regarding the .ko file you built, check /var/log/messages for more hint and also post the output of 'modinfo' of your module.
Akemi