Cannot load 2.4.X module

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
It's been a while since I've done this so it's possible I'm doing
something silly, but I've been Googling for hours and haven't yet found
a solution.

The target system is an x86 PC104 running a stripped-down RedHat.
Here's what I get for version info on the PC104...

bash-2.05# uname -a
Linux localhost 2.4.18 #1 Wed Jun 19 14:33:06 MDT 2002 i486 unknown

The development machine is running Debian Etch.  I downloaded the
2.4.18 linux kernel sources to the development computer and extracted
them in /usr/src/.  Then I threw together the following bare-bones
kernel module called mymodule.c...

-----------------------------------------------------------------------------------------------------
#ifndef __KERNEL__
#define __KERNEL__
#define MODULE
#include <linux/kernel.h>
#include <linux/module.h>

int init_module(void)
{
    printk("<1>Hello, World\n");
    return 0;
}

void cleanup_module(void)
{
    printk("<1>Goodbye!\n");
}

#endif
-----------------------------------------------------------------------------------------------------

This code compiles without complaint using the following command...

 gcc -Wall -O2 -D__KERNEL__ -DMODULE -I/usr/src/linux/include -c
mymodule.c

...but when I try to load this on the target system, I get this...

bash-2.05# /sbin/insmod mymodule.o
mymodule.o: couldn't find the kernel version the module was compiled
for
bash-2.05# /sbin/insmod -f mymodule.o
mymodule.o: couldn't find the kernel version the module was compiled
for

Can anyone tell me what I'm doing wrong?  Thanks in advance...


Re: Cannot load 2.4.X module
Did you figure this out?

It looks like your defining __KERNEL__ in your gcc line and you have an
#ifndef surrounding your code... Looks like it will be empty...

Good luck.


Site Timeline