[GCC 7.2 BUILD] Optimized TP-Link Archer C7 V2 AC1750 LEDE Firmware

After running into several issues with the RC1 release build of LEDE on my TP-Link Archer C7 V2, I decided to compile my own build with only the packages and kernel modules I need. Considering the C7 is a quite popular device, I want to share my build with the community.

There is no release cycle for this build. I will only update it here when I update my C7. Feedback welcome!

Features

  • Extended & optimized build for TP-Link Archer C7 V2 only based on latest LEDE trunk source
  • Baked using latest GCC version 7.2 with -O3, 24kc, binutils 2.30 and various patches to maximize performance
  • LuCI SSL Web Interface
  • VPN ready (OpenVPN, L2TP, IPSec, GRE, IPIP, PPTP)
  • DNSCrypt using Cisco OpenDNS for your security, privacy & freedom
  • Simple Adblock in LuCI
  • QoS with SQM (cake & more)
  • Qualcomm FastPath
  • BBR Congestion Control
  • Dynamic DNS support
  • WiFi Schedule (disable/enable WiFi at specific times)
  • HD Idle (spins down connected hard drives when idle)
  • Wake On LAN (WOL)
  • UPnP support
  • Supports common filesystems (btrfs, exfat, f2fs, ext4, msdos, ntfs, nfs, xfs, fuse, reiserfs, squashfs)
  • IPv4-over-IPv6
  • Supports bonding, relays and bridges
  • BCP38 anti spoofing
  • Advanced statistics (graphs)
  • vim, nano, tcpdump-mini, htop, rsync, iproute2, ipset, wget, curl, ethtool, dmesg, grep, tar & many more

⇣Download on GitHub⇣

FAQ

Can I block ads with this firmware?

Yes! Open /etc/config/dnscrypt-proxy with nano or vim and change option resolver 'fvz-anyone' to option resolver 'default.ns1.adguard.com'. Then restart DNSCrypt with service dnscrypt-proxy restart. Simple adblock is also available in LuCI.

Do you offer any quality assurance?

Sort of. I push updates manually after testing the builds on my own C7, which prevents major issues with the releases you can find here. The nightly builds are untested!

My clients are unable to connect to the internet after flashing this firmware!

Just reboot your router once and it should work. If it still doesn't work, make sure that dnscrypt-proxy is enabled and working. SSH to your router and do service dnscrypt-proxy enable; service dnscrypt-proxy restart.

Can I get this firmware even faster?

Yes. If you don't use PPPoE or another tunneling protocol, you can remove the line option mtu_fix 1 in /etc/config/firewall to squeeze out another 20-30Mbps.

