If I have a Linux module that was compiled for kernel x, can I expect the compiled module to also work with kernel y or is that generally not the case?
Asked
Active
Viewed 496 times
3
-
5You can't expect anything. it may work if nothing it uses changed in the kernel, it may not, if something did change. It's strictly empirical, nobody can answer this question for you, it's not a generic situation. – Lizardx Aug 31 '17 at 03:37
-
1It depends. Some Linux distributions such as Red Hat support a kABI (Kernel Application Binary Interface.) Others do not. – fpmurphy Aug 31 '17 at 05:42
-
3You generally can't expect it to work, which is why there is dkms. – atype Aug 31 '17 at 07:41
-
1@Lizardx I agree a specific answer would depend on the specific kernel versions, but it’s not “strictly empirical”: there are kernel ABI rules which can be used to determine whether two kernels can share modules (see the RHEL and Debian kernels for examples of this). – Stephen Kitt Sep 06 '17 at 05:16
1 Answers
2
In general, kernel modules are not loaded for other versions.
You can check the module information with the modinfo
command.
The kernel version information of modinfo's vermagic
and uname
commands will help.
But if you really want to, the -f
option of the modprobe
command will help.(modprobe man page)
This option allows you to ignore the version information when you load the kenrel module.
This option is not a panacea.
You should be familiar with the kernel module and kernel version.

DonBit
- 569