Unknown Symbol in While Loading a Kernel Module

Unknown symbol in while loading a kernel module

I have solved this problem as suggested on this forum:

  1. Compiled scst.
  2. 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).
  3. Copied the scst to /lib/modules/<version>/extra.
  4. depmod -a.
  5. Compiled lpfc_scst.
  6. Inserted module lpfc_scst with no problems.

Have a nice day.

Unknown symbol when loading a kernel module

This may actually be related to the module license! If you look at the kernel source code, the function power_supply_get_by_name is exported here. You can see it's using EXPORT_SYMBOL_GPL. As this answer explains:

EXPORT_SYMBOL_GPL will show the symbol only in GPL-licensed modules

The use of this macro is controversial, but that's the way the project operates... To gain access to the symbols you need, you'll need to license your module as GPL:

MODULE_LICENSE("GPL");

insmod fails with “Unknown symbol in module”

That's an easy one. Near the top are these:

WARNING: "STUB_stop_elevator" [/home/lukas/Desktop/COP4610-Operating-Systems-Project-2-master/elevator/elevator.ko] undefined!
WARNING: "STUB_issue_request" [/home/lukas/Desktop/COP4610-Operating-Systems-Project-2-master/elevator/elevator.ko] undefined!
WARNING: "STUB_start_elevator" [/home/lukas/Desktop/COP4610-Operating-Systems-Project-2-master/elevator/elevator.ko] undefined!

Your module will not load due to the undefined symbols. Once those are resolved when building, module loading should work better. It looks like your link is using only 1 object file. Though I don't have access to confirm, try adjusting your Makefile to list all object files; it could be that obj-m is incomplete and should list the same files as those with obj-y.

If you run into other undefined symbols while loading the module and they're external to your module, there's probably a dependency issue. For that case, copy your module to /lib/modules/...... and try loading with modprobe

Unknown symbol in module on module insertion despite EXPORT_SYMBOL

As Vadim Stupakov said in the comment, Putting the Module.symvers file in the module source directory fixed my issue. From this documentation

Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used
as a simple ABI consistency check. A CRC value of the full prototype
for an exported symbol is created. When a module is loaded/used, the
CRC values contained in the kernel are compared with similar values in
the module. if they are not equal, the kernel refuses to load the
module.
Module.symvers contains a list of all exported symbols from a kernel
build.

As per my understanding, Module.symvers is created on make modules. I missed out that file. When I put the appropriate Module.symvers in the module build directory, the module works as I expected without any errors.

Unknown symbol from kernel module (dm9601 driver), does this require a rebuild of the kernel?

First check, if the symbols are part of kernel symbols list,

for ex: cat /proc/kallsyms | grep mii_link_ok

If symbols are not present, then those symbols need to be exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL().

If symbols are present try one of the below,

  1. Include **KBUILD_EXTRA_SYMBOLS=<"absolute path to the Module.symvers of the kernel module which is exporting function or variable"> in the Makefile of the kernel module which will use exported function or variable, in your case dm9601 Makefile.

for ex: KBUILD_EXTRA_SYMBOLS := absolute_path_to_Module.symvers_of_mii

EXPORT_SYMBOL in kernel module | undefined symbol during insmod


  1. List item

Unknown symbol in while loading a kernel module

Hope this will solve the issue!.



Related Topics



Leave a reply



Submit