Crosscompile OpenWRT

# installing required libraries 
apt-get install -y subversion build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl unzip

# create user for compile process
useradd -m openwrt

# login as openwrt
su openwrt

# download OpenWrt
svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk
./scripts/feeds update -a
./scripts/feeds install -a

# configure OpenWRT
make defconfig

# compile OpenWRT
make -j$(cat /proc/cpuinfo | grep processor | wc -l)

# download lyc
wget -q https://github.com/panticz/lyc/archive/master.zip -O /tmp/master.zip
unzip -q /tmp/master.zip -d ~/trunk/staging_dir

# compile lyc
cd ~/trunk/staging_dir/lyc-master
make mips

# copy file to router
scp ./lyc root@openwrt:/root
>

Compile for x86

sudo apt-get install -y --force-yes subversion libncurses5-dev libghc6-zlib-dev flex build-essential
cd /tmp
svn checkout svn://svn.openwrt.org/openwrt/trunk
make menuconfig

Links
http://wiki.openwrt.org/doc/howto/build
http://wiki.openwrt.org/doc/devel/crosscompile
http://wiki.openwrt.org/doc/howto/buildroot.exigence
http://www.ffnn.nl/pages/articles/linux/cgi-scripting-tips-for-bash-or-sh.php