Search code examples
modulelinux-kernelwifiyocto

Why are CFG80211 symbols missing when loading a kernel module?


I have been given wireless driver which I have integrated in my Yocto project. The .config that the kernel is using has the following flag set:

CONFIG_CFG80211=m

This should compile the kernel with CFG80211 as a module. However, when I try to load MY_MODULE with this command:

insmod MY_MODULE.ko fw_name=mrvl/MY_MODULE.bin cfg80211_wext=0xf cal_data_cfg=none fw_serial=0

The module fails to load with:

insmod: ERROR: could not insert module MY_MODULE.ko: Unknown symbol in module

The reason of the failure is that CFG80211 symbols are not present when loading the module. This can be seen when running dmesg:

[ 1534.508504] sd8xxx: Unknown symbol mlan_main_process (err 0)
[ 1534.508560] sd8xxx: Unknown symbol cfg80211_sched_scan_results (err 0)
[ 1534.508704] sd8xxx: Unknown symbol cfg80211_rx_assoc_resp (err 0)
[ 1534.508847] sd8xxx: Unknown symbol cfg80211_scan_done (err 0)
[ 1534.508911] sd8xxx: Unknown symbol cfg80211_sched_scan_stopped (err 0)
[ 1534.508948] sd8xxx: Unknown symbol mlan_shutdown_fw (err 0)
[ 1534.509037] sd8xxx: Unknown symbol mlan_rx_process (err 0)
[ 1534.509064] sd8xxx: Unknown symbol cfg80211_remain_on_channel_expired (err 0)
[ 1534.509077] sd8xxx: Unknown symbol cfg80211_cac_event (err 0)
...

I tried to manually load the CFG80211 module but it is not present in the lib/modules/3.14.55-yocto-standard/kernel/net folder. Currently available modules in those folder are:

./kernel/net/wireless
./kernel/net/wireless/lib80211_crypt_tkip.ko
./kernel/net/wireless/lib80211_crypt_ccmp.ko
./kernel/net/wireless/lib80211.ko
./kernel/net/wireless/lib80211_crypt_wep.ko

Why are CFG80211 symbols missing when loading a kernel module? Should I have a loadable 80211.ko or I am missing something else?


Solution

  • Yocto does not ship kernel modules by default. You can include all kernel modules in your image by adding kernel-modules package. This is usually done within MACHINE_EXTRA_RRECOMMENDS or MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS in your machine conf file, so that people can say they actually don't want all kernel modules (it can take a lot of storage space).

    If you want to include this module, its name is probably kernel-cfg80211 (you can find out by using oe-pkgdata-util find-path cfg80211.ko). Since it's needed for another module, I'd add it to MACHINE_EXTRA_RDEPENDS or MACHINE_ESSENTIAL_EXTRA_RDEPENDS still in your machine conf file.

    You cannot realistically add it to the RDEPENDS of your other kernel module recipe because it would break your build if someone were to compile 80211 support directly in the kernel and not as a module. Other solution is to use RRECOMMENDS in the module recipe or put it where your kernel module package is added to the image (in the image recipe or wherever it's added).