Home > Enterprise >  SeedLabs Firewall Lab: Implement a Simple Kernel Module, failure to build a kernel module
SeedLabs Firewall Lab: Implement a Simple Kernel Module, failure to build a kernel module

Time:11-12

I'm following the steps from here at 3.1 Task 1.A: Implement a Simple Kernel Module: https://seedsecuritylabs.org/Labs_20.04/Files/Firewall/Firewall.pdf Everything was fine until I ran the make command. the hello.ko file wasn't generated and I don't know what's wrong.

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

CodePudding user response:

ERROR: modpost: missing MODULE_LICENSE() in /home/seed/Downloads/Labsetup/Files/kernel_module/hello.o

You must add the license in hello.c.

e.g.

MODULE_LICENSE("GPL");
  • Related