Custom OpenWRT Image

On the router used at the vacation house, the disk size is very limited. To get SVT play and our Apple TV to think we’re still in Sweden, I needed OpenVPN. The default OpenWRT image I installed didn’t have enough room to fit the openvpn package. So I made an attempt to fix this using a custom build of OpenWrt Attitude Adjustment 12.09.

Instructions here are a summary of the work carried out, as layed out on OpenWRT’s wiki page for custom builds.

root@OpenWrt:/etc# cat banner 
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 ATTITUDE ADJUSTMENT (12.09, r36088)
 -----------------------------------------------------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@OpenWrt:/etc# cat openwrt_*
DISTRIB_ID="OpenWrt"
DISTRIB_RELEASE="12.09"
DISTRIB_REVISION="r36088"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"
DISTRIB_DESCRIPTION="OpenWrt Attitude Adjustment 12.09"
12.09
root@OpenWrt:/etc# cat /proc/cpuinfo 
system type   : Atheros AR9330 rev 1
machine	    : TP-LINK TL-WR741ND v4
processor   : 0
cpu model   : MIPS 24Kc V7.4
...

The LuCI UI however reported the model to be TP-Link TL-WR740N/ND v4. Now that we know what we’ve got, lets get the custom image builder. The sticker at the bottom of the device says: TL-WR740N Ver.4.26

For sake of fallback options, downloaded the stock firmware from TP-Link’s site.

Get list of currently installed packages:

root@OpenWrt:/etc# echo $(opkg list_installed | awk '{ print $1 }')

Packages I don’t need (USB and PPP):

kmod-ppp kmod-pppoe kmod-pppox kmod-usb-core kmod-usb-ohci kmod-usb2
ppp ppp-mod-pppoe

Saving current network config (and SSH key config):

mkdir -p files/etc/config
scp root@192.168.1.1:/etc/config/network files/etc/config/
scp root@192.168.1.1:/etc/config/wireless files/etc/config/
scp root@192.168.1.1:/etc/config/firewall files/etc/config/
...

And to build the thing

wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2
tar -xvjf OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2
cd OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486
make image PROFILE=TLWR740 PACKAGES="... rather long list ..." FILES="../files/"

Get the sysupgrade.bin file and upload it in the LuCI admin UI.

To be continued …

This work by Fredrik Wendt is licensed under CC by-sa.