Tuesday, February 28, 2012

Build OpenWRT on WR1043ND from SVN

1)Install necessary packages (osx)
$port install macports packages:
$port install coreutils asciidoc binutils bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurse
$port install e2fsprogs ossp-uuid
$port install findutils

2)Create Work Image (osx)
open Disk Utility in the /Applications/Utilities directory.
Click File -> New -> Blank Disk Image...
Name = OpenWRT
Choose a size = 4.5GB.
In Format drop down, select Mac OS Extended (case-sensitive)
Image Format= sparse disk image
it will mount it on /Volumes/OpenWRT

3)get last sources
$cd /Volumes/OpenWRT
$svn co svn://svn.openwrt.org/openwrt/trunk/

4)Make configuration and compile

$make menuconfig

choose Target System Atheros AR7xxx/AR9xxx
choose Target Profile (TP-LINK TL-WR1043N/ND)

$make -j 3

after approx. 45mn on a core 2 duo

5)Flash router
$cd ~/openwrt/trunk/bin

locate image
openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-factory.bin (for first time flash, IMPORTANT: note tested)
openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin (for OpenWrt Upgrade)

flash using web interface, wait for 5mn

6)Configure router

There might be quite a lot of missing packages, you need to install manually.

connect internet cable on WAN port
#ping www.nthinking.net
#opkg update
#opkg install l2tpv3tun
#opkg install luci
#mv /etc/config/luci-opkg /etc/config/luci
#/etc/init.d/uhttpd enable
#/etc/init.d/uhttpd start

opkg install perl
opkg install perlbase-base
opkg install perlbase-essential
opkg install perlbase-autoloader
opkg install perlbase-config
opkg install perlbase-config
opkg install perlbase-getopt

opkg install openswan

Here you are, you now have a fully l2tpv3tun enabled, web interfaced, gigabit Ethernet router!

L2TPV3 commands

#l2tpv3tun show tunnel
#l2tpv3tun show session

Further readings on playing with l2tpv3:
http://www.openl2tp.org/pipermail/openl2tp-users/2010-April/000836.html (Linux specific)

Useful commands:
If you can't ping the router anymore, after reset, press QSS on reboot when sys is blinking (it will blink faster), then you can $telnet
then type
#mtd -r erase rootfs_data
this flush everything back to default (and auto reboot)

Restart the network services:
#/etc/init.d/network restart

Verify syntax on /etc/config/network config (IMPORTANT if you don't want to reboot with a wrong config that will force you to use the commands below):
#uci show network

Query a specific interface status:
#uci -P/var/state show network.wan

And last but not least, how to stop vi from stupidly indenting your PASTE:
:set noai

Labels: , , ,

This page is powered by Blogger. Isn't yours?