Find the answer to your Linux question:
Results 1 to 3 of 3
i am trying to compile the following program named dd.c: #include <module.h> #include<kernel.h> #include<mod_devicetable.h> #include<moduleparam.h> #include<moduleloader.h> int init_module (void) /* Loads a module in the kernel */ { printk("Hello kernel ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    7

    urgent ! program compiling errors

    i am trying to compile the following program named dd.c:


    #include <module.h>
    #include<kernel.h>
    #include<mod_devicetable.h>
    #include<moduleparam.h>
    #include<moduleloader.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 am getting the following errors:

    In file included from /usr/include/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/module.h:41: error: field ‘attr’ has incomplete type
    /usr/include/module.h:42: error: expected specifier-qualifier-list before ‘ssize_t’
    /usr/include/module.h:49: error: field ‘kobj’ has incomplete type
    /usr/include/module.h: In function ‘search_module_extables’:
    /usr/include/module.h:433: error: ‘NULL’ undeclared (first use in this function)
    /usr/include/module.h:433: error: (Each undeclared identifier is reported only once
    /usr/include/module.h:433: error: for each function it appears in.)
    /usr/include/module.h: In function ‘module_text_address’:
    /usr/include/module.h:439: error: ‘NULL’ undeclared (first use in this function)
    /usr/include/module.h: In function ‘__module_text_address’:
    /usr/include/module.h:445: error: ‘NULL’ undeclared (first use in this function)
    /usr/include/module.h: In function ‘module_address_lookup’:
    /usr/include/module.h:476: error: ‘NULL’ undeclared (first use in this function)
    /usr/include/module.h: In function ‘module_get_kallsym’:
    /usr/include/module.h:484: error: ‘NULL’ undeclared (first use in this function)
    In file included from dd.c:6:
    /usr/include/moduleloader.h: At top level:
    /usr/include/moduleloader.h:11: error: expected ‘)’ before ‘*’ token
    /usr/include/moduleloader.h:25: error: expected ‘)’ before ‘*’ token
    /usr/include/moduleloader.h:33: error: expected ‘)’ before ‘*’ token
    /usr/include/moduleloader.h:40: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token


    have tried installing all sorts of kernel-devel pakages but nothing seems to work
    i cannot understand that module.h being such a common file why is it not being properly recognised ...........i am stuck with this problem for over a week now........kindly guide me.........

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    try #include <linux/module.h>
    and #include <linux/kernel.h>

    if this doesn't work could you post your makefile..Thanks Gerard4143

    Just curiosity...what so urgent about a "hello world" kernel module....

  3. #3
    Super Moderator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,144
    Quote Originally Posted by gerard4143 View Post
    Just curiosity...what so urgent about a "hello world" kernel module....
    I'm curious too, what's the purpose of a "hello world" kernel module?
    Last edited by MikeTbob; 01-28-2009 at 03:08 PM.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

Posting Permissions

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