Skip to content

Kernel Version and vermagic

vermagic is module metadata used by the kernel to check whether a kernel module was built for a compatible kernel configuration.

It is one of the most common failure points when building out-of-tree kernel modules.

Basic Checks

On the target:

uname -r

On the module:

modinfo -F vermagic mydriver.ko

The module vermagic must be compatible with the running target kernel.

Why It Fails

Common causes:

  • kernel release mismatch
  • different CONFIG_LOCALVERSION
  • different compiler or architecture setting
  • copied headers do not match the running kernel
  • symbol versioning mismatch
  • building against generic headers instead of Raspberry Pi headers

Example Failure Pattern

invalid module format

or:

disagrees about version of symbol

Practical Debug Checklist

  1. Check target kernel version:
uname -r
  1. Check module metadata:
modinfo mydriver.ko
  1. Check module architecture:
file mydriver.ko
  1. Confirm KDIR points to the target kernel headers.

  2. Rebuild the module after cleaning old build artifacts.

Raspberry Pi Notes

Raspberry Pi kernels may include board-specific suffixes and configuration details. When copying headers to a host build machine, keep the header tree consistent with the exact target kernel release.