关于最简单的驱动的makefile

kanwolf 2010-09-23 07:37:17
我自己按照参考写了个最简单的驱动,可是makefile提示Nothing to be done for `modules'.
驱动和makefile如下:
hello.c:
1 #include<linux/module.h>
2 #include<linux/kernel.h>
3 #include<linux/init.h>
4
5 MODULE_LICENCE("Dual BSD/GPL");
6
7 static int hello_init(void)
8 {
9 printk(KERN_INFO "hello world\n");
10 return 0;
11 }
12
13 static void hello_exit(void)
14 {
15 printk(KERN_INFO "goodbye hello\n");
16 }
17
18 module_init(hello_init);
19 module_exit(hello_exit);

makefile:
1 obj-m := hello.o
2 KERNELDIR := /lib/modules/2.6.32-21-generic/bulid
3 PWD := $(shell pwd)
4
5 modules:
6 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
7
8 modules_install:
9 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

做了一段时间的应用以后驱动的问题有些遗忘~该如何处理?


...全文
121 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kanwolf 2010-09-25
  • 打赏
  • 举报
回复
谢谢大家了
mypwb 2010-09-24
  • 打赏
  • 举报
回复
下面就是一个简单的makefile
ifneq ($(KERNELRELEASE),)

obj-m :=hello.o

else
KDIR:= /lib/modules/`uname -r`/build

all:
make -C $(KDIR) M=$(PWD) modules
clean:
rm -f *.ko *.o *.mod.c *.symvers

endif
Linux-Torvalds 2010-09-23
  • 打赏
  • 举报
回复
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
else
KERNELDIR ?= /lib/modules/($shell uname -r)/build
PWD ?= $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
goodmrning 2010-09-23
  • 打赏
  • 举报
回复
ding!
DIE654456 2010-09-23
  • 打赏
  • 举报
回复
makefile:
1 obj-m := hello.o
2 KERNELDIR := /lib/modules/2.6.32-21-generic/bulid
3 PWD := $(shell pwd)
4
5 modules:
6 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
7
8 modules_install:
9 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install


这俩的使用$(MAKE)换成别的?
gcc -DMODULE
kanwolf 2010-09-23
  • 打赏
  • 举报
回复
~~~

4,465

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