Find the answer to your Linux question:
Results 1 to 2 of 2
i am trying to write a simple device driver filename:dd.c #include <linux/module.h> #include<linux/kernel.h> #include<sys/resource.h> #include<signal.h> int init_module (void) /* Loads a module in the kernel */ { printk("Hello kernel n"); ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    7

    missing headers

    i am trying to write a simple device driver

    filename:dd.c

    #include <linux/module.h>
    #include<linux/kernel.h>
    #include<sys/resource.h>
    #include<signal.h>

    int init_module (void) /* Loads a module in the kernel */
    {
    printk("Hello kernel n");
    return 0;
    }

    void cleanup_module(void) /* Removes module from kernel */
    {
    printk("GoodBye Kerneln");
    }



    i compiled it as follows: gcc -c dd.c


    i am getting the following errors:

    In file included from /usr/include/linux/sched.h:16,
    from /usr/include/linux/module.h:9,
    from dd.c:2:
    /usr/include/linux/signal.h:2:2: warning: #warning "You should include <signal.h>. This time I will do it for you."
    In file included from /usr/include/linux/sched.h:79,
    from /usr/include/linux/module.h:9,
    from dd.c:2:
    /usr/include/linux/resource.h:2:2: warning: #warning "You should include <sys/resource.h>. This time I will do it for you."
    In file included from /usr/include/linux/module.h:10,
    from dd.c:2:
    /usr/include/linux/cache.h:5:23: error: asm/cache.h: No such file or directory
    In file included from dd.c:2:
    /usr/include/linux/module.h:41: error: field ‘attr’ has incomplete type
    /usr/include/linux/module.h:49: error: field ‘kobj’ has incomplete type



    please help me out

  2. #2
    Just Joined!
    Join Date
    Jan 2009
    Posts
    7
    i tried the following

    yum -y install gcc gcc-c++ kernel-devel

    but still the problem persists

    i am using 2.6.18-8.el5 redhat enterprise linux

    then i downloaded linux-libc-headers-2.6.12.0.tar.bz2

    i extracted the package and copy pasted the contents of
    linux-libc-headers-2.6.12.0/include/linux to /usr/include/linux

    but still it doesnt work

Posting Permissions

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