LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 01-13-2011, 07:02 AM   #1
courteous
LQ Newbie
 
Registered: Dec 2010
Posts: 22

Rep: Reputation: 8
Question insmod hello.ko: -1 Invalid module format ("vermagic" and "uname -r" are the same!)


I'm having trouble loading a simple hello.ko module.

Module's vermagic and uname -r are the same, yet
Code:
sudo insmod hello.ko
still returns
Code:
-1 Invalid module format
 
Old 01-13-2011, 07:21 AM   #2
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,634
Blog Entries: 29

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
Have you compiled the module successfully through make?
 
Old 01-13-2011, 07:52 AM   #3
courteous
LQ Newbie
 
Registered: Dec 2010
Posts: 22

Original Poster
Rep: Reputation: 8
This is the make's output:
Code:
blaise@blaise-E520 ~/Documents/seminar/module $ make
make -C /lib/modules/2.6.35.10/build M=/home/blaise/Documents/seminar/module modules
make[1]: Entering directory `/usr/src/linux-2.6.35.10'
  CC [M]  /home/blaise/Documents/seminar/module/hello.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/blaise/Documents/seminar/module/hello.mod.o
  LD [M]  /home/blaise/Documents/seminar/module/hello.ko
make[1]: Leaving directory `/usr/src/linux-2.6.35.10'
These files are in the directory:
Code:
hello.c  hello.ko  hello.mod.c	hello.mod.o  hello.o  Makefile	Module.markers	modules.order  Module.symvers
I'm a novice, so you should tell if this is "successful".
 
Old 01-13-2011, 08:50 AM   #4
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,634
Blog Entries: 29

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
and your Makefile is exactly as follows? and you have done a 'make clean' too before doing a 'make' again?
Code:
obj-m += hello.o

all:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

Last edited by TheIndependentAquarius; 01-13-2011 at 08:51 AM.
 
Old 01-13-2011, 09:01 AM   #5
courteous
LQ Newbie
 
Registered: Dec 2010
Posts: 22

Original Poster
Rep: Reputation: 8
'make clean' doesn't help

Yes, Makefile is exactly the same (source: cyberciti.biz).

Now, I've also tried running make clean before make: error "Invalid module format" persists.
 
Old 01-14-2011, 12:18 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,634
Blog Entries: 29

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
Well, I have tested the same code here, and it works fine for me, except the fact sudo insmod hello.ko says command not found coz. insmod must be in /sbin. So su worked for me!
 
Old 02-16-2011, 04:29 AM   #7
arm_8051
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 2
hi,

can u paste the code here.
 
Old 02-16-2011, 04:37 AM   #8
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,634
Blog Entries: 29

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
May I know to whom you are talking to here?
 
Old 02-17-2011, 12:09 AM   #9
arm_8051
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 2
hi,

sorry Anisha Kaul,i'm talking to courteous.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rt61pci kernel module fails to load in -current "Invalid module format" Interject Slackware 6 03-20-2010 02:48 AM
What is the error "invalid module format" and "insert kernel module"? shayori Linux - Newbie 8 02-25-2010 04:48 AM
"Invalid module format" after recompiling kernel without changing .config - why? kovlensky Linux - Kernel 5 09-10-2008 01:42 PM
Cisco VPN Client on FC6 2.6.20 "invalid module format" rrautens Fedora 16 06-07-2007 10:21 PM
"Invalid module format" when I try to install my ATI drivers freddurgan Linux - Newbie 2 05-21-2004 11:49 PM


All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration