LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-17-2005, 06:55 PM   #1
hetzme
LQ Newbie
 
Registered: May 2005
Posts: 21

Rep: Reputation: 15
Problem inserting a new module


I am using redhat 9.

Below is my program (test.c):
=============================
#define MODULE
#include <linux/module.h>

int init_module(void) {printk("<1>Hello, World\n"); return 0; }
void cleanup_module(void) {printk ("<1>Goodbye cruel world\n"); }




I compiled the above module to get "test.o". When tried to insert it by calling

"insmod test.o"

it is complaining. Below is the error message:

test.o: kerner-module version mismatch
test.o was compiled for kerner version 2.4.20
while this kerner is version 2.4.20-8.


Then I tried with "-f" option. I did not get expected result. When I ran "insmod" I expected to see "Hello, World" and when I ran "rmmod" I expected to see "Goodbye cruel world". I did not see these messages.


Below is what I tried:
=================

[root@localhost devicedrivers]# ls
test1.c test1.o
[root@localhost devicedrivers]# insmod test1.o
test1.o: kernel-module version mismatch
test1.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.20-8.
[root@localhost devicedrivers]# insmod -f test1.o
Warning: kernel-module version mismatch
test1.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.20-8
Warning: loading test1.o will taint the kernel: no license
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
Warning: loading test1.o will taint the kernel: forced load
Module test1 loaded, with warnings
[root@localhost devicedrivers]#
[root@localhost devicedrivers]# rmmod test1
[root@localhost devicedrivers]#




Could anyone please tell me whats happening there. Why am I not seeing the "Hello, World" when insert and "Goodbye cruel world" when I remove the module?
 
Old 07-17-2005, 07:44 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
you don't say how you compiled this module but try
Code:
gcc -c  -O2 -DMODULE -D__KERNEL__  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -isystem /lib/modules/`uname -r`/build/include  test.c
 
Old 07-17-2005, 08:33 PM   #3
hetzme
LQ Newbie
 
Registered: May 2005
Posts: 21

Original Poster
Rep: Reputation: 15
I just did "gcc test.c"
 
  


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
Problem in inserting a device driver module rajesh_b Programming 5 05-10-2007 12:20 AM
Error inserting the ATI module now for some reason..HELP wpg9210 Linux - Software 3 01-25-2006 04:17 PM
Problem inserting a new module to kernel hetzme Programming 2 07-18-2005 06:21 AM
inserting a module without recompiling? Simon Bridge Linux - Software 1 05-14-2004 05:53 PM
Inserting video card module (sis650) atheist Linux - Hardware 3 04-06-2004 07:17 AM

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

All times are GMT -5. The time now is 11:10 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