将内核模块添加到ubuntu

时间:2018-05-01 09:09:12

标签: c module linux-kernel

Makefile代码:

obj-m += hello.o

all:    
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

遇到的错误:

make -C /lib/modules/4.4.0-31-generic/build M=/home/fast modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-31-generic'
make[2]: *** No rule to make target '/home/fast/hello.c', needed by 
'/home/fast/hello.o'.  Stop.
Makefile:1403: recipe for target '_module_/home/fast' failed
make[1]: *** [_module_/home/fast] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-31-generic'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

我没有得到这些错误。 如果需要,我可以上传内核线程代码。任何类型的帮助将不胜感激!

0 个答案:

没有答案