kernel modules

A

alice

hi all,
First of all I would apologize in case this the wrong group for
posting this article.
I'm trying to write small Linux kernel modules.I compile them with the
following command

gcc -c test.c

which produces the file test.o

Now when I tries to load the module using insmod command it gives the
following error
message-

test.o: kernel-module version mismatch
test.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.20-8(custom)


Id tried to disable the version support from my kernel by compiling it
as follows-
Id marked Y for the kernel module version
information(CONFIG_MODCONVERSIONS).

However,Im not sure that whether the new Kernel which I'd booted
really does have the
version information disabled as it is also giving the same error on
using the insmod
command.

Here is the file test.c:

#include<linux/config.h>
#if defined(CONFIG_MODCONVERSIONS) && !defined(MODVERSIONS)
# define MODVERSIONS
#endif


#ifdef MODVERSIONS
# include <linux/modversions.h>
#endif


#define MODULE
#include<linux/module.h>

int init_module(void){
printk("this is a test\n");
return 0;
}

void cleanup_module(void){
printk("bye!\n");
return ;
}
 
J

Jens.Toerring

alice said:
First of all I would apologize in case this the wrong group for
posting this article.
I'm trying to write small Linux kernel modules.I compile them with the
following command
gcc -c test.c
which produces the file test.o

Sorry, but you're really wrong here, Linux kernel modules aren't
really something you can do with standard C and the special magic
required to compile them is even more off-topic here. Please take
this to e.g. comp.os.linux.development.system where it's exactly
on-topic.
Regards, Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top