kernel modules

Discussion in 'C Programming' started by alice, Dec 3, 2004.

  1. alice

    alice Guest

    hi all,
    First of all I would apologize in case this the wrong group for
    posting this article.
    I'm trying to write small Linux kernel modules.I compile them with the
    following command

    gcc -c test.c

    which produces the file test.o

    Now when I tries to load the module using insmod command it gives the
    following error
    message-

    test.o: kernel-module version mismatch
    test.o was compiled for kernel version 2.4.20
    while this kernel is version 2.4.20-8(custom)


    Id tried to disable the version support from my kernel by compiling it
    as follows-
    Id marked Y for the kernel module version
    information(CONFIG_MODCONVERSIONS).

    However,Im not sure that whether the new Kernel which I'd booted
    really does have the
    version information disabled as it is also giving the same error on
    using the insmod
    command.

    Here is the file test.c:

    #include<linux/config.h>
    #if defined(CONFIG_MODCONVERSIONS) && !defined(MODVERSIONS)
    # define MODVERSIONS
    #endif


    #ifdef MODVERSIONS
    # include <linux/modversions.h>
    #endif


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

    int init_module(void){
    printk("this is a test\n");
    return 0;
    }

    void cleanup_module(void){
    printk("bye!\n");
    return ;
    }
     
    alice, Dec 3, 2004
    #1
    1. Advertisements

  2. alice

    -berlin.de Guest

    alice <> wrote:
    > First of all I would apologize in case this the wrong group for
    > posting this article.
    > I'm trying to write small Linux kernel modules.I compile them with the
    > following command


    > gcc -c test.c


    > which produces the file test.o


    Sorry, but you're really wrong here, Linux kernel modules aren't
    really something you can do with standard C and the special magic
    required to compile them is even more off-topic here. Please take
    this to e.g. comp.os.linux.development.system where it's exactly
    on-topic.
    Regards, Jens
    --
    \ Jens Thoms Toerring ___ -berlin.de
    \__________________________ http://www.toerring.de
     
    -berlin.de, Dec 3, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Remy Cool
    Replies:
    1
    Views:
    550
    Remy Cool
    Aug 27, 2003
  2. Tobiah
    Replies:
    2
    Views:
    417
    Tobiah
    Sep 14, 2003
  3. Ben Weintraub

    Disabling modules using Modules/Setup

    Ben Weintraub, Sep 9, 2006, in forum: Python
    Replies:
    0
    Views:
    468
    Ben Weintraub
    Sep 9, 2006
  4. yogesh
    Replies:
    3
    Views:
    779
    Kenny McCormack
    Feb 12, 2006
  5. Thomas Ploch
    Replies:
    2
    Views:
    1,043
    Laurent Pointal
    Mar 7, 2007
  6. InuY4sha

    Kernel modules syntaxes

    InuY4sha, Apr 9, 2008, in forum: C Programming
    Replies:
    1
    Views:
    470
    Antoninus Twink
    Apr 9, 2008
  7. Replies:
    3
    Views:
    353
  8. Lars Gierth
    Replies:
    6
    Views:
    473
    David Masover
    Mar 20, 2010
Loading...