我将按照3.1任务1中的步骤进行操作。A:实现一个简单的内核模块:https://seedsecuritylabs.org/Labs_20.04/Files/Firewall/Firewall.pdf在我运行make命令之前一切都很好。hello.ko文件没有生成,我不知道出了什么问题。
make -C /lib/modules/5.11.0-38-generic/build M=/home/seed/Downloads/Labsetup/Files/kernel_module modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-38-generic'
CC [M] /home/seed/Downloads/Labsetup/Files/kernel_module/hello.o
MODPOST /home/seed/Downloads/Labsetup/Files/kernel_module/Module.symvers
ERROR: modpost: missing MODULE_LICENSE() in /home/seed/Downloads/Labsetup/Files/kernel_module/hello.o
make[2]: *** [scripts/Makefile.modpost:124: /home/seed/Downloads/Labsetup/Files/kernel_module/Module.symvers] Error 1
make[2]: *** Deleting file '/home/seed/Downloads/Labsetup/Files/kernel_module/Module.symvers'
make[1]: *** [Makefile:1753: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-38-generic'
make: *** [Makefile:4: all] Error 2
ERROR: modpost: missing MODULE_LICENSE() in /home/seed/Downloads/Labsetup/Files/kernel_module/hello.o
您必须在hello.c
中添加许可证。
例如
MODULE_LICENSE("GPL");