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:
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.
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
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!
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.
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.
"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?
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:
Figure out which parts of code provided by ASUS are needed for this particular SoC;
Port these patches to mainline kernel;
Backport them to current kernel version used by OpenWrt if needed;
Build OpenWrt image with patches from (3) and test it;
Submit (2) and (3) to the community and work towards having them integrated into mainline.
Yes we will use the existing ath79 arch. But! Every single SoC (sometimes even specific board!) needs a little bit of code specific to this SoC / board.
However, your information regarding NETGEAR EX7300 (v2 to be precise) is very interesting. This board is indeed based on QCN5502 and the openwrt wiki page says that there's a pending PR for it. Not sure what "pending" means here and where it exists if there is one. Waiting for the page author's reply regarding this.
I have created a public git repository. Relevant tasks will be created as "issues". Make sure to read the project's main wiki page to understand which branch contains what. There's nothing of interest there at the moment - just mainline kernel code and code from ASUS firmware. I will be creating issues in the next few days. Anyone is welcome to read / comment / open merge requests / etc.
@Hsxsky here's my router's info as you requested (without dmesg since the forum doesn't allow very long messages):
bridge name bridge id STP enabled interfaces
br0 8000.a85e4547d7f8 yes vlan1
ath0
ath1
/sys/kernel/debug/gpio
GPIOs 0-19, ath79:
gpio-1 (sysfs ) in hi
gpio-4 (sysfs ) out hi
gpio-5 (sysfs ) out lo
gpio-15 (sysfs ) out lo
gpio-16 (sysfs ) out lo
gpio-17 (sysfs ) in hi
I have compared data. CPU is slightly different, and the ls /sys/devices/platform is totally different. Maybe different version of firmware. As I see, other parameters are same.
Please check "/tmp/home/root# uname -a" too.
As i see platform/target will be ath79
Subtarget: generic
Package architecture: mipsel_74kc or mips_24kc
I tried to figure out what parts of ASUS patches are required for the SoC to work. I tried removing things that seemed unnecessary, but this approach quickly made my device not boot.
I found a less error-prone way to remove irrelevant patches: by removing patches to files that aren't mentioned in the kernel compilation log. I tested the resulting image and it works fine.
Apparently there is a small patch that needs to be added for RT-AC59U v2, RT-AC57U v3, RT-AC58U v3 boards (they are identical). These are similar to the board discussed in this thread except with more flash memory.
Found out that there's a PR here which adds support for one QCN5502-based board. The patch is quite small.
Plans:
fix branches in my repository
there's code for boards that use device tree - investigate if it can be used for our board
remove patches for all the files that are not being compiled
finish writing device tree for the router
solder header pins to get access to UART
In order to use ASUS TFTP recovery without ASUS program for windows:
set a static IP to 192.168.1.10/24
turn off the device
hold and don't release the reset button
turn on the device while holding the reset button
wait until power LED is slowly blinking
release the reset button
send new image with atftp --put -l /path/to/image.trx 192.168.1.1 69
With the help of other developers, I've been able to build an OpenWrt image for my RT-AC57U v2. Switch and wireless don't work yet, but the CPU runs OpenWrt just fine. I have created a repository which is a mirror of OpenWrt with my patches in apjet01 branch. Choose Qualcomm Atheros APJET01 (16M) in Target Profile. Once you flash the image your device will loose connectivity and the only way to access it is by soldering a pin header to UART and using TTL-USB adapter. Only use this image if you have access to UART! You can return to stock firmware at any time via TFTP recovery though.
The device is not really useful at this point, but we've got so much closer...
All 5 ports are now working correctly. We've had support for LAN ports for a while in my repository, but I wanted to have the switch part finished before saying anything. Apparently there are more than 1 phy. There is phy at register 4 which I was using, but WAN port didn't work and it crashed when using VLANs (required to tell WAN from LAN) so it had limited functionality. Then recently @merlin discovered there's also a phy at register 0 which makes everything work if you provide PORT0_STATUS in qca,ar8327-initvals. Most recent commit fixes that. There is no distinction between LAN and WAN at the moment, I will fix this soon. USB support by @merlin is also on the way!
Note that this is my 3rd consecutive message so I will have to modify it instead of writing new ones.