Linux Kernel driver modpost missing MODULE_LICENSE

Viewed 8436

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?

1 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
Related