Welcome to the Linux Foundation Forum!

Module versions


I started learning kernel module programming. I have few doubts in the below lines found in the internet.

A module compiled for one kernel won't load if you boot a different kernel unless you enable CONFIG_MODVERSIONS in the kernel.

Most stock Linux distro kernels come with modversioning turned on. If you're having trouble loading the modules because of versioning errors, compile a kernel with modversioning turned off.


1. How we can enable CONFIG_MODVERSIONS ? During kernel compilation.

2. Is it possible to change CONFIG_MODVERSIONS for a running kernel.

2. How we can turned on/off modversioning.

3. what is relation between CONFIG_MODVERSIONS and mocversioning.

Can you please clarify my doubts.

Thanks in advance.


  • pkoutoupis
    To answer the first half of your questions, this is a compile time option only. Or that is my understanding of it. To enable it, you would need to modify the .config file of the kernel source that you are either recompiling or obtaining from the kernel.org website.

    When you navigate into the kernel's directory (usually distributions place their kernel source in /usr/src) you can change the .config file manually (if you know what you are doing) or by using menuconfig:
    $ make menuconfig
    If using menuconfig, under "Enable loadable module support --->" you will need to enable, "Module versioning support".


Upcoming Training