LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


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

Rep: Reputation: 15
Problem inserting a new module to kernel


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-18-2005, 04:39 AM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
I think you need to define MODVERSIONS.

http://www.die.net/doc/linux/lkmpg/node11.html
 
Old 07-18-2005, 06:21 AM   #3
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Re: Problem inserting a new module to kernel

Quote:
Originally posted by hetzme
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?
Where are you looking for "Hello, World" && "Goodbye cruel world"? Console? I think, you should have a look at /var/log/messages || somewhere in /var/log

Cheers,
GH
 
  


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 hetzme Linux - Software 2 07-17-2005 08:33 PM
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 > Non-*NIX Forums > Programming

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