我制作了一个简单的内核模块和一个在讲座中给出的默认 Makefile。
obj-m += module.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[1]: Entering directory '/usr/src/linux-headers-4.15.0-142-generic'
make[2]: *** No rule to make target
'/home/fw/Documents/Workshop_in_Information_Security/module.c', needed by
'/home/fw/Documents/Workshop_in_Information_Security/module.o'. Stop.
Makefile:1584: recipe for target
'_module_/home/fw/Documents/Workshop_in_Information_Security' failed
make[1]: *** [_module_/home/fw/Documents/Workshop_in_Information_Security] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-142-generic'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2
我在 ubuntu 上运行,我的模块中有以下几行
module_init(nf_minifirewall_init_function);
module_exit(my_module_exit_function);
我对这个主题很陌生,所以如果需要更多信息请告诉我。谢谢