=============以下为源程序============
#include <linux/init.h>
#include <linux/module.h>MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk("Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk("Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
===========以下为Makefile==============
obj-m := helloworld.o
KERNELDIR ?= /root/linux-2.6.33
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f Module.symvers
~
~