How to generate Module.symvers?

The Module.symvers is (re)generated when you (re)compile modules. Run make modules, and you should get a Module.symvers file at the root of the kernel tree.

Note that if you only ran make and not make modules, you haven't built any modules yet. The symbols from the kernel itself (vmlinux or one of the architecture-dependent image formats) are in System.map.


for people who found this question by googling the warning you get when compiling one of Derek Molloy's sample LKMs: you can simply make an empty one with touch Modules.symvers. if your kernel doesn't use modversions (CRCs used by the operating system to help assure the modules match the kernel) and your module doesn't have any dependencies on other modules, this will be good enough to suppress the warning.

WARNING: Symbol version dump ./Module.symvers
         is missing; modules will have no dependencies and modversions.

the empty file is just as good as the one generated by gcc, which just has the symbols all with the same 0x00000000 CRC value, on a system without modversions.


On CentOS, and maybe other RedHat variants, just extract the corresponding file for your running kernel:

zcat /boot/symvers-$(uname -r).gz > ./Module.symvers

On Ubuntu and maybe other Debian variants, the file seams to be found automatically. However, if you need it, the file is here:

/usr/src/linux-headers-$(uname -r)/Module.symvers