1 # standards
      2 INCLUDE         = /usr/src/linux/include
      3 CC              = gcc
      4 CFLAGS          = -D__KERNEL__ -I$(INCLUDE) -DMODULE -Wall -O2
      5
      6 TARGET  = hello
      7 SRC     = hello.c
      8
      9 all: $(TARGET).o
     10
     11 clean:
     12         rm -f *.o *~ core
~
1 /*
      2  *      Hello world module.
      3  */
      4 #include <linux/module.h>
      5
      6 #if defined(CONFIG_SMP)
      7 #define __SMP__
      8 #endif
      9
     10 #if defined(CONFIG_MODVERSIONS)
     11 #define MODVERSIONS
     12 #include <linux/modversions.h>
     13 #endif
     14
     15 #include <linux/kernel.h>
     16
     17 int init_module(void)
     18 {
     19         printk( "<1>Hello, kernel!\n");
     20         return 0;
     21 }
     22
     23 void cleanup_module(void)
     24 {
     25         printk("<1>Good-bye, kernel!\n");
     26 }
     36