LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-25-2013, 01:57 PM   #1
Lokesh2015
LQ Newbie
 
Registered: Dec 2013
Posts: 4
Blog Entries: 3

Rep: Reputation: Disabled
Inserting the module


Hi,
I am new to kernel, And I am using 3.12.0 kernel version. I wrote my first Hello.c file and compile using 3.2.0-57-generic-pae linux header. Compilation was done nicely but when I try to execute the insmod Hello.ko "An error msg is displayed-- invalid maodule format." How could I use my newer version for compiling , inserting and to dispaly the message on the older linux. I am using linux 3.2.0. I don't want to remove the old version. Please help....
 
Old 12-26-2013, 07:32 AM   #2
lemon09
Member
 
Registered: Jun 2009
Location: kolkata,India
Distribution: Mandriva,openSuse,Mint,Debian
Posts: 285
Blog Entries: 1

Rep: Reputation: 37
please give information like how did you compile the code. What flags did you provide to compile. This post may help you.

Code:
1.2.1.3. Compiling Issues and Kernel Version

Very often, Linux distros will distribute kernel source that has been patched in various non-standard ways, which may cause trouble.

A more common problem is that some Linux distros distribute incomplete kernel headers. You'll need to compile your code using various header files from the Linux kernel. Murphy's Law states that the headers that are missing are exactly the ones that you'll need for your module work.

To avoid these two problems, I highly recommend that you download, compile and boot into a fresh, stock Linux kernel which can be downloaded from any of the Linux kernel mirror sites. See the Linux Kernel HOWTO for more details.

Ironically, this can also cause a problem. By default, gcc on your system may look for the kernel headers in their default location rather than where you installed the new copy of the kernel (usually in /usr/src/. This can be fixed by using gcc's -I switch.

You can find in the following file:
Code:
http://www.tldp.org/LDP/lkmpg/2.4/html/x49.html
 
Old 12-26-2013, 12:27 PM   #3
Lokesh2015
LQ Newbie
 
Registered: Dec 2013
Posts: 4
Blog Entries: 3

Original Poster
Rep: Reputation: Disabled
Unhappy Inserting the module

Actually I have installed the linux kernel 3.12.0. And now compilation is not a problem. When I am inserting module is the problem. Compilation is done succesfully when using linux-headers-3.2.0.57 but it's unable to insert. But when I am changing linux-headers-3.2.0.57 to linux-3.12 it's nicely inserted, but the problem with compilation remains.
Any help??
 
  


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
Error inserting module. imran2 Linux - Newbie 1 02-11-2011 12:55 PM
Problem in inserting a module shraddha6282 Programming 2 10-07-2008 05:15 AM
Inserting module in the kernel nitinbaldi Linux - Kernel 2 02-17-2007 11:33 PM
insmod: error inserting 'module.o': -1 Invalid module format ksrinivas Linux - Newbie 5 10-11-2006 08:29 AM
inserting a module without recompiling? Simon Bridge Linux - Software 1 05-14-2004 06:53 PM


All times are GMT -5. The time now is 04:55 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration