Compile drivers for RTL8821CU wireless adapter

Hi all,

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 ( ) 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.

Thank you in advance for any help.

Or any instructions on how to compile other USB wireless adapter drivers that I can read to understand how to do the same for this ?

Thank you

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.


Thank you for the reply.

I am willing to go for the pain. :slight_smile:
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 (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 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).

This new package should be placed in a local "package feed", as said here

Since you will need to work with kernel patches you will probably need to read this article as well

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.

I have tried to make a test package for 88x2bu, and it should similar as 8821cu.
you need to change something to make it build for 8821cu

and there is a repo for rtl8821cu for your reference.

test by yourself .

is there anything new about this? Im also interested (no problem with building an image).
Any of you ended up with a working set of patches maybe?

Im using morrownr/8821cu on debian and its perfect.


1 Like

do yourself a favor, and and skip RTL based devices ...

Im trying hard but next available shipment of another Alfa card that I have order is in 1-2 months :slight_smile:

+the usb I have is quite packed and the right size for the job at the moment.

In the end I dont mind playing a bit with building a custom one. I have a build system for zero2 images.

Doesn't have to be Alfa, just shouldn't be Realtek ,)

1 Like

nop... Im in the UK. no fun with this one too


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.

1 Like