mymodule.c
#include <linux/init.h>
#include <linux/module.h>
static int __init hello_init(void)
{
printk(KERN_ALERT "Hello!\n");
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_ALERT "Goodbye\n");
}
module_init(hello_init);
module_exit(hello_exit);
/* Module information */
MODULE_AUTHOR("xx");
MODULE_DESCRIPTION("dongle driver.");
MODULE_LICENSE("GPL");
Makefile
ifneq ( $(KERNELRELEASE), )
obj-m := mymod.o
mymod-objs := mymodule.o
else
KERNELDIR ?= ./arm-linux-2.6.31
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules ARCH=mips CROSS_COMPILE=arm-linux-
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
rm -rf Module.* modules.*
.PHONY: default clean
endif