编译iscsi_trgt内核模块后,加载模块失败,提示“Invalid module format“,通过dmesg看到内核打印“no symbol version for struct_module“。
[root@xenserver-chen iscsitarget-1.4.20.2]# insmod /root/iscsitarget-1.4.20.2/kernel/iscsi_trgt.ko
insmod: error inserting ‘/root/iscsitarget-1.4.20.2/kernel/iscsi_trgt.ko’: -1 Invalid module format
[root@xenserver-chen iscsitarget-1.4.20.2]# dmesg
iscsi_trgt: no symbol version for struct_module
[root@xenserver-chen iscsitarget-1.4.20.2]#
使用modinfo查看iscsi_trgt模块vermagic与系统其它模块一致,同时编译模块时指向的内核源码目录、内核.config配置文件均与当前内核版本相同。多次编译,加载还是失败。
进入内核源码目录,发现少了文件Module.symvers ,重新编译内核源码make vmlinuz后,生成Module.symvers文件。再次编译iscsi_trgt内核模块,加载成功。问题得到解决。
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# uname -a
Linux xenserver-chen 2.6.27.42-0.1.1.xs5.6.0.44.111158xen #1 SMP Mon May 3 21:26:51 EDT 2010 i686 i686 i386 GNU/Linux
[root@xenserver-flashcache kernel]# modinfo iscsi_trgt.ko
filename: iscsi_trgt.ko
author: IET development team <iscsitarget-devel@lists.sourceforge.net>
description: iSCSI Enterprise Target
license: GPL
version: 1.4.20.2
srcversion: 76916E3D2185ACF4ADDB096
depends:
vermagic: 2.6.27.42-0.1.1.xs5.6.0.44.111158xen SMP mod_unload modversions Xen 686
parm: worker_thread_pool_size:Size of the worker thread pool (0 = dedicated threads per target (default)) (ulong)
parm: debug_enable_flags:debug bitmask, low bits (0 … 8) used, see iscsi_dbg.h (ulong)
[root@xenserver-flashcache kernel]# modinfo ext3
filename: /lib/modules/2.6.27.42-0.1.1.xs5.6.0.44.111158xen/kernel/fs/ext3/ext3.ko
license: GPL
description: Second Extended Filesystem with journaling extensions
author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts’o and others
srcversion: B4BED432A5A321B81F293D7
depends: jbd
supported: yes
vermagic: 2.6.27.42-0.1.1.xs5.6.0.44.111158xen SMP mod_unload modversions Xen 686
[root@xenserver-flashcache kernel]#
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# ls
arch buildconfigs crypto firmware init kdb MAINTAINERS modules.order README scripts usr
block COPYING Documentation fs ipc kernel Makefile net REPORTING-BUGS security virt
build CREDITS drivers include Kbuild lib mm perfmon samples sound
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]#
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# cp /boot/config-2.6.27.42-0.1.1.xs5.6.0.44.111158xen .config
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# make vmlinuz -j16
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# ls
arch COPYING drivers init kernel mm perfmon scripts usr
block CREDITS firmware ipc lib modules.order README security virt
build crypto fs Kbuild MAINTAINERS Module.symvers REPORTING-BUGS sound vmlinux
buildconfigs Documentation include kdb Makefile net samples System.map vmlinux.o
[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]#
Leave a Reply