I am attempting to include a driver for the FC20 WiFi module from Quectel as part of my OpenWrt build. I have the package configured as shown below.
# Copyright (C) 2019 EWSI
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=fc2x
PKG_VERSION:=1.0
PKG_RELEASE:=1
SOURCE_DIR:=/workspaces/test_user/quectel-fc2x-driver
include $(INCLUDE_DIR)/package.mk
define KernelPackage/fc2x
SECTION:=custom
CATEGORY:=Custom
VERSION:=$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)
TITLE:=Driver for fc2x wifi module
FILES:=$(PKG_BUILD_DIR)/drivers/qcacld-new/wlan.$(LINUX_KMOD_SUFFIX)
DEPENDS:=+hostapd +kmod-cfg80211 +kmod-rfkill +kmod-ath6kl-sdio
KCONFIG:= \
CONFIG_HOSTAP=y \
CONFIG_WIRELESS_EXT=y \
CONFIG_WEXT_PRIV=y \
CONFIG_NL80211_TESTMODE=y \
CONFIG_CFG80211_WEXT=y \
CONFIG_CFG80211_INTERNAL_REGDB=y \
CONFIG_CFG80211_REG_DEBUG=y \
CONFIG_RFKILL_INPUT=y \
CONFIG_RFKILL_REGULATOR=y \
CONFIG_RFKILL_GPIO=y \
AUTOLOAD:=$(call AutoProbe,fc2x)
endef
MAKE_FLAGS += \
KERNELARCH="$(LINUX_KARCH)" \
KERNELPATH="/lib/modules/$(LINUX_VERSION)/build" \
KERNEL_SRC="$(LINUX_DIR)" \
INSTALL_ROOT="$(LINUX_DIR)"
define Build/Prepare
cp $(SOURCE_DIR)/drivers $(PKG_BUILD_DIR) -r
$(Build/Patch)
endef
define Build/Compile
$(MAKE) \
-C $(PKG_BUILD_DIR)/drivers \
$(MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/drivers/qcalcld-new"
endef
$(eval $(call KernelPackage,fc2x))
For reference the driver has the structure of
DRIVER ROOT
..... | ----- drivers
................ | ---- Makefile
................ | ---- qcacld-new
.......................... |----- CORE
.......................... |----- Kconfig
.......................... |----- KBuild
.......................... |----- Makefile
Calling the Makefile that is a child of the 'drivers' folder configures environment variables and calls the qcalcld-new Makefile.
When I build the driver, it fails with the following:
ERROR: modpost: "cfg80211_assoc_timeout" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "cfg80211_rx_mgmt_khz" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "cfg80211_mgmt_tx_status" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "cfg80211_tdls_oper_request" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "__cfg80211_alloc_reply_skb" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "cfg80211_new_sta" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "cfg80211_inform_bss_frame_data" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "regulatory_hint" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "ieee80211_channel_to_freq_khz" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
ERROR: modpost: "cfg80211_unlink_bss" [/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/wlan.ko] undefined!
WARNING: modpost: suppressed 30 unresolved symbol warnings because there were too many)
make[6]: *** [scripts/Makefile.modpost:133: /workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/Module.symvers] Error 1
make[6]: *** Deleting file '/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new/Module.symvers'
make[5]: *** [Makefile:1827: modules] Error 2
make[5]: Leaving directory '/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/linux-5.15.134'
make[4]: *** [Makefile:29: all] Error 2
make[4]: Leaving directory '/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers/qcacld-new'
make[3]: *** [Makefile:79: qcacld_build] Error 2
make[3]: Leaving directory '/workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/drivers'
make[2]: *** [Makefile:78: /workspaces/test_user/openwrt/build_dir/target-arm_cortex-a5+vfpv3_musl_eabi/linux-wlsom_sama5/fc2x-1.0/.built] Error 2
make[2]: Leaving directory '/workspaces/test_user/wlsom_packages/fc2x'
time: package/feeds/wlsom_packages/fc2x/compile#376.11#38.18#31.91
ERROR: package/feeds/wlsom_packages/fc2x failed to build.
make[1]: *** [package/Makefile:120: package/feeds/wlsom_packages/fc2x/compile] Error 1
make[1]: Leaving directory '/workspaces/test_user/openwrt'
make: *** [/workspaces/test_user/openwrt/include/toplevel.mk:232: package/fc2x/compile] Error 2
All of these symbols are exported in the cfg80211 source code (or other files) so I know the problem is not that the export statements don't exist. I think my drivers aren't able to find the header files for cfg80211 (and others).
I'm sure that the problem is related to my KernelPackage configuration but I'm new enough to all this that I haven't been able to figure out what.