linuxopenwrtbackport

OpenWRT backported ath11k can't find backported dependencies at build time


I am attempting to backport ath11k support for kernel 5.4 on OpenWRT 21.02 (updating is outside my control). I am specifically after the ath11k_pci module which has dependencies on hwmon, qmi_helpers, mhi, and qrtr. So far I've managed to achieve the following:

Once I've selected the kmod options added to menuconfig, the kernel_menuconfig is called and compiles the toolchain. It applies the patches I've made to enable the subsets of CONFIG_QMI_HELPERS and CONFIG_QRTR, then I just set them as =y. Note: the backported kernel modules do not show up as options in the kernel_menuconfig.

Finally I call make V=s and after a couple of minutes or so I get the following error:

Package kmod-ath11k is missing dependencies for the following libraries:
mhi.ko

When I find for the module, I can see it compiled successfully and it is located under the backports directory for my target: .../backports-5.15.74-1/drivers/bus/mhi/core/mhi.ko

So my issue is that kmod-ath11k fails to compile because it can't find mhi.ko when it clearly gets compiled. I have specified the kmod to explicitly depend on the aforementioned kmods but it still fails and I cannot determine where else this dependency has to be registered.


This is the current ath11k definition under package/kernel/mac8021/ath.mk

define KernelPackage/ath11k
  $(call KernelPackage/mac80211/Default)
  TITLE:=Qualcomm 802.11ax wireless chipset support
  URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath11k
  DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT \
            +kmod-crypto-michael-mic +kmod-qrtr-mhi +kmod-mhi-bus +kmod-mhi-net
  FILES:= \
    $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k.ko \
    $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k_pci.ko
  AUTOLOAD:=$(call AutoProbe,ath11k ath11k_pci)
endef

this is the mhi-bus definition under package/kernel/linux/modules/other.mk

define KernelPackage/mhi-bus
  SUBMENU:=$(OTHER_MENU)
  TITLE:=Modem Host Interface (MHI) bus and PCI driver
  KCONFIG:=CONFIG_MHI_BUS=y \
           CONFIG_MHI_BUS_PCI_GENERIC \
           CONFIG_MHI_BUS_DEBUG=y
  FILES:=$(LINUX_DIR)/drivers/bus/mhi/mhi_pci_generic.ko \
         $(LINUX_DIR)/drivers/bus/mhi/core/mhi.ko
  AUTOLOAD:=$(call AutoProbe,mhi mhi_pci_generic)
endef

define KernelPackage/mhi-bus/description
  Kernel modules for the Qualcoom MHI bus.
endef

$(eval $(call KernelPackage,mhi-bus))

definition for qrtr under package/kernel/linux/modules/netsupport.mk

define KernelPackage/qrtr
  SUBMENU:=$(NETWORK_SUPPORT_MENU)
  TITLE:=Qualcomm IPC Router support
  KCONFIG:=CONFIG_QRTR
  FILES:= \
  $(LINUX_DIR)/net/qrtr/qrtr.ko
  AUTOLOAD:=$(call AutoProbe,qrtr)
endef

define KernelPackage/qrtr/description
 Qualcomm IPC Router support
endef

$(eval $(call KernelPackage,qrtr))

define KernelPackage/qrtr-tun
  SUBMENU:=$(NETWORK_SUPPORT_MENU)
  TITLE:=TUN device for Qualcomm IPC Router
  DEPENDS:=+kmod-qrtr
  KCONFIG:=CONFIG_QRTR_TUN
  FILES:= $(LINUX_DIR)/net/qrtr/qrtr-tun.ko
  AUTOLOAD:=$(call AutoProbe,qrtr-tun)
endef

define KernelPackage/qrtr-tun/description
 TUN device for Qualcomm IPC Router
endef

$(eval $(call KernelPackage,qrtr-tun))

define KernelPackage/qrtr-smd
  SUBMENU:=$(NETWORK_SUPPORT_MENU)
  TITLE:=SMD IPC Router channels
  DEPENDS:=+kmod-qrtr @TARGET_ipq807x
  KCONFIG:=CONFIG_QRTR_SMD
  FILES:= $(LINUX_DIR)/net/qrtr/qrtr-smd.ko
  AUTOLOAD:=$(call AutoProbe,qrtr-smd)
endef

define KernelPackage/qrtr-smd/description
 SMD IPC Router channels
endef

$(eval $(call KernelPackage,qrtr-smd))

define KernelPackage/qrtr-mhi
  SUBMENU:=$(NETWORK_SUPPORT_MENU)
  TITLE:=MHI IPC Router channels
  DEPENDS:=+kmod-mhi-bus +kmod-qrtr
  KCONFIG:=CONFIG_QRTR_MHI
  FILES:= $(LINUX_DIR)/net/qrtr/qrtr-mhi.ko
  AUTOLOAD:=$(call AutoProbe,qrtr-mhi)
endef

define KernelPackage/qrtr-mhi/description
 MHI IPC Router channels
endef

$(eval $(call KernelPackage,qrtr-mhi))

and definition for mhi-net under package/kernel/linux/modules/netdevices.mk

define KernelPackage/mhi-net
  SUBMENU:=$(NETWORK_DEVICES_MENU)
  TITLE:=MHI Network Device
  DEPENDS:=@PCI_SUPPORT +kmod-mhi-bus
  KCONFIG:=CONFIG_MHI_NET
  FILES:=$(LINUX_DIR)/drivers/net/mhi_net.ko
  AUTOLOAD:=$(call AutoProbe,mhi_net)
