Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Wrting Modules, modules writing
Hemant
post Apr 13 2003, 03:47 AM
Post #1


RMS is my Hero
******

Group: Support Specialist
Posts: 782
Joined: 6-October 02
From: Trichy,INDIA
Member No.: 29



i tried writing modules on my system.i am follwing allessandro rubini book.i have written a simple hello world module and tried to insert it.but i got errors like.

this module is written for kernel 2.4.9
but the current kernel is 2.4.18

then i checked the header files and found that indeed some header are using 2.4.9 as the kernel.then i tried to manually modify them and thried to compile the module again but still no luck.


--------------------
Hemant Kumar
user posted image
hemant@linuxhelp.net
Go to the top of the page
 
+Quote Post
Corey
post Apr 14 2003, 11:37 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 1,254
Joined: 21-September 02
From: St John's, Newfoundland, Canada
Member No.: 3



I have absolutly no idea on creating, modifying or doing anything with modules except insert and probe (and maybe build), so I have no idea how it's set up. The only suggestion I can make is to make sure that the code is refrencing the proper kernel headers in /usr/src . Make sure you have the source tree for the 2.4.18 kernel in /usr/src/linux-2.4.18 and make a symlink to /usr/src/linux pointing to that source tree. While writing the code, point it to look for headers in /usr/src/linux .


Out of curiosity, can you paste your code in here? I wanna see how you do it smile.gif I've always been interesting in writing modules. If you could give more info on the book you have it would be nice too. smile.gif


--------------------
Corey Quilliam
(former) Linuxhelp.ca Administrator
cquilliam-AT-gmail-dot-com

Want to help out Linuxhelp.net? Check out our Linuxhelp Wiki and see if there are some articles you would like to submit!!

--
Ubuntu 8.04 64-bit - Work Laptop (HP-Compaq NC6400 Core2)
Kubuntu 8.04 64-bit - Desktop (HP m8120n QuadCore)
Ubuntu 6.04 - Server (I'm not upgrading this baby until support runs out in 2012) (Some old POS dell)
Go to the top of the page
 
+Quote Post
Hemant
post Apr 15 2003, 02:32 AM
Post #3


RMS is my Hero
******

Group: Support Specialist
Posts: 782
Joined: 6-October 02
From: Trichy,INDIA
Member No.: 29



Here goes my code..
#define MODULE
#include<linux/kernel.h>
int init_module(void)
{
printk("<1>Hello worldn");
return 0;
}
void cleanup_module(void)
{
printk("<1>good bye cruel worldn");
}

No big module just a hello module.
i compile using
#gcc -c hello.c -I /usr/src/linux/include
it gets compiled without problem.but when i try to insert the module using the command
#insmod hello.o
i get errors like the module has been compiled for kerenl 2.4.9 but the current kernel is 2.4.18

The book i am refering is a device driver book by Alessandro rubini.If interested u can follow the link

http://www.oreilly.com/catalog/linuxdrive/

the book is not free and i got this book from my college library.


--------------------
Hemant Kumar
user posted image
hemant@linuxhelp.net
Go to the top of the page
 
+Quote Post
Hemant
post Apr 15 2003, 02:47 AM
Post #4


RMS is my Hero
******

Group: Support Specialist
Posts: 782
Joined: 6-October 02
From: Trichy,INDIA
Member No.: 29



Ohh..
sorry the book is free u can check the latest edition here
http://www.xml.com/ldd/chapter/book/index.html


--------------------
Hemant Kumar
user posted image
hemant@linuxhelp.net
Go to the top of the page
 
+Quote Post
Corey
post Apr 15 2003, 08:41 AM
Post #5


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 1,254
Joined: 21-September 02
From: St John's, Newfoundland, Canada
Member No.: 3



Okay, it sounds like it's using header files from a 2.4.9 kernel tree. Are you absolutly sure that the kernel source located in /usr/src/linux is indeed the 2.4.18 kernel tree? I'm not sure how to exactly check, maybe it mentions the version number in /usr/src/linux/include/kernel.h ?

Otherwise, I cannot see any other reason why a kernel module would think it's compiling with a 2.4.9 kernel.


--------------------
Corey Quilliam
(former) Linuxhelp.ca Administrator
cquilliam-AT-gmail-dot-com

Want to help out Linuxhelp.net? Check out our Linuxhelp Wiki and see if there are some articles you would like to submit!!

--
Ubuntu 8.04 64-bit - Work Laptop (HP-Compaq NC6400 Core2)
Kubuntu 8.04 64-bit - Desktop (HP m8120n QuadCore)
Ubuntu 6.04 - Server (I'm not upgrading this baby until support runs out in 2012) (Some old POS dell)
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 15th December 2017 - 02:59 PM