How to make sure .ko are correct?

Hi,

I'm try to build kernel module on openwrt. So, I enable M on kernel part and enable * at openwrt.
When I try to insert module, show undefine symbol. So, I go back to kernel part, the ko include the symbol, but build_dir/stage_dir did not have the symbol.

$ grep -re cfg80211_connect_bss package/bbb/sdk/linux-4.9/net/wireless/cfg80211.ko build_dir/target-aarch64-linux-gnu_glibc/root-xxx/lib/modules/4.9.76-openwrt/cfg80211.ko staging_dir/target-aarch64-linux-gnu_glibc/root-xxx/lib/modules/4.9.76-openwrt/cfg80211.ko 
Binary file package/bbb/sdk/linux-4.9/net/wireless/cfg80211.ko matches

Looks like the cfg80211.ko are different, why? How do I fix/copy correct .ko to rootfs?
Please help. Thanks.

Are you following the instructions from this page? Did you flash the device with the image you build or just try to copy over the corresponding .ko file?

Hi darksky,

Yes, I followed the instructions of openwrt guide line.
Yes, I do flash the device with my build image, ko miss one symbol.
The symbol I can find it at linux/kernel folder, not at stage_dir/build_dir.
I do copy any ko from my changes. I just enable * at openwrt and M at kernel part.
Can you help me how to make sure ko is from kernel? Thanks.

Double check the cfg80211.ko, looks like the ko come from backports-4.19.120-1.
So, it we want to porting new wifi driver, does it be need to adapt to backports-4.19.120-1?
Any document would be great to teach me how to porting new wifi driver. Thanks.

Wireless drivers must be built against the corresponding backports (aka mac80211) package, which would be v5.7-rc3 based in master at the moment.

So, Should I disable cfg80211 at kernel part, only enable cfg80211 at openwrt part? I think wifi driver will refer the backport, right? Thanks.

Now, I face the problem.

[  237.738204] cywdhd: Unknown symbol cfg80211_connect_bss (err 0)
[  237.745016] cywdhd: Unknown symbol __ieee80211_get_channel (err 0)

Double check the link, looks like kernel module still link the cfg80211 function from kernel.
How do I change the include/link path to compat-wireless? Thanks.

Hi All,

I fix the issue of unknow symbol by

KBUILD_EXTRA_SYMBOLS:="${STAGING_DIR}/pkginfo/mac80211.symvers"
NOSTDINC_FLAGS:=\
       -I$(STAGING_DIR)/usr/include/mac80211 \
       -I$(STAGING_DIR)/usr/include/mac80211/uapi \
       -I$(STAGING_DIR)/usr/include/mac80211-backport \
       -include backport/backport.h

Thanks.