How to install a Linux network driver not available in OpenWrt packages?

A few months ago I installed OpenWrt x86_64 on an HPE ProLiant ML110 Gen10, and everything has been working great. Subsequently, we bought a 10GbE adapter compatible with this machine, but unfortunately OpenWrt could not use this adapter. The adapter can be found as HPE 2-Port 10GbE 535T Adapter and its network processor is Broadcom BCM57416. It is worth noting that I made sure to plug the network adapter into the correct PCIe slot (PCIe Gen3 x8).

Since OpenWrt is based on Linux, I looked to see if Linux supports the network adapter and found that it does, so the appropriate driver for the adapter is bnxt. However, using the kmod-ikconfig package I found that the Linux kernel of my OpenWrt was not configured to have that driver. In desperation I tried to install the available drivers that most closely resembled it (kmod-bnx2 and kmod-bnx2x), but this was useless.

OpenWrt version: OpenWrt 22.03.2 r19803-9a599fee93
Linux kernel version: 5.10.146

On this page I found the driver compatible with the Linux kernel version, but I don't know what to do with that information. This network adapter isn't that cheap and we can't return it anymore, could someone please help me to get it working? I will greatly appreciate any help.

Someone will have to package up the bnxt kernel module, look through the git history for similar module additions for examples, e.g.:

Especially for x86_64 hardware, this shouldn't be too difficult to get working.

2 Likes

Thank you very much for responding and for sharing this information.
I have several questions about it:

  1. Assuming I manage to define a kernel package for bnxt (in a similar way as the commit you shared with me), will I have to wait until the next release of OpenWrt to be able to use it?
  2. If the answer to the above question is yes, is there a faster way to install a network driver?
  3. I would like to have the ability to define a kernel package for bnxt, so that other people can use it, but I'm honestly not sure how to properly set the attributes or definition parameters. Is there any documentation you can share with me on how to do this, please?
  1. if you want to download the binary package from OpenWrt, yes.
  2. yes, build it from source (which you will have to do for the development anyways, as there's no other way to test your package (and there's more than one config symbol to set).
  3. once submitted and merged into OpenWrt master, it will become part of the master branch and built into daily snapshots - anyone can also opt to build from source (a backport to the following 22.03.x point release might be viable, if you can convince an OpenWrt developer to take the patch)
1 Like

Hello again, slh.
Again, thank you for your valuable help.
Having carefully researched the kernel configurations and dependencies needed by bnxt, I followed your recommendation and defined a kernel package for the driver:

define KernelPackage/bnxt
  SUBMENU:=$(NETWORK_DEVICES_MENU)
  TITLE:=Broadcom NetXtreme-C/E support
  DEPENDS:=@PCI_SUPPORT +kmod-lib-crc32c +kmod-hwmon-core
  FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnxt/bnxt_en.ko
  KCONFIG:= \
  CONFIG_BNXT \
  CONFIG_BNXT_SRIOV=y \
  CONFIG_BNXT_FLOWER_OFFLOAD=y \
  CONFIG_BNXT_HWMON=y
  AUTOLOAD:=$(call AutoProbe,bnxt)
endef

define KernelPackage/bnxt/description
  This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit Ethernet cards.
endef

$(eval $(call KernelPackage,bnxt))

Subsequently, based on the official guide and using the official build config of my OpenWrt version/target, I compiled OpenWrt from scratch. The compilation was successful and I got the kmod-bnxt_5.10.146-1_x86_64.ipk package (you can't imagine my joy), however, unfortunately I can't install it on my router (even though I compiled the same OpenWrt version and the resulting Linux kernel version is the same):

root@router-2:~# opkg install kmod-bnxt_5.10.146-1_x86_64.ipk 
Unknown package 'kmod-bnxt'.
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.146-1-82899b192c388d54e83a7f3e0b1e75f8) for kmod-bnxt
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-bnxt found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package kmod-bnxt.
root@router-2:~# opkg --force-depends install kmod-bnxt_5.10.146-1_x86_64.ipk 
Unknown package 'kmod-bnxt'.
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.146-1-82899b192c388d54e83a7f3e0b1e75f8) for kmod-bnxt
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-bnxt found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package kmod-bnxt.

Therefore, I have two questions:

  1. Is the only way to install the package on my router is to flash it with the version I compiled of OpenWrt? I don't really care if the driver doesn't work correctly, I just want to test it to see if I need to make changes to the package definition.
  2. If so, I suppose that later I won't be able to install new packages from the official OpenWrt repositories and I will only be able to install the ones I compiled, is that correct? I definitely don't like this very much.

I see that there have been no contributions in the netdevices.mk file for several years, and I would love to leave this contribution.

Correct

Applies to at least packages with kernel dependencies.