0

This is for a router running kernel version 2.6.21.5.

I am using the official (netgear) source tree and toolchain.

I have compiled the dm9601.c driver (from the source tree) using the toolchain, but after inserting the module dmesg prints:

dm9601: Unknown symbol mii_link_ok
dm9601: Unknown symbol bitrev32
dm9601: Unknown symbol mii_check_media
dm9601: Unknown symbol usbnet_get_settings
dm9601: Unknown symbol crc32_le
dm9601: Unknown symbol mii_nway_restart
dm9601: Unknown symbol usbnet_nway_reset
dm9601: Unknown symbol generic_mii_ioctl
dm9601: Unknown symbol usbnet_set_settings
dm9601: Unknown symbol mii_ethtool_gset

Referencing (it seems)

./lib/crc32.c
./lib/bitrev.c
./drivers/net/mii.c
./drivers/usb/net/usbnet.c

Is there some way to tell if these missing dependencies requires a rebuild of the kernel. Or can I load them with the driver?

Makefile:

obj-m += dm9601.o

all:
        make -C /home/chris/DGND3300_V1.1.00.41_NA_src M=$(PWD) modules

clean:
        make -C /home/chris/DGND3300_V1.1.00.41_NA_src M=$(PWD) clean

Make command:

make ARCH=mips CROSS_COMPILE="/home/chris/EVG2000_v2.2.0.12_with_toolchain_src/uclibc-crosstools-gcc-4.2.3-3/usr/bin/mips-linux-uclibc-"

Updated Makefile with missing modules:

obj-m += crc32.o
obj-m += bitrev.o
obj-m += mii.o
obj-m += usbnet.o
obj-m += dm9601.o

all:
        make -C /home/chris/messabout3/DGND3300_V1.1.00.41_NA_src/kernel/linux M=$(PWD) modules

clean:
        make -C /home/chris/messabout3/DGND3300_V1.1.00.41_NA_src/kernel/linux M=$(PWD) clean
chris.fy
  • 177
  • 1
  • 12
  • Some of these symbols use EXPORT_SYMBOL_GPL(). If your driver is not declared to be GPL, then this could be the problem for not finding the symbols. – Peter L. Apr 26 '16 at 20:34
  • Hi Peter! I just checked the code and it comes inside the Linux kernel source tree and is labelled GPL. I'll have to keep on thinking about this I guess – chris.fy Apr 26 '16 at 22:54
  • You missed to show how exactly you run compilation of the driver. – 0andriy Apr 27 '16 at 09:36
  • Hi Andy! You are totally right. I am shamefully inexperienced, and I have added the Makefile + make command. – chris.fy Apr 27 '16 at 10:10

1 Answers1

0

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!.

Jeyaram
  • 9,158
  • 7
  • 41
  • 63
Gautham Kantharaju
  • 1,735
  • 1
  • 21
  • 24
  • Hi Gautham, thanks for your answer. I have just checked, and there is no /proc/kallsyms on the filesystem. I am now in the process of trying to find out what this means – chris.fy Apr 27 '16 at 10:49
  • Hi Chris, /proc/kallsyms shows list of exported kernel symbols. – Gautham Kantharaju Apr 27 '16 at 16:09
  • So without a kallsyms file, does this mean there are no exported symbols? – chris.fy Apr 27 '16 at 17:49
  • I have also managed to compile the modules with the missing symbols in the makefile ( updated at the end of the question). This means there are no errors when adding the driver module. Is this the correct method? – chris.fy Apr 27 '16 at 17:49
  • Chris, when building dm9601 kernel module, were you getting "Warning: Symbol version dump /Modules.symvers is missing; modules will have no dependencies and modversions.". If so, then Module.symvers file was missing. Best solution would be to build the kernel so that Module.symvers will be created and symbols exported will be seen under /proc/kallsyms. After this build dm9601 driver and insert the dm9601 kernel module. – Gautham Kantharaju Apr 28 '16 at 04:40
  • Should not add missing modules in Makefile. – Gautham Kantharaju Apr 28 '16 at 04:44
  • Module.symvers is in the kernel directory and I haven't received any warning when compiling the module, could the missing /proc/kallsyms be due to an old kernel version? It is 2.6 – chris.fy Apr 28 '16 at 11:10
  • Also may I ask what bad things may happen by adding the missing modules in the module Makefile? – chris.fy Apr 28 '16 at 11:11
  • Right way is to check ".config" file in linux directory whether missing module are enabled are not. If not enabled, enable them via "make ARCH=mips menuconfig" command. These missing modules, can either build as built-in or loadable kernel module. If built as loadable kernel module (LKM), insert dependency modules before dm9601 module. – Gautham Kantharaju Apr 29 '16 at 02:50