Thread: linux kernel module programming

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    10

    linux kernel module programming

    i have some trouble compiling a module.. i'm using kernel 2.6 and am trying to compile the following file named hello.c:
    ----------------------------------------------------------------
    Code:
    #include <linux/module.h>
    #include <linux/kernel.h>
    
    int init_module(void)
    {
            printk("<1>Hello world 1.\n");
            return 0;
    }
    
    void cleanup_module(void)
    {
            printk("Goodbye world 1.\n");
    }
    ----------------------------------------------------------------

    to compile it i'm doing like they say in the kernel source code documentation, i have the following Makefile:
    ----------------------------------------------------------------
    obj-m := hello.o
    ----------------------------------------------------------------
    and use this comando to compile it:
    make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules

    it gives tons of errors, but the first its comlaining about not beeing able to find the module.h file included...

    i tryied to include them specifying a full path but nothing worked...
    anyone has a solution?? i would be very very very thankfull
    Last edited by circuit; 11-29-2004 at 06:36 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linux kernel module programming
    By open_engg in forum Linux Programming
    Replies: 2
    Last Post: 08-05-2007, 04:41 PM
  2. OpenGL on Linux - Kernel Panic
    By psychopath in forum Game Programming
    Replies: 2
    Last Post: 04-15-2006, 04:07 PM
  3. Compiling Linux kernel on Windows
    By jmd15 in forum Linux Programming
    Replies: 9
    Last Post: 04-10-2006, 07:28 AM
  4. Linux kernel not compiling
    By frenchfry164 in forum Tech Board
    Replies: 2
    Last Post: 04-29-2003, 04:10 PM
  5. Function basics
    By sjleonard in forum C++ Programming
    Replies: 15
    Last Post: 11-21-2001, 12:02 PM