4

I am trying to compile and insert the r8169 realtek ethernet driver. My kernel version is

ebin@sony:~$ uname -r 4.2.0-rc3-custom 

I have the full source of the same in my local disk, which is used to install the current kernel. The module compiles successfully when I run make -C /lib/modules/uname -r/build M=pwdmodules
but when I insert the module, it shows

ebin@sony:~/linux_testing/linux-stable/drivers/net/ethernet/realtek$ sudo insmod r8169.ko insmod: ERROR: could not insert module r8169.ko: Unknown symbol in module ebin@sony:~/linux_testing/linux-stable/drivers/net/ethernet/realtek$ dmesg [16717.311216] r8169: Unknown symbol mii_ethtool_gset (err 0) 

When I grepped through the source, I found

EXPORT_SYMBOL(mii_ethtool_gset); 

already exported in the mii.c. So I guess it is not the problem of unexported symbol. Let me know if I have to provide any other info. Please help.

6
  • Did you copy the "Module.symvers" into the build directory? Commented Sep 4, 2015 at 9:28
  • @ebin: If mii is compiled as a module, you need to insert it (sudo modprobe mii) before inserting your module. Unlike to modprobe, insmod does not load dependent modules automatically. Commented Sep 4, 2015 at 10:40
  • 1
    @Tsyvarev: I tried after loading the mii module. Now it shows the error ERROR: could not insert module r8169.ko: Invalid parameters dmesg [ 8157.140018] r8169: disagrees about version of symbol mii_ethtool_gset [ 8157.140027] r8169: Unknown symbol mii_ethtool_gset (err -22) Commented Sep 4, 2015 at 18:34
  • @VadimStupakov Thanks a lot. You made my day. It is working now. Could you please explain, why do weplace the Module.Symvers to the build directory?. Because, I think, I have already compiled this module without Module.Symvers file in another machine before Commented Sep 5, 2015 at 8:45
  • 1
    @ebin, I think that this document will be enough for you :) Commented Sep 6, 2015 at 14:35

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.