Why does compiling module from source fails with "ERROR: modpost: missing MODULE_LICENSE()" on RHEL9?

Solution Verified - Updated -

Issue

  • Why does compiling module from source fails with "ERROR: modpost: missing MODULE_LICENSE()" on RHEL9?
# make -C /lib/modules/$(uname -r)/build M=/root/testmodule modules
make: Entering directory '/usr/src/kernels/5.14.0-1.3.1.el9.x86_64'
CC [M] /root/testmodule/test.o
MODPOST /root/testmodule/Module.symvers
ERROR: modpost: missing MODULE_LICENSE() in /root/testmodule/test.o
make[1]: * [scripts/Makefile.modpost:150: /root/testmodule/Module.symvers] Error 1
make[1]: * Deleting file '/root/testmodule/Module.symvers'
make: * [Makefile:1776: modules] Error 2
make: Leaving directory '/usr/src/kernels/5.14.0-1.3.1.el9.x86_64'

Environment

  • Red Hat Enterprise Linux 9.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content