Adding OpenWrt support for Asus RT-AC57U v2

@yeste At least, no one told here that he did.
I tried reading wiki about adding support, but it is too technical for me.

Hi, i would like to add support for this device.
Can somebody confirm that hw is supported?

Hello All.
I just bought this device and was confused with HW version - got v2 instead of v1.
So I am also interested in having OpenWrt on this device installed.

Don't seem anyone is working on supporting v2 for now.

Still no news about progress on v2 ?

Some useful information was provided in another thread by @dipol0: Add support for Asus RT-AC57U_V2

1 Like

The original ASUS firmware for the device is open source and is based on some earlier version of OpenWrt. So I guess it must be supported. However, there's a comment about another router with the same CPU at Asus RT-AC58U V2 support coming? - #3 by tmomas that says

SoC = QCN5502 -> currently unsupported by OpenWrt

My understanding is that this hardware is not supported by existing OpenWrt images, but we can add support by looking at ASUS firmware (I may be wrong).

1 Like

I've recently managed to (almost) build ASUS firmware from source. It was confusing since they sell basically the same devices under different model names.

There is one linker error in the code. Also, their Makefiles make use of git so you have to initialize the repository and do at least one commit and also create a tag/branch with a specific name to be able to run make without editing Makefiles. I am going to document this for future reference at some point. Next, we need to learn how they add support for the new SoC.

Please reach out to me if you have experience with this sort of thing and would like to help.

1 Like
Building original ASUS firmware

Below I document the process of building the original ASUS images for RT-AC57U v2, RT-AC58U v2, RT-AC59U. All three router models use the same firmware.

Note about version control

ASUS makefiles use git to choose version suffixes for built images. But the .git repository is not included in the sources, so you will need to create a repository, make a commit and add a tag that is expected by makefiles.

Download source code, install packages and toolchain

Download source code.
Go to https://www.asus.com/Networking-IoT-Servers/WiFi-Routers/ASUS-WiFi-Routers/RT-AC59U/
Navigate to Support->Driver&Utility. Under Driver & Tools, select "Other" as OS. You will be able to download firmware images and source code there.
Extract the zip file. It contains another archive in tgz format. Extract it as well.

Install the packages listed in asuswrt/README.TXT. DO NOT follow other instructions in that file. It is outdated and confusing! Go there only if my instructions fail. I will narrow the list down in the future. I will not be surprised if most of it is not necessary.

Extract asuswrt/tools/openwrt-gcc463.mips.mesh.tar.bz2 to /opt:
cd /opt && sudo tar xf /path/to/extracted/sources/asuswrt/tools/openwrt-gcc463.mips.mesh.tar.bz2 && cd -
You should have the following dir: /opt/openwrt-gcc463.mips.mesh/bin

Prepare the environment and build
cd asuswrt/release/
git init
git add *
git config user.email "you@example.com"
git config user.name "Your Name"
git commit -m "Initial commit"
git tag asuswrt_3.0.0.4.382

cd src-qca/
export PATH="/opt/openwrt-gcc463.mips.mesh/bin:$PATH"
sed -i 's/^YYLTYPE yylloc;/extern YYLTYPE yylloc;/' linux/linux-3.3.x.mesh/scripts/dtc/dtc-lexer.lex.c
make RT-AC59U
ls image/

Builds successfully on Debian 10.
Takes 35-40 minutes on my laptop (4 threads, 5th generation Intel i3, 5400 RPM hard drive).
Tried the following sources:

  • GPL_RT_AC57U_V2_300438251832.zip / GPL_RT-AC59U_3.0.0.4.382.51832-gf068aa7.tgz
  • GPL_RT_AC59U_300438252274.zip / GPL_RT-AC59U_3.0.0.4.382.52274-gd0587b6.tgz
Note on reproducibility

You cannot reproduce the original firmware exactly. I found differences in many bytes, but haven't identified the reason for this. I will try to compare the filesystems inside the image and will report if they're the same or not.

I am currently working on comparing ASUS sources to original kernel sources and taking only those patches that are required to run linux kernel on this SoC. Once I have that, I am going to port the patches to mainline kernel.

2 Likes

Anything new on supporting the QCN5502 SoC?

Hi. I currently have a conflict of interest with my current employer (who holds copyrights to everything I do as per my employment agreement). This issue wasn't apparent at first because I failed to convey the exact nature of my work here. I am working towards resolving this issue. Once resolved, I will be able to continue work. I assure you that I will not abandon this effort :slight_smile:

