What's new

Solved Need help to compile Realtek r8152 driver for RT-AX88U

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Kanuki

Occasional Visitor
Hi.. everyone

I'm planning to add 2.5Gbps dongle to my RT-AX88U
but I'm not a linux person.

I've been trying to follow Renjie's guide and managed to compile
RT-AX88U firmware successfully but I'm having hard time to compile r8152.ko driver.


Can someone please help me to compile r8152.ko driver for RT-AX88U?


Please also help to add this line to r8152.c.

@@ -16369,6 +16369,7 @@
strlcpy(info->driver, MODULENAME, sizeof(info->driver));
strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
usb_make_path(tp->udev, info->bus_info, sizeof(info->bus_info));
snprintf(info->fw_version, sizeof(info->fw_version), "0x%04x", tp->version);
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)

You might need to replace strscpy function since old kernel 4.x
doesn't support this function.

"sed -i -e 's/strscpy/strncpy/g' r8152.c"

P.S. I know that Renjie already provided the pre-compiled version but it's kinda outdated.
Thinking to try out the latest driver version.
 
Last edited:
I decided to give another try to compile the latest R8152 driver
and managed to compile it successfully this time.
If you can, please post the steps/process of how you did it and anything to watch out for to help others who may want to add a Realtek r8152 based adapter to their Asus router.
 
Ahh the old Realtek 2.5 Gb dongle. Used it for a while with an AX88U and NAS box.
Other than the gymnastics to get the drivers unloaded/loaded in correct sequence, worked well.
Now its sitting in a drawer - moved to an AX88U Pro.
 
If you can, please post the steps/process of how you did it and anything to watch out for to help others who may want to add a Realtek r8152 based adapter to their Asus router.

I started with completely zero linux knowledge.
It took me over 3 days to learn everything and managed
to compile the driver successfully

I have not tested out my compiled driver whether will work properly or not
because I just changed my primary router to GT-BE98 then flashed back
ASUS original firmware to my RT-AX88U and convert it to the AiMesh node.

Until merlin decide to release his version of GT-BE98 firmware then I have no way to
test out my compiled driver for my RT-AX88U AiMesh node.

Renjie's guide was good but it's outdated because he used WSL1 to compile
the firmware which no longer work with new merlin firmware because it's required
WSL2 to compile and missing out on 2 important parts Eg; cloning merlin toolchain repo
and how to set up aarch64-linux cross-compile toolchain.

asuswrt-merlin wiki is really good and up to date on how to really compile the custom firmware.

In order to compile the driver successfully, I needed to combine 4 different tutorials.


Step 1
You need to read through Renjie's guide but DO NOT try to follow his tutorial at this point.



Step 2
Follow this guide on how to setup WSL2 on Windows 11 and install Ubuntu 20.04



Step 3
Follow this guide on how to compile the router firmware but STOP at the point where
you're going to execute the command to compile the firmware.



Step 4
Follow this guide on how to setup aarch64-linux cross compile toolchain.



Step 5
Go back to Merlin's guide and execute the command to start compiling
the router firmware for a while. Maybe 1 to 1 1/2 hour maybe. I don't know.
Then CTRL+C to stop compiling or launch another Ubuntu session and go to
the next step and leave the first session to continue to compile the router firmware.

If you can compile the driver successfully which mean you compile the router firmware
long enough then you can come back to the first session and CTRL+C to terminate it.


Step 6
Download r8152 linux driver and transfer into your ubuntu VM



Step 7
You will need to replace strscpy function since old kernel 4.x
doesn't support this function.

sed -i -e 's/strscpy/strncpy/g' r8152.c

Credits to this tutorial.


Step 8
Go back to Renjie's guide and follow on how to add a function to the driver,
how to compile the driver, and performance tuning.
 
Last edited:

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top