How do you tell the build system to use a new local module with source code

I have a new Raspberry Pi 4 being used to replace an easily hacked Netgear device. I have it goign well with built-in GB and added USB3 Gig Ethernet. However I want to add a QNAP 5GBe USB dongle. The internals are made by Aquantia aqc111 and they have a linux driver source code available.

I am trying to make sense of the build-process, I can successfully build my own snapshot. However I can't figure out how to add the new driver in the kernel and actually add it to menuconfig. I understand I need a local feeds and a Makefile, but I can't figure out where to put those (not going to be a tar.gz and not downloaded, but local) and would love to see an example of an existing Makefile (the rtl8152 is already in the system so would be great)

The first questions I have are:

  1. Where do I put the driver source and accompanying Makefile so that openwrt build process see it.
  2. Where can I see existing Makefile for rtl8152
  3. How do I make sure this all survives a git pull and/or make download

Thanks for your help!

Is this driver already in the linux kernel? Then it should be easy to add it. You don't need an extra package and feed for it.

1 Like

No it's not in the kernel. It's a new product.

Notwithstanding that, I would love to understand where to put things and configure them. That's the info I am looking for. I want to a have a snapshot with my hardware built-in and not as modules, so it just starts.


I think that this is the driver you are looking for...

Thank you for that info. I was already aware of it. As stated, I am working on Raspberry Pi4 with arch BCM2711 and that arch does not have the driver in it. I do have access to the source, their website has even a newer version. Just wanted to insert it into my particular build/arch .

Let me state my question differently:

I have a driver for widget and would like to know how to add it to menuconfig from OpenWRT. The documentation is not clear enough (for me) as to where and how. I am reasonably competent and have build kernels before , just not in the OpenWRT build toolchain. So the question is where should I put my widget source and Makefile AND where can I see the current Makefile for another widget

I hope this makes my request more clear

Instead of trying to expose a kernel module to the OpenWrt configuration, I would rather built the driver included in the kernel.
You can do it by running make kernel_menuconfig, and then enabling the driver as * (as opposed to m) to be built in the final image (i.e. not a module but part of the kernel itself).


The support in kernel is for x86 NOT for the arm arch. I even put a screenshot. It's not there and anyways that is irrelevant because:

I am asking how things are done in the buildsystem
If you don't know. You can say I don't know or ignore this message.
If you do know, just point me to the right place. My question is how does the build system work. It was pretty clearly laid out in the OP.

I have changed the topic so that my question is clear.

Ok. Let's put the things clear.

  1. No Linux kernel drivers for USB are architecture dependent. In fact, the whole Linux USB subsystem is architecture independent. That's not your problem at all.
    1.1 Even if it existed "only for x86", exposing it to the menuconfig and loading the module to a kernel running ARM kernel will cause it to inmediately crash. Guaranteed.
  2. The driver indeed exist, but it was added recently. It doesn't exist in the current 4.19 (the latest available in OpenWrt master), therefore you will have to either backport or to update to a newer kernel.
1 Like

Once backported, the module can be built into the kernel image. No need to edit or hack any build ssytem at all.
Don't be rude, dude. You have no idea what the hell are you doing. Be repectful and accept the help from people that knows better than you.

You can't expect to copy a C file into the kernel, expose it in the menuconfig and then building it without crashing the whole thing. That's why an specific project, the Linux Backports, exists.
Do yourself a favour and backport your driver. And I repeat: No Linux driver for USB is architecture dependet. And the AQC111 is not the exception. And I repeat: Even if the driver exists only for x86, you will need to port it to ARM. Exposing it in menuconfig will cause the kernel to crash when the module loads.

1 Like

To answer your remaining question, man git

Considering that git is at the core of how Linux is developed and maintained and you don’t seem to even have a basic understanding of branches, you probably would also do well reading any of scores of tutorials on how Linux is configured and compiled.

This is probably the only question possibly not covered in existing docs....

A) packages are not effected by the commands mentioned above.

1 Like

My question was desperately trying to be clear, I am looking for info about the build toolchain, not a specific driver. I do not want to just put a c code somewhere and compile it. All I asked is where to put the source code and the OpenWRT Makefile on my local drive and the proper syntax for said Makefile. I appreciate your effort to answer me, but that's is not the question I keep asking.

The old documentation mentions 2 types of Makefiles , one for OpenWRT and one for kernel. Can't find documentation for that. They seem to require a download URL and a compression algorithm. And not quite sure about the compile macros. Kernel modules usually require a Makefile and a konfig file that is not the same syntax.

And forgive me for asking a stupid question , but aren't the 2 facts that USB drivers are architecture independent, and they should be (back)ported to ARM mutually contradictory? I have tried very hard to formulate this question without being offensive. forgive me if I failed. Just confusing.

Thank you for that info.

I had to resort a couple of time to make distclean and I guess that one does away with everything. I can work around it if the need arises.

Still the same answer: you need to backport it or to use an updated kernel.
Once you've done that, you don't need to do whatever you're asking for. You asked a question about a specific driver in the kernel and then tried to generalize.

There is no other way of doing it correctly. Also, backport is not a thing of architecture but a thing of kernel versions.
It's clear that you didn't ever bother to watch the link, but that's your problem.
It's not such a thing "backporting to ARM". You need to backport from the latest stable kernel (5.3) to the latest LTS (the one used by OpenWrt, 4.19).

Or update the whole kernel to 5.3...

Take a look at the mac80211. This is a backport kernel module.

Just adapt the structure to your new backport kernel module. :slight_smile:



openwrt/package/kernel/<stuff> is a great starting point. Thanks!
src, scripts and patches directories seem promising. It matches some documentation on the older wiki.

Any chance of some documentation about the Makefile structure and macros? :smiley: (A guy can hope)