2 Likes

Hi everyone! I am happy to announce that I have resigned from my job and so there's nothing stopping me from doing this work anymore. Also, I will make sure my future contracts can't restrict my contributions to free software.
Since this forum doesn't allow a single person to post many consecutive messages, I will have to edit the last message when I post updates.
Stay tuned!

2 Likes

Hey bro. I have Asus rt-ac1300gp_v3 router which is also qcn5502 based. If you don't mind, I could join your work. Msg me, my email: merlin.ua.1@gmail.com.

A have a "Asus RT-AC57U V2".
I would like to use it by OpenWRT firmware.
So I'm joining the club. :slight_smile:

According the othether forum thread (Add support for Asus RT-AC57U_V2). I collected device data.

CPU data:

admin@RT-AC57U_V2:/tmp/home/root# cat /proc/cpuinfo
system type             : Qualcomm Atheros QCA5502 ver 1 rev 0
machine                 : ASUS RT-AC59U
processor               : 0
cpu model               : MIPS 74Kc V5.0
BogoMIPS                : 385.84
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16 dsp dsp2
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

admin@RT-AC57U_V2:/tmp/home/root# uname -a
Linux RT-AC57U_V2 4.4.60 #1 Wed Jan 6 15:07:10 CST 2021 mips GNU/Linux

Comparing with the other forum thread (Add support for Asus RT-AC57U_V2) cpu is sligtly different.

"Qualcomm Atheros QCA5502 rev 0" VS "Qualcomm Atheros QCA5502 ver 1 rev 0"

Sligtly different capabilities:
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16 dsp dsp2

VS
ASEs implemented : mips16 dsp

I think it is not a big deal, and the two device is identical.

I upgraded to the newest Asus firmware (3.0.0.4.382_52482), what use 4.4.60 kernel.

Thanks for your research. Didn't know they updated the kernel. It would have been nice if they also published the sources for it. The latest source release as of now is 3.0.0.4.382.52274 which is based on kernel 3.3.8 (according to top-level kernel Makefile). Any chance you remember what version of the kernel was reported by uname in previous firmware releases? I would like to make sure they didn't just leave the old version numbers.

1 Like

"Any chance you remember what version of the kernel was reported by uname in previous firmware releases?"

When I updated firmware have not interested in openWRT router firmware. So I did not use ssh.

I would not downgrade firmware, because I use the router.

Older firmwares can be downloaded here:

I'm a beginer in that field, so my next idea may be strange.

The openwrt-19-07-8 relase (OpenWrt 19.07.8 service release) use Linux kernel 4.14.241.
The newest Asus firmware use 4.4.60 kernel. Without kernel building, could we make openwrt-19-07-8 firmware image?
Or simpli we install openwrt by ssh?

No. Please read the following information from the wiki.

tl;dr: In order to install an OS on a device you need to patch the kernel so that it has all the drivers required to boot and run the OS on this specific device. Neither the mainline linux kernel nor OpenWrt project have patches for the hardware used on this device.

Our work therefore looks like this:

  1. Figure out which parts of code provided by ASUS are needed for this particular SoC;
  2. Port these patches to mainline kernel;
  3. Backport them to current kernel version used by OpenWrt if needed;
  4. Build OpenWrt image with patches from (3) and test it;
  5. Submit (2) and (3) to the community and work towards having them integrated into mainline.
1 Like

First I search for leds.

The router has 9 leds:
Power
Port4
Port3
Port2
Port1
Wan
2.4Ghz Wifi
5 Ghz Wifi
Usb

GPIO directory there is 9 files.

admin@RT-AC57U_V2:/sys/class/gpio# ls
export gpio1 gpio15 gpio16 gpio17 gpio4 gpio5 gpiochip0 unexport

It may be coincidence, but I dont think so. :slight_smile:

1 Like

Reading values:

admin@RT-AC57U_V2:/tmp/home/root# cd /sys/class/gpio
admin@RT-AC57U_V2:/sys/class/gpio# cat ./gpio1/value
1
admin@RT-AC57U_V2:/sys/class/gpio# cat ./gpio15/value
0
admin@RT-AC57U_V2:/sys/class/gpio# cat ./gpio17/value
1
admin@RT-AC57U_V2:/sys/class/gpio# cat ./gpio4/value
1
admin@RT-AC57U_V2:/sys/class/gpio# cat ./gpio5/value
0
admin@RT-AC57U_V2:/sys/class/gpio#