Cannot load 2.4.X module - Embedded

This is a discussion on Cannot load 2.4.X module - Embedded ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Cannot load 2.4.X module

  1. Cannot load 2.4.X module

    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
    #include

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


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


+ Reply to Thread