Find the answer to your Linux question:
Results 1 to 3 of 3
The following program was compiled in REDHAT Fedora-Linux. #define MODULE #include <linux/module.h> int init_module(void) { printk("<1>Hello World\n"); return 0; } void cleanup_module(void) { printk("<1>GoodBye World 1.\n"); } On compiling the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2006
    Posts
    1

    Arrow Problem In Compiling "hello World " Module


    The following program was compiled in REDHAT Fedora-Linux.

    #define MODULE
    #include <linux/module.h>


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

    return 0;
    }

    void cleanup_module(void)
    {
    printk("<1>GoodBye World 1.\n");
    }


    On compiling the program,the error is as follows.

    [root@localhost dd]# gcc -c hello2.c

    [root@localhost dd]# insmod ./hello.o
    ./hello.o: kernel-module version mismatch
    ./hello.o was compiled for kernel version 2.4.20
    while this kernel is version 2.4.22-1.2115.nptl.

    Can anyone provide me a solution to solve the above problem.To know the kernel version, the folowing command may help u.

    [root@localhost root]# uname -a
    Linux localhost.localdomain 2.4.22-1.2115.nptl #1 Wed Oct 29 15:42:51 EST 2003 i 686 i686 i386 GNU/Linux

  2. #2
    Just Joined! tb10alj's Avatar
    Join Date
    Feb 2006
    Location
    Germany
    Posts
    31
    Quote Originally Posted by sharanu
    The following program was compiled in REDHAT Fedora-Linux.
    Can anyone provide me a solution to solve the above problem.To know the kernel version, the folowing command may help u.
    Ahhh,
    looks like the hello-word-example from Oreilly's Linux Device Driver book

    Try to add
    Code:
    -I /path/to/kernelsource/include
    when compiling the module. I also strongly recommend to use the -Wall option,
    when compilig kernel code.

    Another solution is to build and run your own kernel
    (without version support)


    regards,
    JAN

  3. #3
    Just Joined!
    Join Date
    Jan 2006
    Location
    India
    Posts
    52
    Hi,

    Which kernel version source code you have, and what is the kernel version of the running image.
    If it happens to be like you are running the 2.4.20 kernel version and trying to compile your module with the other kernel version source code then you are in trouble.

    Let me know if you have any problems.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •