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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-05-2004, 11:09 PM
|
#1
|
LQ Newbie
Registered: Jan 2004
Location: Pune, Mharashtra, India
Posts: 4
Rep:
|
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
|
|
|
01-05-2004, 11:11 PM
|
#2
|
LQ Newbie
Registered: Jan 2004
Location: Pune, Mharashtra, India
Posts: 4
Original Poster
Rep:
|
solution i dont know
|
|
|
01-06-2004, 05:07 AM
|
#3
|
Member
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251
Rep:
|
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.
|
|
|
01-06-2004, 11:51 AM
|
#4
|
Senior Member
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286
Rep:
|
what compilation errors are you getting - could you post that?
shouldnt it be #ifdef and not #if?
|
|
|
01-06-2004, 09:00 PM
|
#5
|
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Rep:
|
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.
|
|
|
08-13-2004, 05:11 AM
|
#6
|
LQ Newbie
Registered: Aug 2004
Location: India
Posts: 6
Rep:
|
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.....
|
|
|
08-13-2004, 01:36 PM
|
#7
|
Member
Registered: Mar 2003
Posts: 804
Rep:
|
search the forum for version mismatch, it's been answered a dozen times.
|
|
|
08-13-2004, 11:37 PM
|
#8
|
LQ Newbie
Registered: Aug 2004
Location: India
Posts: 6
Rep:
|
|
|
|
All times are GMT -5. The time now is 10:43 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|