LINUX Modules

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinot85
    New Member
    • Aug 2007
    • 53

    LINUX Modules

    I have worked with this program of inserting a module to LINUX Kernel.
    /*hellomodule.c*/
    #define MODULE

    int init_module(voi d){
    printk("<1>Hell o Module\n");
    return 0;
    }

    void cleanup_module( void){
    printk("<1>Good bye\n");
    }

    I compiled the program with command

    root# gcc -c hellomodule.c

    I got the ouput file as hellomodule.o

    And i failed in using the command,

    root# insmod ./hellomodule.o

    It is showing an error,

    The file is not in module format and No module formats.

    Whether we have any specific directories to put this modules?
    How can i successfully install a module to the kernel?
    Im using REDHAT EL - 4
  • svlsr2000
    Recognized Expert New Member
    • Feb 2007
    • 181

    #2
    Originally posted by vinot85
    I have worked with this program of inserting a module to LINUX Kernel.
    /*hellomodule.c*/
    #define MODULE

    int init_module(voi d){
    printk("<1>Hell o Module\n");
    return 0;
    }

    void cleanup_module( void){
    printk("<1>Good bye\n");
    }

    I compiled the program with command

    root# gcc -c hellomodule.c

    I got the ouput file as hellomodule.o

    And i failed in using the command,

    root# insmod ./hellomodule.o

    It is showing an error,

    The file is not in module format and No module formats.

    Whether we have any specific directories to put this modules?
    How can i successfully install a module to the kernel?
    Im using REDHAT EL - 4
    Can you post the kernel version your are using.
    Can you post the output of this command
    $ Uname -r
    If you are using kenel 2.6 this is not the way to build modules.
    Have a look at understanding linux device drivers book for more details of building the mofule. In 2.6.x kernels module linkage is done by kernel and it would be something like hello.ko and not hello.o

    Comment

    Working...