OpenWrt x86_x64 same config as release

Hi all,
I am not trying to change anything from the release I just wanna add driver support for a networking card and for the past 2 weeks I couldn't find a solution.

Is there a way to check all packages as the official release without copying the config.buildinfo because this fails when making kernel changes ( Adding Drivers support ) ?

Can you not use the pre-built release SDK to build your package instead of using toolchain for building from scratch?

1 Like

You can add it in "https://firmware-selector.openwrt.org/?version=22.03.2" --“Customize installed packages”
ps:

@stangri The drivers I need are the ones in the picture and I don't think there is a kmod available for it, that's why I use the toolchain, but I can be wrong!
The way I am adding them is using make kernel_menuconfig

did you already try the solution suggested by @xiaohei, it's much simpler, assuming it works ...

@frollic I was looking for QLogic drivers as recommended by @xiaohei but I couldn't find the package !

couldn't find it, or it doesn't exist ?

do you know the name of the package ?

Netxen Multi Port ( HP NC375T ) is the one I need and based on what I read on the forums people said this is not included in the kernel.

yeah, seems there are indeed no packages.

I'd suggest you to request them to be added to the repository,
or you'll have to build your own images forever.

1 Like

Yeah, sorry, you mentioned "packages" and you've been given a few methods of adding a package to a build. It looks to me you need a kernel option which would require rebuilding kernel.

It may or may not be possible with the SDK, I think you should explore that option rather than using the toolchain.

PS. @Borromini who knows way more than I do about OpenWrt building liked my suggestion above. So I'm guessing it's possible with the SDK.

1 Like

Download and unpack SDK version your device uses. Create netxen-nic dir inside package dir and put this Makefile inside:

# SPDX-License-Identifier: GPL-2.0-only

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME := netxen-nic
PKG_RELEASE := 1

PKG_SOURCE := $(LINUX_SOURCE)
PKG_SOURCE_URL := $(LINUX_SITE)
PKG_HASH := $(LINUX_KERNEL_HASH)

PKG_LICENSE := GPL-2.0

PKG_FLAGS := nonshared
PKG_BUILD_PARALLEL := 1

include $(INCLUDE_DIR)/package.mk

TAR_CMD=$(HOST_TAR) -C $(1) --strip-components=1 $(TAR_OPTIONS)

define Build/Compile
	$(KERNEL_MAKE) \
		$(PKG_JOBS) \
		CONFIG_NETXEN_NIC=m \
		M=$(PKG_BUILD_DIR)/drivers/net/ethernet/qlogic/netxen \
		modules
endef

KernelPackage/hooks := :

define KernelPackage/netxen-nic
  TITLE := NetXen Multi port (1/10) Gigabit Ethernet NIC
  KCONFIG := CONFIG_NETXEN_NIC=m
  FILES := $(PKG_BUILD_DIR)/drivers/net/ethernet/qlogic/netxen/netxen_nic.ko
  AUTOLOAD := $(call AutoProbe,netxen_nic)
  DEPENDS := @PCI_SUPPORT
endef
$(eval $(call KernelPackage,netxen-nic))

Run make, search for the results (kmod-netxen-nic) in bin dir.
I only checked the compilation and modinfo on my host system properly reports characteristics of the driver.
Remember, this is short term solution. For long-term one, submit commit to package the module officially, for example: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=ebe2b7190b7d8815a588eaf8a5cfdf9edfd85c36

For anyone else looking at this - yes You could compile some modules that way not officially packaged, but keep in mind, the recipe uses unpatched kernel sources. So if You really need this to work, do not forget to apply patches from target/generic dir from OpenWrt tree for that particular SDK version and particular target You are using.

3 Likes

I managed to create the kmod-netxen-nic in bin dir but I dunno how to have the full openwrt afterwards that I can use in my router! Thank you for your help!

This will be rather hacky approach (normally You setup repository with packages You built with SDK) but it's faster.
Download the Image Builder from the same directory You downloaded SDK and unpack it. Create files dir in it, change to that dir and extract the kmod-netxen-nic package, so that You'll see etc and lib dirs with its content. Now go to root directory of Image Builder and make help to see what can be done. Check wiki: https://openwrt.org/docs/guide-user/additional-software/imagebuilder if You're still confused. Small hint: by default IB won't add LuCi to the image, so preferably add luci to PACKAGES. After writing firmware to Your device, You should be able to use opkg to install available packages.

1 Like

Whoa, whoa, whoa, he just needs to add copy the .ipk file to image build packages/ directory and add the package name to the list of packages in command line.

1 Like

Indeed, slightly simpler approach. I was writing from memory and I always forget about this.

1 Like

@tmn505 @stangri guys I can't thank you enough for your help, you just made my day... Finally I have it up and running.
Btw does it hurt to add more packages than the default ones, I added luci and luci-ssl?

No it doesn't hurt, image size is Your only limit (eventually also RAM memory in case You've it below 64MiB).

1 Like

You may also want to set the CONFIG_TARGET_KERNEL_PARTSIZE=128 CONFIG_TARGET_ROOTFS_PARTSIZE=2000 variables on the make image line to set custom partition sizes for kernel and rootfs, depending on the storage available on your x86_64 system (so obviously not those exact numbers).

I add things like luci-app-https-dns-proxy and luci-app-simple-adblock of course and when you have time you may want to look up uci-defaults and create a script to customize your install.

1 Like

I definitely need to increase the partition size and for ram I think 4GB is good enough!

Just use gparted on the disk post flash, if you don't want to rebuild.

2 Likes