I'm writing a kernel module, but am having a little compiling problem. Under Slackware 8 kernel version 2.4.18 this code works:
#define MODULE
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include <linux/module.h>
#include <linux/init.h>
int start(void);
void end(void);
int start(void)
{
printk("<1>Hey!\n"
return 0;
}
void end(void)
{
printk("<1>Bye!\n"
}
module_init(start);
module_exit(end);
Compile: gcc -c file.c
- Execution -
% insmod ./file.o
Hey!
% rmmod file
Bye!
%
Now that exact code doesn't work under Red Hat 7.3 kernel version 2.4.18-3. I get this error message:
% insmod file.o
file.o: kernel-module version mismatch
file.o was compiled for kernel version 2.4.9-9
while this kernel is version 2.4.18-3.
%
Any thoughts? Thanks.
-bitwise
#define MODULE
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include <linux/module.h>
#include <linux/init.h>
int start(void);
void end(void);
int start(void)
{
printk("<1>Hey!\n"
return 0;
}
void end(void)
{
printk("<1>Bye!\n"
}
module_init(start);
module_exit(end);
Compile: gcc -c file.c
- Execution -
% insmod ./file.o
Hey!
% rmmod file
Bye!
%
Now that exact code doesn't work under Red Hat 7.3 kernel version 2.4.18-3. I get this error message:
% insmod file.o
file.o: kernel-module version mismatch
file.o was compiled for kernel version 2.4.9-9
while this kernel is version 2.4.18-3.
%
Any thoughts? Thanks.
-bitwise