Chinaunix首页 | 论坛 | 博客
  • 博客访问: 402001
  • 博文数量: 124
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 872
  • 用 户 组: 普通用户
  • 注册时间: 2018-03-29 14:38
个人简介

默默的一块石头

文章分类

全部博文(124)

文章存档

2022年(26)

2021年(10)

2020年(28)

2019年(60)

我的朋友

分类: LINUX

2019-10-22 15:27:13

#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
阅读(1207) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~