LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-05-2004, 11:09 PM   #1
mishranavaneet
LQ Newbie
 
Registered: Jan 2004
Location: Pune, Mharashtra, India
Posts: 4

Rep: Reputation: 0
Question kernel progarmmer's(module compiletion problem)


--------------------------------------------------------------------------------

i am try to compile a simple hello world module
===================
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module(void)
{
printk("Hello world 1.\n");
// A non 0 return means init_module failed; module can't be loaded.
return 0;
}
void cleanup_module(void)
{
printk("Goodbye world 1.\n");
}
===============
on there included linux/modue.h have a structure atomic_t
this sturcture no have any defnition in any part of this header file or in any dependent header file

so plese help me to solve this proble this proble create a compiletion error
 
Old 01-05-2004, 11:11 PM   #2
mishranavaneet
LQ Newbie
 
Registered: Jan 2004
Location: Pune, Mharashtra, India
Posts: 4

Original Poster
Rep: Reputation: 0
solution i dont know
 
Old 01-06-2004, 05:07 AM   #3
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
could you show how you are trying to compile the module?

also, try reading the manuals for linux kernel programming.

http://www.ibiblio.org/pub/Linux/doc...ramming-guide/

these would help you understand the kernel programming a lot better.
 
Old 01-06-2004, 11:51 AM   #4
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Rep: Reputation: 46
what compilation errors are you getting - could you post that?
shouldnt it be #ifdef and not #if?
 
Old 01-06-2004, 09:00 PM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
I recommend getting the O'Reilly Book Linux Device Drivers from the book store if you are planning on doing any serious driver development. I have done some networking stuff, and a few special purpose drivers and that book help me a bunch.

As for the error you are getting, tell us exactly what it is and what you are doing to compile the file and we can offer more help.
 
Old 08-13-2004, 05:11 AM   #6
thirumalai
LQ Newbie
 
Registered: Aug 2004
Location: India
Posts: 6

Rep: Reputation: 0
kernel module program

Hi all....

I think, i m also getting same type of error

This is code:
-------------

#define MODULE
#include<linux/module.h>
int init_module(void)
{
printk("<1>Hello,World\n");
return 0;
}
void cleanup_module(void)
{
printk("<1>GoodBye\n");
}

i has compiled using

[root]# gcc -c Module1.c

when i m running the object file, i m getting the error like

[root@thirumalai LinuxModule]# insmod Module1.o

Module1.o: kernel-module version mismatch
Module1.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.22-1.2115.nptl.

Please give me good solution for this.......how to compile and run the kernel module prm.....
 
Old 08-13-2004, 01:36 PM   #7
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
search the forum for version mismatch, it's been answered a dozen times.
 
Old 08-13-2004, 11:37 PM   #8
thirumalai
LQ Newbie
 
Registered: Aug 2004
Location: India
Posts: 6

Rep: Reputation: 0
Thank u for reply...

i have got the solution from

http://www.vijaymukhi.com/documents/...nux/chap5.html
 
  


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
Problem installing module in Fedora Core 2 (2.6 kernel vs 2.4 problem?) Arodef Linux - Kernel 3 11-30-2007 02:55 PM
Kernel 2.6.13 and module problem jeffpr Fedora 3 10-07-2005 05:22 PM
problem in kernel module cranium2004 Programming 1 04-14-2005 03:10 AM
kernel progarmmer's(module compiletion problem)==> full detail<== mishranavaneet Programming 1 01-07-2004 01:04 AM
Kernel 2.4.23 module problem powadha Linux - Software 2 12-09-2003 06:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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