hello.c
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)

...{
printk(KERN_ALERT "wellcome to the real world, it sucks! ");
return 0;
}

static void hello_exit(void)

...{
printk(KERN_ALERT "but you're gonna love it ! ");
}

module_init(hello_init);
module_exit(hello_exit);
------------------------------------------------------------------------------------------
Makefile
KERNELDIR =/home/fown/kernel/kernel-2.6.13
PWD := $(shell pwd)

CC =/usr/local/arm/3.4.1/bin/arm-linux-gcc

obj-m := hello.o

modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
-------------------------------------------------------------------------------------
make modules
make -C /home/fown/kernel/kernel-2.6.13 M=/home/fown/ldd/hello modules
make[1]: Entering directory `/home/fown/kernel/kernel-2.6.13'
WARNING: Symbol version dump /home/fown/kernel/kernel-2.6.13/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/fown/ldd/hello/hello.o
Building modules, stage 2.
MODPOST
CC /home/fown/ldd/hello/hello.mod.o
LD [M] /home/fown/ldd/hello/hello.ko
make[1]: Leaving directory `/home/fown/kernel/kernel-2.6.13'
--------------------------------------------------------------------------------------
2440
--------------------------------------------------------------------------------------
[root@FriendlyARM /]# insmod hello.ko
wellcome to the real world, it sucks!
[root@FriendlyARM /]# lsmod
Module Size Used by
hello 1120 0 - Live 0xbf000000
[root@FriendlyARM /]# rmmod hello
but you're gonna love it !



















------------------------------------------------------------------------------------------
Makefile












-------------------------------------------------------------------------------------
make modules
make -C /home/fown/kernel/kernel-2.6.13 M=/home/fown/ldd/hello modules
make[1]: Entering directory `/home/fown/kernel/kernel-2.6.13'
WARNING: Symbol version dump /home/fown/kernel/kernel-2.6.13/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/fown/ldd/hello/hello.o
Building modules, stage 2.
MODPOST
CC /home/fown/ldd/hello/hello.mod.o
LD [M] /home/fown/ldd/hello/hello.ko
make[1]: Leaving directory `/home/fown/kernel/kernel-2.6.13'
--------------------------------------------------------------------------------------
2440
--------------------------------------------------------------------------------------
[root@FriendlyARM /]# insmod hello.ko
wellcome to the real world, it sucks!
[root@FriendlyARM /]# lsmod
Module Size Used by
hello 1120 0 - Live 0xbf000000
[root@FriendlyARM /]# rmmod hello
but you're gonna love it !