Find the answer to your Linux question:
Results 1 to 5 of 5
hi all: i followed the <The Linux Kernel Module Programming Guide>, and wrote a module hello-1.c: Code: #include <linux/module.h> #include <linux/kernel.h> int init_module&#40;void&#41; &#123; printk&#40;"<1>Hello world 1.\n"&#41;; return 0; &#125; ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2005
    Posts
    3

    no previous prototype for `init_module'


    hi all:
    i followed the <The Linux Kernel Module Programming Guide>, and wrote a module hello-1.c:
    Code:
    #include <linux/module.h>
    #include <linux/kernel.h>
    
    int init_module&#40;void&#41;
    &#123;
            printk&#40;"<1>Hello world 1.\n"&#41;;
    
            return 0;
    &#125;
    
    void cleanup_module&#40;void&#41;
    &#123;
            printk&#40;KERN_ALERT "Goodbye world 1.\n"&#41;;
    &#125;
    meanwhile i built a makefile:
    Code:
    TARGET  &#58;= hello-1
    WARN    &#58;= -W -Wall -Wstrict-prototypes -Wmissing-prototypes
    INCLUDE &#58;= -isystem /lib/modules/`uname -r`/build/include
    CFLAGS  &#58;= -O2 -DMODULE -D__KERNEL__ $&#123;WARN&#125; $&#123;INCLUDE&#125;
    CC      &#58;= gcc
    
    $&#123;TARGET&#125;.o&#58; $&#123;TARGET&#125;.c
    but, when i executed the make command, i have gotten these:
    Code:
    hello-1.c&#58;5&#58; warning&#58; no previous prototype for `init_module'
    hello-1.c&#58;12&#58; warning&#58; no previous prototype for `cleanup_module'
    /lib/modules/2.4.20-8/build/include/asm/processor.h&#58; In function `copy_segments'&#58;
    /lib/modules/2.4.20-8/build/include/asm/processor.h&#58;456&#58; warning&#58; unused parameter `p'
    /lib/modules/2.4.20-8/build/include/asm/processor.h&#58;456&#58; warning&#58; unused parameter `mm'
    /lib/modules/2.4.20-8/build/include/asm/processor.h&#58; In function `release_segments'&#58;
    /lib/modules/2.4.20-8/build/include/asm/processor.h&#58;457&#58; warning&#58; unused parameter `mm'
    /lib/modules/2.4.20-8/build/include/linux/prefetch.h&#58; In function `prefetch'&#58;
    /lib/modules/2.4.20-8/build/include/linux/prefetch.h&#58;43&#58; warning&#58; unused parameter `x'
    /lib/modules/2.4.20-8/build/include/linux/prefetch.h&#58; In function `prefetchw'&#58;
    /lib/modules/2.4.20-8/build/include/linux/prefetch.h&#58;48&#58; warning&#58; unused parameter `x'
    what is wrong with it? who would tell me? many thanks!!!

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    I see no errors, only warnings...So what's the big deal?

  3. #3
    Just Joined!
    Join Date
    Dec 2005
    Posts
    3
    Quote Originally Posted by lakerdonald
    I see no errors, only warnings...So what's the big deal?
    yes, there were only warnings.

  4. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    So what's the probrlem?

  5. #5
    Just Joined!
    Join Date
    Dec 2005
    Posts
    3
    Quote Originally Posted by lakerdonald
    So what's the probrlem?
    sorry, i could not point it out. would you tell me the reason?

Posting Permissions

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