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

    How to compile kernel module in Fedore core 5?

    I am trying to compile kernel module in Fedora Core 5.
    After installing the kernel source,I tried hello module. But it reports errors.
    * $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
    #include <linux/init.h>
    #include <linux/module.h>

    static int hello_init(void)
    printk("Hello, world\n");
    return 0;

    static void hello_exit(void)
    printk("Goodbye, cruel world\n");

    ////////////// 1, Using gcc compile hello.c directly
    Below is the results:
    [root@localhost kerneldriver]# gcc -c hello.c
    [root@localhost kerneldriver]# insmod ./hello.o
    insmod: error inserting './hello.o': -1 Invalid module format

    ////////////// 2, Using Makefile
    Then I followed Linux device driver 3,the Makefile :
    The Makefile :
    #hello.o: hello.c /usr/include/linux/version.h
    #$(CC) $(MODCFLAGS) -c hello.c
    obj-m := hello.o
    I compiled it like this:
    make -C /usr/src/kernels/2.6.15-1.2054_FC5-i686 M=`pwd` modules
    It reports many errors.
    Any one provide me some hints? Thanks in advance!

  2. #2
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Read this link:

    And I thinkd that you should add a <linux/kernel.h> include


  3. #3
    I followed the guide of failed again.
    There are errors in the source codes of 2.6.15-1.2054_FC5-i686.
    But the codes are provided by FC5..

  4. $spacer_open

Posting Permissions

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