Page 1 of 1

RTL8852 wifi support

Posted: Sun Jun 29, 2025 11:32 pm
by xyzzy
I wanted to use a Wifi 6 RTL8852BE module with the nanopi and not the older module that it can ordered with.

The rtw89 driver with RTL8852BE support has been in the kernel since 6.2, from February 2023, over 2 years ago. But the nano pi zero2 is still on kernel 6.1!

But there is an out of tree rtw89 driver that supports old kernels, https://github.com/lwfinger/rtw89

To build it, it's necessary to have the kernel headers and the FriendlyElec Ubuntu image doesn't come with them. It uses a special kernel and not the stock ubuntu arm64 kernel.

It also doesn't have any repository setup where it can install the deb with apt. IMHO, it's very disappointing that this simple thing isn't done.

Thankfully there is a deb for the headers mentioned in the wiki. It says to run:

Code: Select all

wget http://112.124.9.243/archives/RK3528/linux-headers-$(uname -r)-latest.deb


Well, that doesn't work as the link is wrong. Paths are case sensitive. It file is at http://112.124.9.243/archives/rk3528/li ... latest.deb

But the driver build fails with this error:
[code ][/code]

Re: RTL8852 wifi support

Posted: Mon Jun 30, 2025 6:10 pm
by xyzzy
I wanted to post the error, in case someone else tried to build a kernel module and could then find the solution there, but it's going to be too much work to replicate it.

There's an error about struct pci_device_id not being the right size. This is probably caused by kernel being built with a different compiler than the modules.

Ubuntu 24.10 comes with gcc-14, but the kernel FriendlyElec provides was built with a custom gcc 11 cross toolchain. Gcc 11 was the default in Ubuntu 22.04. But, Ubuntu still has an old gcc 11 package available. I tried that with no luck.

The old toolchain being used for the kernels isn't available in source form nor for aarm64, so there's no way to compile a module with it. So I'll just compile a new kernel. How long can it take? Hours in fact. First machine I compiled a kernel on was a 66 MHz 486 with 8 MB of RAM. The kernel was much smaller then. I think it's actually slower to compile now despite hardware that should 100x faster.

The kernel build then failed in some Rockchip MIPI DSI display driver. The code is broken and I don't know how this kernel could ever compile. Since the Zero 2 has NO display hardware at all, that driver is totally useless, so I just turned it off. In fact, I turned off a ton of totally useless drivers to make the build faster.

FriendlyElec really should make a kernel config designed for their hardware. Did you know that every nanopi zero 2 out there has a framebuffer console displaying a login prompt? There's no way to see it since the display output pins of the CPU aren't even connected to anything. But it's there taking up RAM and slowing down the boot.

To boot the kernel it needs to be turned into a special rockchip kernel image. That's not really true, it's not necessary, as u-boot is perfectly capable of loading a standard kernel image file from the rootfs and booting it. No image or extra kernel partition needed at all. It's just pointless extra complexity. Maybe Rockchip just didn't know any better?

To make the image one needs a binary only tool. No source code for it is provided. I wonder what secret things it does to the kernel? The wiki has a script for this, but it downloads an x86_64 binary and won't run on the nanopi! However, if go to the github repo that can be found from the download URLs in the script, then there's aarch64 binaries of the tool at https://github.com/friendlyarm/sd-fuse_ ... ls/aarch64

Building the rtw89 drivers against the kernel built with gcc 14 works! The issue was the old toolchain used for the stock kernel.

While the driver loads and detects the card and can scan wifi networks, it doesn't work. Can't join any network, which could be an issue wit the antennas in the zero 2. Those cables are hard to route and connect!

But it also can't start an AP. It should be able to at least think it's started an AP even without working antennas.