error: couldn't find the kernel version the module was compiled for
resolve: #define __KERNEL__
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
error: kernel-module version mismatch hello.o was compiled for kernel version 2.4.20 while this kernel version is 2.4.20-8
resolve :gcc -I/usr/src/linux-2.4.20-8/include -o hello.o -c hello.c
or change file /usr/include/linux/version.h 2.4.20 --> 2.4.20-8
or insmod -f hello.o
reason : gcc is search for include file in directory /usr/ include default

本文介绍了解决Linux内核模块版本不匹配错误的方法。该错误通常发生在尝试加载为不同内核版本编译的模块时。文章提供了具体的解决方案,包括如何重新编译模块或者修改版本文件来适配当前内核。
1083





