Cannot load 2.4.X module

vercingetorix52_at_yahoo.com
Date: 11/18/05


Date: 18 Nov 2005 09:19:44 -0800

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...



Relevant Pages

  • Re: yet another Forth: vmForth
    ... and MidLevel and HLL all Integrated in the Kernel. ... VM assembler and simulator from within the simulator for testing :-) ... higher level Forth constructs, like jz/jnz, lit, execute, call and jump. ... Compiles VM assembler mnemonics into the VM memory. ...
    (comp.lang.forth)
  • Re: Compile vanilla 2.6.27 using make-kpkg
    ... The kernel compiles correctly using the usual toolchain provided with ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Re: compiling a 2.4 kernel
    ... Each patch is designed to be used against a particular version of the ... You might have an incompatible group of patches. ... patches into a single kernel. ... modconf, failed to detect) but this one as a separate module now compiles, ...
    (Debian-User)
  • (no subject)
    ... your module compiles fine on my box using this method ... > I have tried to compile the hello.c module under kernel 2.6.3. ... > int initial_module (void) ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • RE: Real-Time Preemption: BUG initializing kgdb
    ... The resulting kernel ... > which is not what kgdb wants in order to be happy. ... SA_NODELAY (no need to change more locks, as I'm on a non-SMP target). ... These changes resulted in a kernel which compiles and works fine, ...
    (Linux-Kernel)