'Raspberry pi kernel module disagrees about version of symbol layout, although complied against running kernel
I created the simplest external kernel module for my Raspberry PI as a test:
#include <linux/module.h>
#include <linux/kernel.h>
int hello_init(void) {
printk("Hello World");
return 0;
}
void hello_exit(void) {
printk("Goodbye World!");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
I complied it successfully with the following line:
sudo make -C /lib/modules/$(uname -r)/build M=$PWD modules
I tried to use sudo insmod hello.ko, and got the following error:
insmod: ERROR: could not insert module hello.ko: Invalid module format
And following this error in dmesg:
hello: disagrees about version of symbol module_layout
I've read everything there is to read about this error online. All the research has yielded the assumption that this is caused by compiling the module against a kernel which differs from the running kernel in either version or configuration.
However, this is absolutely not my case. The running kernel was loaded by the distribution and was not changed by me (Raspberry PI 3). Moreover, inspection of the kernel's other modules and hello.ko (using modinfo) is yielding the exact same vermagic and flags, which are:
vermagic: 5.15.33-v8+ SMP preempt mod_unload modversions aarch64
Since all online material originates this fault in version difference, I'm at a lost.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
