Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Kernel driver modpost missing MODULE_LICENSE

My Linux Kernel driver (platform driver) contains MODULE_LICENSE ("GPL v2");, but during compilation following warning is printed:

make[1]: Entering directory '/home/me/buildroot/output/build/linux-4.15.16'
  LD [M]  /home/me/dir/driver_xy.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: modpost: missing MODULE_LICENSE() in /home/me/dir/driver_xy.o

Whats the problem?

like image 700
bambino307 Avatar asked Mar 26 '26 05:03

bambino307


2 Answers

The Makefile was incorrect: The module name was equal the source file name. So following works:

#Makefile
obj-m += mymodule.o
mymodule-y := mymodule_main.o driver_xy.o

before/incorrect:

obj-m += mymodule.o
mymodule-y := driver_xy.o
like image 140
bambino307 Avatar answered Mar 29 '26 01:03

bambino307


I had to add MODULE_LICENSE("GPL"); at the end of my module.c file and it worked. See also this GitHub issue.

like image 41
user3351953 Avatar answered Mar 29 '26 01:03

user3351953