一般出错信息被记录在文件/var/log/messages中
# cat /var/log/messages |tail
通过命令看一下模块的相关信息
[root@hailiang tmp]# modinfo helloworld.ko
filename: helloworld.ko
alias: a simplest module
description: A simple helloworld module
author: zhanghailiang
depends:
vermagic: 2.6.27.5-117.fc10.i686 SMP mod_unload modversions 686 4KSTACKS
内核无法加载模块的原因是因为记载版本号的字符串和当前正在运行的内核模块的不一样,这个版本印戳作为一个静态的字符串存在于内核模块中
就是当前运行的内核与模块的内核不一致,将makefile的路径修改成当前模块的build即可
modprobe会自动在/lib/modules/'uname -r'下寻找模块加载,将helloworld.ko拷到/lib/modules 下然后再执命令 modprobe helloworld 发现还是找不到,从man modprobe
modprobe expects an up-to-date modules.dep file, as generated by depmod (see depmod(8))
看出还需要依赖命令:depmod生成的module.dep 使用这个命令后 在modprobe helloworld 成功
findcode sell program.