[X]关闭

自己写的驱动在make的时候报error

文档创建者:jenny
浏览次数:4431
最后更新:2019-07-15
(1)我自己写了一个字符型驱动,在make的时候报如下的错误。
osrc@osrc:~/jenny20190715/driver_app20181129/driver_app/drv_code/reader$ ls
built-in.o  Makefile  reader_drv.c
osrc@osrc:~/jenny20190715/driver_app20181129/driver_app/drv_code/reader$ make
make -C /home/osrc/jenny20190715/osrc-lab-701A/sources/kernel M=`pwd` modules
make[1]: Entering directory '/home/osrc/jenny20190715/osrc-lab-701A/sources/kernel'
make[2]: *** No rule to make target '/home/osrc/jenny20190715/driver_app20181129/driver_app/drv_code/reader/reader_dev.c', needed by '/home/osrc/jenny20190715/driver_app20181129/driver_app/drv_code/reader/reader_dev.o'.  Stop.
Makefile:1503: recipe for target '_module_/home/osrc/jenny20190715/driver_app20181129/driver_app/drv_code/reader' failed
make[1]: *** [_module_/home/osrc/jenny20190715/driver_app20181129/driver_app/drv_code/reader] Error 2
make[1]: Leaving directory '/home/osrc/jenny20190715/osrc-lab-701A/sources/kernel'
Makefile:11: recipe for target 'all' failed
make: *** [all] Error 2


(2)我的Makefile是如下内容:

ifneq ($(KERNELRELEASE),)

#param-objs := file1.o file1.o
obj-m := reader_dev.o

else

KERN_DIR = /home/osrc/jenny20190715/osrc-lab-701A/sources/kernel

all:
        make -C $(KERN_DIR) M=`pwd` modules

clean:
        make -C $(KERN_DIR) M=`pwd` modules clean
        rm -rf modules.order

endif


(3)我自己写的字符驱动文件是reader_drv.c,是申明为MODULE_LICENSE("GPL v2");

请问我这个error的原因会是什么呢?有什么推荐解决的办法吗?谢谢。


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则