Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Hello Module - Compilation creates Modules.symvers

    Hi All,

    I just tried to compile the Hello.c Module as stated in the "Linus Kernel Module Programming Guide" and i'm getting the follwing output.

    linux-toej:/home/raj/program # make
    make -C /lib/modules/ M=/home/raj/program modules
    make[1]: Entering directory `/usr/src/linux-'
    make -C ../../../linux- O=../linux- modules
    Building modules, stage 2.
    make[1]: Leaving directory `/usr/src/linux-'

    Instead of creating hello.ko I have 2 files namely 'Modules.symvers' , '.tmp_versions'

    DIR command is shown below:

    linux-toej:/home/raj/program # dir
    total 8
    -rw-r--r-- 1 root root 190 2006-11-13 19:05 hello.c
    -rw-r--r-- 1 root root 190 2006-11-13 19:12 Makefile
    -rw-r--r-- 1 root root 0 2006-11-13 19:40 Modules.symvers
    drwxr-xr-x 2 root root 48 2006-11-14 19:57 .tmp_versions

    Please help me to compile this module. Seems I messed up something with the Kernel source.

    Thanks a lot,


  2. #2
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Are u using, exactly the same Makefile that the Guide says?
    Do you have your kernel sources properly installed?

    Best Regards

  3. #3
    Here is the code i'm trying to compile.

    #include <linux/module.h> /* Needed by all modules */
    #include <linux/kernel.h> /* Needed for KERN_INFO */
    int init_module(void)
    printk(KERN_INFO "Hello world 1.\n");
    * A non 0 return means init_module failed; module can't be loaded.
    return 0;
    void cleanup_module(void)
    printk(KERN_INFO "Goodbye world 1.\n");

    obj−m += hello-1.o
    make -C /lib/modules/$(shell uname -r)/build M=/home/raj/program modules
    make −C /lib/modules/$(shell uname -r)/build M=/home/raj/program clean


  4. $spacer_open
  5. #4

    2.6 kernel programming

    hey guy ...
    I am using fedora core 6.0 . I am trying to compile a kernel hello world program .. buts its not compiling .. its giving lots of error . Can any one please tell me how to compile a kernel program .
    but the same program is compiling in 2.4 kernel .

    Here is my code ....
    /************************************************** *******************************/
    #define __KERNEL__

    #define MODULE

    #include <linux/kernel.h>
    #include <linux/module.h>
    #include <linux/config.h>


    int int_module()
    printk(KERN_INFO"\n hello world \n");

    void cleanup_module()
    printk(KERN_INFO "\n Goodbye kernel\n");
    /************************************************** *************************************/

    And i am compiling by this command ....

    gcc -c -I /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux hello.c

    Can any one please tell me .whats worng in my progam ....


Posting Permissions

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