insmod failed with invalid module format -1
Hi,
With hello kernel module, i use two types of Makefile, one is using kernel build system:
-----------------------------------------------
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
-----------------------------------------------
module loads successfully;
another is using (CC) and then creating the module by "make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules", this module gives the error message when it is inserted,
------------------------------------------------
$dmesg:
overflow in relocation type 10 val ffffffff88640070
`mudule_name' likely not compiled with -mcmodel=kernel
-------------------------------------------------
For this Makefile, i need to add
#include <linux/autoconf.h> in hello.c source code for it to build.
Is there anything that needs to be added in Makefile or source code?
One thing that i notice is the second module doesn't have srcversion when using modinfo, the first one has. vermagic is correct on both modules.
The system is 1.6.18-194.el5 x86_64. The second module works fine when it is in i386 machine ( srcversion is not in the module either, but module works).
Thanks!
|