Building from source

sudo apt-get install subversion git-core build-essential libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs

Reference: https://dev.openwrt.org/ticket/12181#comment:52

mkdir /var/lib/building/openwrt-trunk
cd /var/lib/building/openwrt-trunk
git clone git://git.openwrt.org/openwrt.git
git clone git://git.openwrt.org/packages.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

In the above step, we checked out the latest source from the various git repositories but if we come back at some later date, we'll want to update our copy of the source before building again.

cd /var/lib/building/openwrt-trunk/openwrt
git pull
./scripts/feeds update -a
./scripts/feeds install -a
cd /var/lib/building/openwrt-trunk/openwrt
make menuconfig

To build for the TL-WDR4300:

  • Target System
    • Atheros AR7xxx/AR9xxx
  • Target Profile
    • TP-LINK TL-WDR3500/3600/4300/4310/MW4350R

I also made the following customizations:

  • LuCI
    • Collections
      • luci
      • luci-ssl
  • Administration
    • zabbix (at time of writing this is version 2.0.8)
      • zabbix-agent
      • zabbix-agentd
      • zabbix-extra-mac80211
      • zabbix-extra-network
      • zabbix-extra-wifi
      • zabbix-get
      • zabbix-sender

I encountered an issue with OpenWRT failing to properly configure the VLAN configuration on the TL-WDR4300's switch. The details of the issue can be found here: #12181 (VLAN tagging of TP-Link WDR4300 v1.1)

At the time of writing, the user K had created a new version of the file ar8216.c that fixed the issue. Download this file and apply it to our source:

cd /var/lib/building/openwrt-trunk
wget -O ar8216.c-1.1 http://pastebin.com/raw.php?i=6pR6c0Rn
cp ar8216.c-1.1 openwrt/target/linux/generic/files/drivers/net/phy/ar8216.c

In the event that the pastebin.com URL dies, I have stored a copy of K's modified file here: ar8216.c

Before you start the build process you should:

  • Make sure you have plenty of free disk space. I'd suggest at least 10Gb.
  • Unless you have a very fast machine doing your building, it's going to take a while. I haven't specifically timed it but it's hours, not minutes.
cd /var/lib/building/openwrt-trunk/openwrt
make

If all went well, head over to /var/lib/building/openwrt-trunk/openwrt/bin/ar71xx and you should find a suitable image for your device. For the WDR4300, the files are:

  • To upgrade your current OpenWRT installation: openwrt-ar71xx-generic-tl-wdr4300-v1-squashfs-sysupgrade.bin
  • For a fresh install from the factory firmware: openwrt-ar71xx-generic-tl-wdr4300-v1-squashfs-factory.bin