User Tools

Site Tools
This wiki is read only and for archival purposes only. >>>>>>>>>> Please use the new OpenWrt wiki at <<<<<<<<<<

TP-Link TL-MR3420 & TL-MR3220 Howtobuild



This only have to be done once in a lifetime.

cd ~
mkdir -p build/openwrt
mkdir build/dl
mkdir -p build/files/ar71xx
cd ~/build/openwrt
svn co -r $r svn://
cd ~/build/openwrt/trunk
ln -sf ../../dl
ln -sfn ../../files/ar71xx files
cp -p scripts/feeds scripts/feeds.sed

Start over

When all else fail.

cd ~/build/openwrt/trunk
rm -fr staging_dir build_dir bin broken_packages
make distclean
ln -sf ../../dl
ln -sfn ../../files/ar71xx files
svn up -r $r

Sync with current snapshot

Lazy people don't like to spend hours compiling packages you will never use. Instead, download them all and compile your image in a few minutes.

This is where the value of "r" come from.

Current snapshot last for 24 hs, lately. Sync has not much sense, then.


Browse to and look the value of base-files_??-r?????_ar71xx.ipk

(At the time of writing this guide)


cd ~/build/openwrt/trunk
wget -N $baseurl$platform/packages/Packages.gz
r=$(zgrep base-files_ Packages.gz | sed -e 's/^.*-r\(.*\)_ar71xx.ipk/\1/')

kmod compatibility hack

After r29686 opkg spit all kmod-* packages not compiled by yourself. There should be a good reason for that, but I take the risk.

grep vermagic include/
	$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
That line creates the "incompatibility"
cd ~/build/openwrt/trunk
zgrep -m 1 "Depends: kernel (=.*)$" Packages.gz | sed -e 's/.*-\(.*\))/\1/' > .vermagic
sed -i -e 's/^\(.\).*vermagic$/\1cp $(TOPDIR)\/.vermagic $(LINUX_DIR)\/.vermagic/' include/
Now, that line creates the "compatibility"
grep vermagic include/
	cp $(TOPDIR)/.vermagic $(LINUX_DIR)/.vermagic
Use at your own risk.

Every day standard compile

cd ~/build/openwrt/trunk
svn up -r $r
./scripts/feeds update -a | grep revisi
# packages 28574 xwrt 4986 luci 7776
luci=$(zgrep luci_ Packages.gz | sed -e 's/^.*svn\([0-9]*\).*/\1/')
# luci=7771
sed -i -e "s/\"svn update.*\",/\"svn update -r $r\",/" ./scripts/feeds.sed
./scripts/feeds.sed update packages
sed -i -e "s/\"svn update.*\",/\"svn update -r $luci\",/" ./scripts/feeds.sed
./scripts/feeds.sed update luci
./scripts/feeds install -a
echo CONFIG_TARGET_ar71xx=y > .config
make defconfig
make download
make world
If vanilla build exit with error, current trunk is broken, checkout again tomorrow. Else, is time to add some packages: 1)

echo "CONFIG_TARGET_ar71xx=y
# CONFIG_TARGET_ar71xx_generic_Default is not set
CONFIG_PACKAGE_kmod-input-gpio-keys-polled=y" > .config
make defconfig
make download
make world
ls -lat bin/ar71xx/

Step by step

We have very few differences with MR3420, however I go step by step.

Visit build and buildroot.exigence for a comprehensive explanation about everything you need.

For MR3220 need to use Development Sources, select a place for buildroot and do:

 svn checkout svn://
 cd trunk
 make menuconfig

If success (check buildroot.exigence if any error) then select:

Target System (Atheros AR71xx/AR7240/AR913x/AR934x)  ---> 
Target Profile (TP-LINK TL-MR3220)  --->

Exit and save changes. If you like default configurations (little, similar that snapshots but without extra modules to compile) do:

make defconfig

But it's very basic. if you like add modem-3g support2) or LuCi (i.e.) you need feeds:

./scripts/feeds update -a

and install all feeds (not recommended but look for PACKAGE_usb-modeswitch on submenu "Utilities"…) 3)

./scripts/feeds install -a

or select by name:

./scripts/feeds install -a -p luci

With a new "make menuconfig" you see a lot of new options. Select all modules that you like, but only those packages you want to use (built in -*- or not -M-), and note that each package selected, it automatically selects proper dependencies. No need to worry about those do not select, because those are not going to download and compile.

Stability warning In principle not a good idea to deselect a package, to avoid compilation, but download it later from the snapshots: that may mean we have a "kernel panic" and a lot of runtime errors, since the kernel is not prepared to work with it. If you want to add more features and packages. then recompile to add support. Any generic image from snapshots have all packages selected as modules.

it only remains to compile (need internet access, you can use "make download" before to prepare the compilation):



make V=99

If success you can find a trunk/bin/ar71xx with factory and sysupgrade images, along with the packages you have selected to compile on trunk/bin/ar71xx/packages

Configuration by default

If you have a compatible backup of configuration (such as those through LuCI) you can enter it in your image, so as simple as creating a folder called trunk/files and unzip the contents there, for example the file trunk/files/etc/config/network with the correct settings for 3g modem. 4)

Local server

In case of conflicts between versions if the installed version is older than snapshots (or may not yet have an internet connection configured correctly), a way to fix is have a local server with our compiled packages: on your computer copy trunk/bin/ar71xx/packages over /srv/ftp/packages (vsftpd default with anonymous enabled), and on router edit first line on /etc/opkg.conf:

 src/gz snapshots

A simple "opkg update" and you will see that it work.

At Work

Due to the recent addition to OpenWrt, it is likely that this will improve support for this router, so we can take a look at the scripts to update the code in the first part of this howto about MR3420. However, basic command, before run make over trunk directory, is:

svn update
./scripts/feeds update -a

And remember do a previous backup of your .config, it's easy to be overwritten in the process. But it may not be advisable to recover the backup directly, because it may have added new options or packages. An easy way to see the differences is through diff command.


  1. For add support for wireless channels 12-13 (with legal use out of US) try to add CONFIG_ATH_USER_REGD=y on .config (but check #10496 if it don't work). Also, you need install kmod-wprobe.
  2. In case squashfs image that does not appear or is not updated, after compiling, it means the final size exceeded the limit of 3.8 megabytes. We have to do without some packages, just changing them as modules (marked "m") and install them later with opkq if we have space with a extrootfs (but keep in mind that any kermel module needed in the boot should not stay in the extroot).
  3. jffs2 errors from compiled images when the sysupgrade image file size is bigger than 3.585kB ( 3,5 MiB or 3670020 bytes ) #10719 (if overlay no init is difficult make a working ext-overlay)
CONFIG_PACKAGE_block-extroot=y is ignored on trunk, just CONFIG_PACKAGE_block-mount=y. As of r26314 block-extroot and block-hotplug have been merged with block-mount.
TODO: Detailed reference of feeds USB and 3g support
Also we can try with ./scripts/feeds update packages and ./scripts/feeds install packages
ISP number can be fixed on trunk/package/comgt/files/
doc/howtobuild/ · Last modified: 2012/07/11 09:08 by nilfred