Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compiling a very simple module

Status
Not open for further replies.

bitwise

Programmer
Mar 15, 2001
269
US
I know this is a border line post for this forum b/c it's more of a programming problem, but there are a lot of smart people here so I wanted to post it here as well...thanks. 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(&quot;<1>Hey!\n&quot;);
return 0;
}

void end(void)
{
printk(&quot;<1>Bye!\n&quot;);
}

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top