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
  • rajez79
    New Member
    • Oct 2006
    • 4

    #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

    Hi ,

    i tried in redhat 9.

    give this command for compilation

    gcc -D__KERNEL__ -I/usr/src/<linux kernel for wat u r compiling>/include -O -Wall -c <filename.c>

    then

    insmod <filename.o>

    try this...

    rgds
    jack

    Comment

    • prometheuzz
      Recognized Expert New Member
      • Apr 2007
      • 197

      #3
      Moved this thread from the articles section to the forum.

      Comment

      Working...