Issue : insmod: error inserting 'hello.ko': -1 Invalid module format
可以使用下面的命令 modinfo module.ko 確定module的info
# modinfo hello-4.ko
license: GPL
author: Daniel Chen
descrīption: A sample driver
vermagic: 2.6.35.6-45.fc14.i686 SMP mod_unload 686
license: GPL
author: Daniel Chen
descrīption: A sample driver
vermagic: 2.6.35.6-45.fc14.i686 SMP mod_unload 686
接著# uname –r
確定kernel vermagic.
檢查/usr/src/linux/Makefile,確保下面這些特定的版本資訊與使用的內核完全一致:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 35
EXTRAVERSION = .6-45.fc14.i686
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 35
EXTRAVERSION = .6-45.fc14.i686
最後
不必完全編譯一遍內核,只得到需要的檔即可:
不必完全編譯一遍內核,只得到需要的檔即可:
# make
CHK include/linux/version.h
UPD include/linux/version.h
SYMLINK include/asm -> include/asm-i386
SPLIT include/linux/autoconf.h -> include/config/*
HOSTCC scrīpts/basic/fixdep
HOSTCC scrīpts/basic/split-include
HOSTCC scrīpts/basic/docproc
HOSTCC scrīpts/conmakehash
HOSTCC scrīpts/kallsyms
CC scrīpts/empty.o
...
CHK include/linux/version.h
UPD include/linux/version.h
SYMLINK include/asm -> include/asm-i386
SPLIT include/linux/autoconf.h -> include/config/*
HOSTCC scrīpts/basic/fixdep
HOSTCC scrīpts/basic/split-include
HOSTCC scrīpts/basic/docproc
HOSTCC scrīpts/conmakehash
HOSTCC scrīpts/kallsyms
CC scrīpts/empty.o
...
# insmod XXX.ko 就不會出現該錯誤
沒有留言:
張貼留言