#include linux/init.h
#include linux/module.h
static int hello_init(void)
{
printk(KERN_ALERT "hello word\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "bye bye\n");
}
module_init(hello_init);
module_exit(hello_exit);
ifneq ($(KERNELRELEASE),)
obj-m:=hello.o
else
#KERNELDIR ?=/home/ker/kernel/sy1/linux-source-4.8.0/
KERNELDIR ?=/lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
endif
阅读(1254) | 评论(0) | 转发(0) |