endef

define KernelPackage/mhi-net/description
  Driver for MHI network interface
endef

$(eval $(call KernelPackage,mhi-net))

define KernelPackage/wwan
  SUBMENU:=$(NETWORK_DEVICES_MENU)
  TITLE:=WWAN Driver Core
  DEPENDS:=@PCI_SUPPORT
  KCONFIG:=CONFIG_WWAN
  FILES:=$(LINUX_DIR)/drivers/net/wwan/wwan.ko
  AUTOLOAD:=$(call AutoProbe,wwan)
endef

define KernelPackage/wwan/description
  The WWAN core driver provides a common framework for WWAN drivers.
endef

$(eval $(call KernelPackage,wwan))

define KernelPackage/mhi-wwan-ctrl
  SUBMENU:=$(NETWORK_DEVICES_MENU)
  TITLE:=MHI WWAN control driver for QCOM-based PCIe modems
  DEPENDS:=@PCI_SUPPORT +kmod-wwan +kmod-mhi-net
  KCONFIG:=CONFIG_MHI_WWAN_CTRL
  FILES:=$(LINUX_DIR)/drivers/net/wwan/mhi_wwan_ctrl.ko
  AUTOLOAD:=$(call AutoProbe,mhi_wwan_ctrl)
endef

define KernelPackage/mhi-wwan-ctrl/description
  MHI WWAN CTRL allows QCOM-based PCIe modems to expose different modem
  control protocols/ports to userspace, including AT, MBIM, QMI, DIAG
  and FIREHOSE. These protocols can be accessed directly from userspace
  (e.g. AT commands) or via libraries/tools (e.g. libmbim, libqmi,
  libqcdm...).
endef

$(eval $(call KernelPackage,mhi-wwan-ctrl))

define KernelPackage/mhi-wwan-mbim
  SUBMENU:=$(NETWORK_DEVICES_MENU)
  TITLE:=MHI WWAN MBIM network driver for QCOM-based PCIe modems
  DEPENDS:=@PCI_SUPPORT +kmod-wwan +kmod-mhi-net
  KCONFIG:=CONFIG_MHI_WWAN_MBIM
  FILES:=$(LINUX_DIR)/drivers/net/wwan/mhi_wwan_mbim.ko
  AUTOLOAD:=$(call AutoProbe,mhi_wwan_mbim)
endef

define KernelPackage/mhi-wwan-mbim/description
  MHI WWAN MBIM is a WWAN network driver for QCOM-based PCIe modems.
  It implements MBIM over MHI, for IP data aggregation and muxing.
  A default wwan0 network interface is created for MBIM data session
  ID 0. Additional links can be created via wwan rtnetlink type.
endef

$(eval $(call KernelPackage,mhi-wwan-mbim))

Solution

  • So after some trial and error I gained some understanding of my implementation and was able to fix my issue.

    First of all, I had to understand my specific case, where I'm backporting 5.15 modules onto a 5.4 kernel toolchain. The kmod options I added to the main menuconfig (with the exception of ath11k) are directly dealing with the options offered by the toolchain kernel (5.4) and not the bakcport kernel modules (5.15), and since those were not present in this specific kernel version I would get the error I stated in my original post. Thanks to stark for pointing me to this patch

    In addition to this, if I set CONFIG_QMI_HELPERS or CONFIG_HWMON to =m instead =y in the toolchain kernel, the backport build mechanism wouldn't be able to see the .ko files because those were in a different directory from where the backport process is happening.

    At this point I realized I was compiling a frankestein ath11k with intertwined 5.4 and 5.15 dependecies, fortunately checking the modules offered by the backports made me realize a lot of the dependencies are also backported too, so I figured out how to point the the ath11k to these in ath.mk and get as many dependencies as possible from the backports. So in turn I got rid of all the other additions I made to the other .mk files and used this definition for KernelPackage/ath11k

    define KernelPackage/ath11k
      $(call KernelPackage/mac80211/Default)
      TITLE:=Qualcomm 802.11ax wireless chipset support
      URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath11k
      DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT \
            +kmod-crypto-michael-mic
      FILES:= \
        $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k.ko \
        $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k_pci.ko \
        $(PKG_BUILD_DIR)/drivers/bus/mhi/core/mhi.ko \
        $(PKG_BUILD_DIR)/net/qrtr/qrtr.ko \
        $(PKG_BUILD_DIR)/net/qrtr/ns.ko \
        $(PKG_BUILD_DIR)/net/qrtr/qrtr-mhi.ko \
        $(PKG_BUILD_DIR)/drivers/soc/qcom/qmi_helpers.ko
      AUTOLOAD:=$(call AutoProbe,ath11k ath11k_pci)
    endef
    
    define KernelPackage/ath11k/description
    This module adds support for Qualcomm Technologies 802.11ax family of
    chipsets.
    endef
    

    Note: I also had to set CONFIG_HWMON=y in my toolchain kernel to workaround the issue mentioned above.

    Apologies if what I state here is erroneous in some way, this is the first time I've ever dealt with backports on OpenWRT, but definitively let me know if anything I said here can be corrected/improved :D