LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 06: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, 06:21 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Have you compiled the module successfully through make?
 
Old 01-13-2011, 06: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, 07:50 AM   #4
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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 Aquarius_Girl; 01-13-2011 at 07:51 AM.
 
Old 01-13-2011, 08: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-13-2011, 11:18 PM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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, 03: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, 03:37 AM   #8
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
May I know to whom you are talking to here?
 
Old 02-16-2011, 11:09 PM   #9
arm_8051
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 2
hi,

sorry Anisha Kaul,i'm talking to courteous.
 
  


Reply



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 01:48 AM
What is the error "invalid module format" and "insert kernel module"? shayori Linux - Newbie 8 02-25-2010 03:48 AM
"Invalid module format" after recompiling kernel without changing .config - why? kovlensky Linux - Kernel 5 09-10-2008 12:42 PM
Cisco VPN Client on FC6 2.6.20 "invalid module format" rrautens Fedora 16 06-07-2007 09:21 PM
"Invalid module format" when I try to install my ATI drivers freddurgan Linux - Newbie 2 05-21-2004 10:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:18 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
Open Source Consulting | Domain Registration