内核编译例子(hello),Makefile

来源:互联网 发布:智慧树网络课程注册 编辑:程序博客网 时间:2024/06/05 20:42
#include <linux/module.h>static  int  hello_init(){           printk("<0>hello  world\n");           return 0;}static  void  hello_exit(){           printk("<0>exit");}module_init(hello_init);module_exit(hello_exit);


 Makefile

 

ifneq ($(KERNELRELEASE),)obj-m := hello.oelseKDIR := /lib/modules/$(shell  uname  -r)/buildall:        make -C $(KDIR) M=$(PWD) modulesclean:        rm-f *.ko *.o *.mod.o *.mod.c *.symversendif