Skip to contentSkip to conversation

problem with insmod

DISCUSSION Arrigo Benedetti 2 participants 4 messages Nov 4, 2004

lore
Share & tools
lore
#0 lore raw

First of all I would like to thank everyone in this list who has answered my questions so far, especially Ben...

Now I'm trying to write and and install a kernel module on 2.6, YDL 4.0. I compiled the example module by Alessandro Rubin at http://www.linux.it/~rubini/docs/modules26/src.tar.gz
When I try to load it with insmod I get:

[root@localhost root]# insmod empty.ko
insmod: error inserting '/home/arrigo/linux/modules/src/empty.ko': -1 Invalid module format

After some research I found that to load a module on the 2.6 kernel one should insmod from module-init-tools <ftp://ftp.it.kernel.org/pub/linux/utils/kernel/module-init-tools/>, not the default insmod from the modutils package that comes with YDL.
So I compile and install module-init-tools, but I get the same error.
Does anyone know what's going on?

Thanks
-Arrigo

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 1 line · Arrigo Benedetti

After some research I found that to load a module on the 2.6 kernel one

yes, http://www.linux.org.uk/~davej/docs/post-halloween-2.6.txt is a good start for 2.4 -> 2.6 upgrades.

Quoted 2 lines

So I compile and install module-init-tools, but I get the same error. Does anyone know what's going on?

hm, are you sure the new "insmod" and "modprobe" are the *right* ones? the PATH variable will help here or try to specify the exact path on the cmd line. here i have:

evil@prinz:~$ /sbin/modprobe -V
module-init-tools version 3.1-pre6
vil@prinz:~$ file /sbin/modprobe*
/sbin/modprobe:           ELF 32-bit LSB executable, Intel 80386, [...]
/sbin/modprobe.Lmodutils: symbolic link to `insmod'
/sbin/modprobe.modutils:  symbolic link to `insmod.modutils'

Christian.
- --
BOFH excuse #391:

We already sent around a notice about that.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBijXsC/PVm5+NVoYRAkspAJ9v5khRZVwpPxsmTL/v5tYKUUkrDgCg2np7 85mBGkq+rCRLwO7DJMNjoQA=
=xfHv
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 24 lines · evilninja

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Arrigo Benedetti

After some research I found that to load a module on the 2.6 kernel one

yes, http://www.linux.org.uk/~davej/docs/post-halloween-2.6.txt is a good start for 2.4 -> 2.6 upgrades.

Quoted 4 lines

So I compile and install module-init-tools, but I get the same error. Does anyone know what's going on?

hm, are you sure the new "insmod" and "modprobe" are the *right* ones? the PATH variable will help here or try to specify the exact path on the cmd line. here i have:

Quoted 9 lines
evil@prinz:~$ /sbin/modprobe -V
module-init-tools version 3.1-pre6
vil@prinz:~$ file /sbin/modprobe*
/sbin/modprobe:           ELF 32-bit LSB executable, Intel 80386, [...]
/sbin/modprobe.Lmodutils: symbolic link to `insmod'
/sbin/modprobe.modutils:  symbolic link to `insmod.modutils'

Yes, I have verified that. Someone has also suggested to check that the compiler used to build the module is the same compiler that build the kernel. The Makefile is below and it seems that this is also ok.

-Arrigo

ifndef KERNELRELEASE

    LINUX ?= /usr/src/linux-2.6
    PWD := $(shell pwd)
    all:
	     $(MAKE) -C $(LINUX) SUBDIRS=$(PWD) modules
    clean:
	     rm -f *.o *.ko *~ core .depend *.mod.c *.cmd    

else
obj-m := empty.o

endif

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · Arrigo Benedetti

Yes, I have verified that. Someone has also suggested to check that the compiler used to build the module
is the same compiler that build the kernel. The Makefile is below and it seems that this is also ok.

hm, i've built module-init-tools from source too once, but now your distro of choice will hat a binary package too, i think. maybe you can go with this package to get modules in 2.6 running and can go on with the debugging of your compiled version afterwards. (maybe "strace modprobe" will help here...? or is the module itself not proper compiled? (make mrproper)...)

just my 2¢....
- --
BOFH excuse #16:

somebody was calculating pi on the server
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBiru9C/PVm5+NVoYRAkJsAJ9JytrFkpj/y7CA8Y8fuL6oQ5WwZgCeKTsm YW2BlwyhM24P/L4YG9uAvd0=
=BrnQ
-----END PGP SIGNATURE-----