login
Header Space

 
 

compile a module

October 21, 2004 - 10:01am
Submitted by Anonymous on October 21, 2004 - 10:01am.
Linux

hellow

i tried to compile a simple module

in first i printed

gcc -c hello.c
(created hello.o)

and then

insmod hello.o
(i tried also insmod -f hello.o)
but its printed me an error
hello.o: couldnt find the kernel version the module was compile for?

is anyone know a solution?

series on lwn.net

October 21, 2004 - 10:14am
Anonymous

You may be interested in: http://lwn.net/Articles/driver-porting/

module

October 21, 2004 - 12:44pm
Anonymous

i didnt saw there anything that could help me

where's the code

October 21, 2004 - 11:32pm
Anonymous

don't know what the problem is without seeing some code.

this is the code

October 22, 2004 - 5:33am
Anonymous

/* hello-1.c - The simplest kernel module.
*/
#include /* Needed by all modules */
#include /* Needed for KERN_ALERT */

int init_module(void)
{
printk("<1>Hello world 1.\n");

// A non 0 return means init_module failed; module can't be loaded.
return 0;
}

void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world 1.\n");
}

use kernel build system

January 3, 2007 - 3:41am

You must use the kernel build system.
Have a look at http://www.captain.at/programming/kernel-2.6/

- Ratnadeep
http://ratnadeep.talk.to

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary