Here are the procedures and required packages for installing an OpenWRT build environment on Ubuntu.
Consult the OpenWRT Wiki first then issue the commands.
sudo apt-get install git openssl libssl-dev unzip build-essential binutils flex bison autoconf gettext texinfo sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gawk python
git clone git://git.openwrt.org/15.05/openwrt.git
NEW: git clone https://github.com/openwrt/openwrt
./scripts/feeds update -a
./scripts/feeds install -a
wget -O .config https://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/config.diff
make defconfig
make menuconfig
make prereq
and we have 2 ways to reduce the build time:
sed --in-place=.bak -e 's/=m$/=n/g' .config
to disable all optional modules in the beginning
or
make -j4 V=s IGNORE_ERRORS=m
to ignore all broken packages while building.