Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: Disabled
Inserting the module

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, 06:32 AM   #2
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: 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:
Old 12-26-2013, 11:27 AM   #3
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- but it's unable to insert. But when I am changing linux-headers- to linux-3.12 it's nicely inserted, but the problem with compilation remains.
Any help??


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

All times are GMT -5. The time now is 10:44 PM.

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