LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   "Invalid module format" after recompiling kernel without changing .config - why? (http://www.linuxquestions.org/questions/linux-kernel-70/invalid-module-format-after-recompiling-kernel-without-changing-config-why-668949/)

kovlensky 09-10-2008 10:51 AM

"Invalid module format" after recompiling kernel without changing .config - why?
 
Summary for impatient readers - after recompiling stock module without changing single option vendor-supplied modules stop loading (and crash, when forced to load). The question is why?

Long story - I've got Suse 10 machines here running stock kernel and having few closed source modules installed. As I have urgent need for compilig customized kernel I gave it quick shot. The idea is simple - I've got full kernel sources used for compliation, .config and proper environment it was compiled in, so what's the problem? Well, there is. Every single external module working with supplied kernel does not load after recompilation.

How recompilation is done? That's simple:
# uname -r
2.6.16.21-0.8-smp
# rpm -qa|grep 2.6.16.21-0.8
kernel-source-2.6.16.21-0.8
kernel-smp-2.6.16.21-0.8
# cd /usr/src/linux-2.6.16.21-0.8
# zcat /proc/config.gz >.config

later on usual stuff - make clean, bzImage, modules, modules_install, depmod, mkinird, and boot it all up. Modinfo data seem ok - the first one is from closed source module (infinipath), the other one from recompiled module. I can see no single difference, but there must be one.

Any ideas?

# modinfo /lib/modules/2.6.16.21-0.8-smp/updates/ib_mad.ko
filename: /lib/modules/2.6.16.21-0.8-smp/updates/ib_mad.ko
license: Dual BSD/GPL
description: kernel IB MAD API
author: Hal Rosenstock
author: Sean Hefty
vermagic: 2.6.16.21-0.8-smp SMP gcc-4.1
depends: ib_core,ib_core
srcversion: 2020C495F1D3BD881B84968
# modinfo /lib/modules/2.6.16.21-0.8-smp/kernel/fs/
9p/ befs/ cramfs/ freevxfs/ jffs/ nfs/ qnx4/ smbfs/
adfs/ bfs/ dmapi/ fuse/ jffs2/ nfs_common/ quota_v1.ko sysv/
affs/ binfmt_misc.ko efs/ hfs/ jfs/ nfsd/ quota_v2.ko udf/
afs/ cifs/ exportfs/ hfsplus/ lockd/ nls/ reiserfs/ ufs/
autofs/ coda/ ext3/ hpfs/ msdos/ ntfs/ relayfs/ vfat/
autofs4/ configfs/ fat/ jbd/ ncpfs/ ocfs2/ romfs/ xfs/
# modinfo /lib/modules/2.6.16.21-0.8-smp/kernel/fs/fat/fat.ko
filename: /lib/modules/2.6.16.21-0.8-smp/kernel/fs/fat/fat.ko
license: GPL
vermagic: 2.6.16.21-0.8-smp SMP gcc-4.1
depends:
srcversion: 2A176656DA905B97EC126BF

Uncle_Theodore 09-10-2008 10:54 AM

Look at the dmesg output after you attempt to load the module. It will have some useful information about the error. I suspect there's a problem with version mismatch.

kovlensky 09-10-2008 11:09 AM

That's obvious that the case is version mismatch, otherwise these modules would simply load and work, right? The question was why, when having exact sources and no single .config entry modified? Every single vendor-supplied module complains.

ib_mad: disagrees about version of symbol struct_module

Uncle_Theodore 09-10-2008 11:51 AM

Quote:

Originally Posted by kovlensky (Post 3275946)
That's obvious that the case is version mismatch, otherwise these modules would simply load and work, right? The question was why, when having exact sources and no single .config entry modified? Every single vendor-supplied module complains.

ib_mad: disagrees about version of symbol struct_module

Where did you get the sources? From kernel.org or from SUSE? By "version" I meant the version lines in the Makefile of your sources. Like these

VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 24
EXTRAVERSION = .5

Check with head /usr/src/linux/Makefile

If these variables don't match, the modules will not load. And they are set in the Makefile, not in the .config. So, if you get source from someplace other than your official distro vendor, they will be different. Although, you can set them yourself.

kovlensky 09-10-2008 12:33 PM

Both kernel binaries and kernel sources come from SLES10 GA. rpms are called kernel-source-2.6.16.21-0.8 and kernel-smp-2.6.16.21-0.8. There is no Makefile problem unless some data are not displayed - vermagic strings match and that's where data from makefile go. Also .config files extracted from both stock and recompiled kernel match. Makefile settings can be displayed BTW - that's what uname is for.

I'll ask from the other side - when you want to recompile stock kernel the procedure is to install source rpm corresponding to your release, get .config from your kernel or /boot/config.whatever (both match BTW), and simply rebuild the kernel. According to every single piece of documentation I found new kernel should be compatible with the old one. But it isn't. So what was missing on the way? I know the reason looks clear - "disagrees about version of symbol struct_module" message - but how to extract verion of symble struct_module mentioned form both kernel and module? Kernel disagreed, but every single tool that comes into my mind can find no difference.

BTW - stock kernel is also unable to load recompiled modules. So the question is how to display what exactly the difference is.

Uncle_Theodore 09-10-2008 12:42 PM

Does your new kernel have a "smp" in its version string, just like the old did? If so, I don't know what else to check...


All times are GMT -5. The time now is 08:49 AM.