Changelog

  • 31-05-2018

    • Fix 061-remove-pppoa-luci.patch
    • Remove 063-add-luci-mips-processor-march.patch
    • Upstream updates
  • 2018-05-27

    • Patches updated
    • Use wolfssl for hostapd
    • Replaced dnsmasq with dnsmasq-full
    • Switched to binutils 2.30
    • Upstream updates
  • 2017-12-08

    • Fix compilation issues (odhcpd-ipv6only was "magically" added by upstream updates and caused conflicts)
    • Add rfkill support (might fix 5GHz issues, credits to @cliobrando)
    • Add kmod-usb-printer
    • Upstream updates
  • 2017-11-06 v2

    • All patches ported to kernel 4.9
    • Switched to kernel 4.9
    • Enabled BBR & FQ (adjust your sysctl.conf)
    • Switched to GCC 7.2
    • Switched to binutils 2.29.1
    • .config file added to repo
  • 2017-11-06

    • Switched from gwlim's to dissent1's Shortcut FE patches
    • Removed 464 to prevent bug (high CPU load, crash)
    • Patch updates
    • Upstream updates
  • 2017-09-10

    • GRO support added
    • Patch updates
    • Upstream updates
  • 2017-08-09

    • ssdk removed (useless for now)
    • Patch updates
    • Minor improvements
    • Nightlies fixed
    • Upstream updates
  • 2017-08-03

    • Updated patches
    • Upstream Updates
  • 2017-07-02

    • Re-added ath9k-htc and a couple of other recently "lost" kmods
    • Upstream updates
  • 2017-07-01

    • Fixed issue with FastPath not being included
    • Adjusted several patches
    • Upstream updates
  • 2017-06-29

    • Switched to MIPS 24kc, which means you can now use the official LEDE repository to install and update packages
    • Hardware NAT support added
    • Qualcomm Fast Path added
    • Updated all of gwlim's patches & added a couple of new ones
    • Added ds-lite, map-t, xl2tpd and ssdk_sh
    • tor removed (install with opkg if you need it)
    • Used binutils 2.28
    • Upstream updates
  • 2017-05-22

    • Added ath9k firmware modules
    • Added openvpn-easy-rsa
    • Upstream updates
  • 2017-04-27

    • Moved from OpenNIC to OpenDNS (they dropped port 443 support)
    • Upstream updates
  • 2017-04-08

    • Re-added netfilter modules present on vanilla LEDE
    • Removed AOE and ATA related kernel modules
    • Upstream updates
  • 2017-04-04

    • ca-bundle added
  • 2017-04-02

    • Upstream updates
    • Added patches and files source code
    • Added nightly builds based on latest release configs to keep up with upstream developments
  • 2017-04-01

    • pppossh added
    • openssh-sftp-server added
    • Many netfilter modules removed to increase throughput
    • Kernel settings fine-tuned (sysctl)
    • Many of gwlim's patches cherry picked & ported
    • Many minor changes aimed at improving performance
  • 2017-03-19

    • Upstream updates
    • Switched to LuCI Material theme
    • TOR support added
    • rfkill support added
    • ca-certificates added
    • LuCI simple-adblock added
    • Possible performance improvements
    • MIPS16 instructions removed
    • Switched from ath10k-ct to vanilla ath10k
  • 2017-03-01

    • Upstream updates
  • 2017-02-22

    • Upstream updates
  • 2017-02-19

    • Upstream updates
  • 2017-02-14

    • Upstream updates
    • Replaced wpad-mini with wpad
    • Added hostapd-utils
  • 2017-02-13

    • Upstream updates
    • Minor bug fixes
  • 2017-02-09

    • Upstream updates
    • openssl-util added
  • 2017-02-08

    • Upstream updates
  • 2017-02-07

    • Upstream updates
    • More gcc optimizations
    • DNSCrypt added
    • Added config to GitHub repo
  • 2017-02-06

    • Upstream updates
    • Added rsync
    • BCP38 added (including LuCI app)
    • Compile everything with -O3 and -march=74kc
    • Use GCC 6.3
  • 2017-02-05

    • Upstream updates
  • 2017-02-04

    • Initial release
14 Likes

@DjiPi Basically opkg wasn't working properly because of checksum mismatches (going to be the same with my own build though, but it includes what I would have installed already) and some packages were missing completely because the buildbot server ran out of disk space, ie. not all packages for RC1 were built.

Then, even after manual installation of SQM packages with --force-checksum, the SQM settings weren't taking effect, eg. I could set 1Kbps ingress and egress limits and clients would still get full speeds in Mbps ranges. After this I decided to just do my own build instead of spending more time on fixing my RC1 install.

I might add that according to @jow at least the issue with missing packages in RC1 should be fixed now though and that RC2 should be ready soon.

Anyway, in case your requirements are similar as mine and you'd want to give my build a spin: I'm compiling a new one right now with only upstream updates.

Thanks for this.

A few things that could be changed/added:

  • How about DNSCrypt/DNSSec support
  • TCP BCP38
  • Stats packages

Then, it would be good to try to recompile everything with -O3 to optimize for speed and, remove debug symbols and the likes.

I would suppose that people will be interested in maximizing OpenVPN speed, so would be good to report on what can/is achieved by with this build.

1 Like

Thanks for your feedback, I appreciate it!

I'll consider it. Downsides would be a small performance penalty and a more bloated firmware. Anyone else needing this?

bcp38 can be easily added by just dropping internal and reserved ranges on WAN, which can be done with what this firmware already includes (it does support ipset too, just like most netfilter modules). I'm going to add it regardless due to small overhead.

That's actually included already, just not listed in features, I'll add it there too.

Debug symbols are already being removed, however I indeed didn't set -O3 for GCC - good catch![quote="deuteragenie, post:5, topic:1382"]
would be good to report on what can/is achieved by with this build.
[/quote]

You're welcome to run some benchmarks. I didn't have time for this yet, but it's definitely on my todo.

Great!

