Salvaging this thread, I have a RTL8821CU wireless adapter and would like to use it to connect it to OpenWrt ( Raspberry Pi Zero ).
I have compiled drivers for it in Raspbian ( https://github.com/whitebatman2/rtl8821CU ) and have the adapter working, so Linux support is available and tested. How can I compile/package them for OpenWrt ? And what extra OpenWrt pakages are required ?
My intent is to turn my Raspberry Pi Zero into an OpenWrt router.
It's not an easy thing to do since OpenWrt is not set up to let you compile things inside the device, you can only use the build system to cross-compile.
Also, OpenWrt does not support dkms system for building and using out-of-tree Linux drivers so you cannot use that source but you would need to get a straight kernel patch and adapt it to the kernel used in OpenWrt, that's all sorts of painful.
I'm sorry but the fastest and cheapest option is to just buy another dongle with a supported chipset if you really need to use OpenWrt on your device.
Or rather buy a whole new device like a mini router from GL.Inet, that will cost more or less like a new wifi dongle, but it's better suited for the job and also is supported by OpenWrt. And is still tiny and portable like a raspberry.
I am willing to go for the pain.
At least until it gets too much... perfectly aware that success odds are not good...
I do not need to use OpenWrt, I have already been using this device as a router using other Linux tools and the CLI for management, but it does get a bit painfull as well...
For me it is fine to use the build system to try to go over this. I just want to give it a try before getting yet another dongle... I think in this situation I will just keep the solution that I have...
Just for more context, I am using this Raspberry Pi to act as a Wifi Client ( the USB Wireless adapter), and then using the onboard wifi chip to create the local wifi network. Not sure what term is used to describe this wireless network setup. I know that I can use other setups but have been having better results with this, so a device that has two wireless adapters is something I desire.
Was not aware of GL.iNet, and will definitely consider their routers as an option if I start from scratch again, but I really want to try to re use the hardware that I already have.
Then you need a linux system (PC or VM, not the raspi) where you install the build system, have a read about how it works and how to use it https://openwrt.org/docs/guide-developer/build-system/start (it's not particularly bad if you come from embedded device development, most of it is auto-configured and self-hosted and runs anywhere) and then you copycat this other package https://github.com/openwrt/openwrt/tree/master/package/kernel/rtl8812au-ct that is doing a similar thing for another realtek dongle.
If you look at the makefile you see that it's pulling source from a github repo and one of those two strings of characters is a commit shasum so it's pulling the source at a specific commit (so it always pulls the same source).
Then you use the build system to create a new firmware image with the new package (and everything else you want) included. It may also work to just take the package with the kmod and copy it to the raspberry to install manually.
If you are successful you can also contribute the package to OpenWrt, it may take months to be properly reviewed and accepted though.
Sorry, but no... was about to work on this, but then someone i know just gave me an old USB adapter that already had support ( TL-WN-721N ) that is good enough for my needs.
All i can say is that I was going to follow ChalesYu suggestions on this. And that the documentation although above average in terms of quality, does not provide (in my opinion) a clear step by step guide on how to build a new driver. So, some time would have to be spent on reading through the documentation as well.