On 2/23/06, Rajaram Suryanarayanan <rajaram_linux@xxxxxxxxx> wrote: > Hi, > > I am getting some problem in inserting a module even after compiling it for > the running kernel. > > [root@localhost kernel-modules]# insmod hello-1.ko > insmod: error inserting 'hello-1.ko': -1 Invalid module format > [root@localhost kernel-modules]# > > This does not seem to be related with the common vermagic problem, as I see > the following message in dmesg. > hello_1: disagrees about version of symbol struct_module > > Please see the Makefile and make output below. Please clarify me what goes > wrong. > > Makefile : > > obj-m += hello-1.o > all: > make -C /lib/modules/$(shell uname -r)/build M=$(PWD) > EXTRA_CFLAGS="-g" modules > > > > [root@localhost kernel-modules]# make > make -C /lib/modules/2.6.14.4-kdbnew/build > M=/root/kernel-modules EXTRA_CFLAGS="-g" modules > make[1]: Entering directory `/linux-source/linux-2.6.14.4' > CC [M] /root/kernel-modules/hello-1.o > /root/kernel-modules/hello-1.c: In function `init_module': > /root/kernel-modules/hello-1.c:10: warning: int format, long unsigned int > arg (arg 2) > Building modules, stage 2. > MODPOST > LD [M] /root/kernel-modules/hello-1.ko > make[1]: Leaving directory `/linux-source/linux-2.6.14.4' > [root@localhost kernel-modules]# > > [root@localhost kernel-modules]# uname -a > Linux localhost.localdomain 2.6.14.4-kdbnew #7 SMP PREEMPT Sun Jan 22 > 17:02:06 IST 2006 i686 i686 i386 GNU/Linux > [root@localhost kernel-modules]# Well your makefile is not proper. The method of writing the makefiles have changed for the 2.6 kernel. The makefile that you have written is for 2.4 kernel. Check this out : http://www.tldp.org/LDP/lkmpg/2.6/html/x181.html Also your above line in the makefile : obj-m += hello-1.o should be obj-m += hello-1.ko Google more about this :) -- Regards, Sandeep A man with one watch knows what time it is; a man with two watches is never quite sure. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/