问题
I need help understanding why I get an error when I insert a module. I have tried this with no success.
$ sudo modprobe lpfc_scst
FATAL: Error inserting lpfc_scst (/lib/modules/2.6.32-33-generic/extra/lpfc_scst.ko): Unknown symbol in module, or unknown parameter (see dmesg)
$ dmesg | tail
[ 1201.262842] lpfc_scst: Unknown symbol scst_register_target
[ 1201.262949] lpfc_scst: Unknown symbol lpfc_tm_term
[ 1201.263161] lpfc_scst: no symbol version for scst_register_session
[ 1201.263164] lpfc_scst: Unknown symbol scst_register_session
[ 1201.263284] lpfc_scst: no symbol version for scst_rx_mgmt_fn
[ 1201.263286] lpfc_scst: Unknown symbol scst_rx_mgmt_fn
[ 1201.263395] lpfc_scst: no symbol version for scst_unregister_session
[ 1201.263398] lpfc_scst: Unknown symbol scst_unregister_session
[ 1201.263573] lpfc_scst: no symbol version for scst_rx_data
[ 1201.263575] lpfc_scst: Unknown symbol scst_rx_data
$ cat /proc/kallsyms | grep scst_register_target
dffd2a10 r __ksymtab_scst_register_target [scst]
dffd302e r __kstrtab_scst_register_target [scst]
dffd2b34 r __kcrctab_scst_register_target [scst]
dffd2a20 r __ksymtab___scst_register_target_template_non_gpl [scst]
dffd3063 r __kstrtab___scst_register_target_template_non_gpl [scst]
dffd2b3c r __kcrctab___scst_register_target_template_non_gpl [scst]
dffd2c10 r __ksymtab___scst_register_target_template [scst]
dffd308b r __kstrtab___scst_register_target_template [scst]
dffd2de8 r __kcrctab___scst_register_target_template [scst]
dff913a0 t __scst_register_target_template [scst]
dff90dd0 T scst_register_target [scst]
dff91840 T __scst_register_target_template_non_gpl [scst]
$
Many thanks.
回答1:
I have solved this problem as suggested on this forum:
- Compiled
scst
. - Appended the generated
Module.symvers
to existent/lib/modules/<version>/build/Module.symvers
(Hack. Do not know why the kernel did not see the exported symbols). - Copied the
scst
to/lib/modules/<version>/extra
. depmod -a
.- Compiled
lpfc_scst
. - Inserted module
lpfc_scst
with no problems.
Have a nice day.
回答2:
If you are trying to insmod a module that was build against a kernel source tree/headers that are not the actual source of the running kernel, the most likely cause is that some kernel configuration is different between the running kernel and the one you built the module against.
The linker inside the Linux kernel actually looks at a bunch of things besides the symbol name for matching symbols, including possibly a hash of the function parameter and return value, various config option (preempt / non preempt) when trying to match symbol names. I guess that in your case it does not find the right match due to different config options
回答3:
This means that the kernel isn't allowing modules to see that variable. It does look like you haven't added your variables to the list of symbols that the kernel exports:
EXPORT_SYMBOL_NOVERS(scst_register_target);
来源:https://stackoverflow.com/questions/7513184/unknown-symbol-in-while-loading-a-kernel-module