I actually don't need DNSCryprt/DNSSec, or much of the other stuff. But I believe that some may, and if your purpose is to have an as-OOB-as-possible build, then probably they should be in.

BCP38: I include that module in my home builds (just called bcp38 if I remember correctly), and there must be Luci support for it.

I forgot to mention: I run my builds with gcc 6.3 without any issue - you may wish to try it for yours.

And, as your build is targeted at one specific processor, you may wish to look at the -march options or similar, in the hope of getting that 0.01% performance increase :).

Maybe other users would be interested in adblocks too ?

On mine, the 5 Ghz LEDs are actually on when the 2.4 Ghz channels are on. I guess a little bug (or maybe due that I disabled the 5 Ghz stuff altogether)

My goal is to build something in between most other "optimized" builds which are too bloated for my taste and the vanilla builds which lack too many kernel modules, packages and compiler optimizations.

Awesome, I'll give this a spin within the next couple of days. Thank you for sharing your experience.

Using that already.

I'll likely not add this either. There are just too many other options for ad blocking (uBlock, hosts file on connected devices, DNS that blocks ads, etc.) which is why I don't want to impose the adblock package on everyone using this build.

P.S. I just pushed a new build.

Hi r00t,

It's posible to "upgrade" to your version of firmware without loosing our working config (wifi,network,vlans...) coming from the "official" LEDE Project?
It's just installing the sysupgrade (like LEDE), or maybe is better coming from a "fresh" install?

Thanks a lot for your time and effort r00t,

Yes, it's possible, I did the same. Just select preserve settings when flashing the sysupgrade image.

Also I'm trying the third build today shortly on my router, which uses gcc 6.3 and binutils 2.27, so if don't want to flash the firmware right away, you'll be able to download a slightly faster one shortly.

I will wait until weekend to update.

Thanks a lot r00t,

1 Like

Don't forget to add gcc 6.3 to your release notes....:slight_smile:
And, one other important issue:
Could you load your scripts/configs to github ? Unless I "see the source", I, for one, would not install any firmware on my routers (I know, some blobs are still around).

If it' s optimized, why not compile it with march=74kc?

1 Like

Great idea, thanks for pointing me into that direction! I'm new to LEDE/OpenWRT and building router firmware in general, so your advice is really appreciated. It didn't even cross my mind that the CPU would support anything but 24kc coming from i836/amd64 only environments.

Yep, 74kc for that one...
Here are the arm GCC options:
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#ARM-Options
Look at -march and -mtune (although the experts will tell that it does not have any impact on speed for these CPUs)

Also, you can try other GCC optimizations that go beyond -O3, but I wouldn't know how to make sure that everything will still work (BTW, on my routers - Archer C7v2 and 842N, I compiled everything with GCC 6.3, but did not try -O3 or -march - mtune).

Thanks. I'm familar with GCC options coming from UNIX systems, just these CPU architectures are new to me. Also running into several issues with GCC 6.3 which I'm still busy solving (same configs worked fine with GCC 5).

FYI - for my builds, I just turned on GCC 6.3 from menuconfig, and all was fine,.,

Thanks for that info @deuteragenie. However, I did the same and run into several errors. Solved two already, but they keep coming. Do you also use binutils 2.27? Maybe that's causing the issues or I'm just using different packages than you are.

I used the "standard" git pull of head and did not change anything else than a few items (including switching to gcc 6.3) through menuconfig. This was about one month ago.

Um, it worked now with -j1 when it failed with -j8. Takes forever with one core when HT is enabled, but hey, at least it worked now. Will push the update shortly.

P.S. New build is online.

Interesting. I compiled mine without problems at -j9 on 8 cores.

You can always try to unroll some or all loops and see what gives... as you need to deserve the "Optimized" in your announcement, right ?: gcc -O3 -funroll-loops or -funroll-all-loops

Or compile and run with the profiler enabled, and use -fbranch-probabilities for the second compile... possibilities are endless to win 0.3% performance!

Also, I believe that you should use the following: -march=mips32r2 -mtune=74kc (and not -march=74kc, is this even allowed/documented?)

Well, unrolling loops causes a further increase in file size. Particularly the positive effects of unrolling all loops is questionable - the gcc documentation even mentions that this would slow down programs. I'll stick to safe and stable options to avoid turning this into an experimental build.

PS: I use both mtune and march.