Building OpenWRT on Debian 6

From Qi-Hardware
Jump to: navigation, search


Alternative to setting up your own environment on Debian: Using a ready Virtual Appliance

You may like to use a ready virtual machine to compile for the Nanonote, with Debian Squeeze and OpenWRT XBurst Development Tools installed. You can use such a setup for porting or compiling individual packages, as well as building the software image. A distributed for sharing virtual machine image is called a Virtual Appliance, and it can be run using VirtualBox or VMWare Player. A Virtual Appliance for compiling for the Nanonote is available here ( http://4pp1qh.1fichier.com/en/ ). Install VirtualBox, Download the Virtual Appliance, Import the Appliance into VirtualBox and start it. The username is "build", and the user and root password is "gongshow". The MD5 sum of the Virtual Appliance's .OVA file is 3ad6e2aa9379336c10746a3062538d32

If you use a ready Virtual Appliance, you will not need to follow the steps below, as they were already done for you.


Setting up your own environment on Debian Squeeze: Current for the 2011-08-27 image

To Build OpenWRT's Development Tools on Debian Squeeze you will need Debian Squeeze (OpenWRT recommends using a Virtual Machine dedicated to compilation), your user account in the sudoers file, and a working internet connection. The following script will take care of the rest: set up the en_US.UTF-8 locale, install dependency packages, prepare your config file, and generate Qi feeds. Feel free to save and run it "as is" on top of a Debian Squeeze install, or adopt snippets if you got stuck:

#!/bin/bash
#
# OpenWRT-XBurst Development Tools build script for Debian
#
# Adapted for Debian from http://en.qi-hardware.com/wiki/Building_Software_Image
# and from http://en.qi-hardware.com/wiki/Building_OpenWRT_on_Debian_6
# by Ernest Kugel, 2011, erik.kugel@gmail.com
#
#
# Ensure en_US.UTF-8 UTF-8 locales are enabled and generated:
if grep "^en_US.UTF-8 UTF-8" /etc/locale.gen; then
  echo "locales OK..."
else 
  sudo bash -c 'grep "# en_US.UTF-8 UTF-8" /etc/locale.gen | sed "s/\# //" >> /etc/locale.gen'
  sudo locale-gen
fi
#
#
# Ensure dependecy packages are installed through Aptitude:
sudo apt-get install --yes\
 python sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils\
 gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath flex\
 libncurses5 libncurses5-dev libxml-simple-perl zlib1g-dev pkg-config gettext libxml-simple-perl guile-1.8\
 cmake libssl-dev xsltproc fastjar libdbus-glib-1-dev mercurial\
 pngcrush imagemagick
#
#
# Clone the GIT repository from Qi:
git clone git://projects.qi-hardware.com/openwrt-xburst.git
cd ./openwrt-xburst/
#
#
# Get the latest VERSIONS file and checkout the latest local build:
wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/VERSIONS"
git checkout -b local-build `grep 'master' ./VERSIONS | sed 's/^.* //'`
#
#
# Download .config file and prepare feeds:
wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/config -O .config
wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/feeds.conf
make package/symlinks
#
#
# Prepare .config file and link Qi files needed for compilation:
sed -i '/CONFIG_ALL=y/d' .config
sed -i '/=m$/d' .config
yes "" | make oldconfig
ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files
#
#
# Compile the development tools using the lowest IO and CPU priorities,
# while logging all output from STDOUT and STDERR to a labeled by date file:
ionice -c 3 nice -n 20 make V=99 2>&1 | tee ~/openwrt-xburst_build_`date +%Y%m%d-%H%M%S`.log
#
#
# At this point, the toolchain should be located under
# ~/openwrt-xburst//staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin


Setting up your own environment on Debian

OpenWRT does not need root privileges to build.

First, ensure that the UTF-8 locale is available ( because some part of the build will fail without it):

sudoedit /etc/locale.gen

Ensure that there is an ( uncommented) line that reads:

en_US.UTF-8 UTF-8

..then:

sudo locale-gen

Next:

cd  # start in the home directory
sudo apt-get install --no-install-recommends \
  bzip2 \
  flex \
  g++ \
  gawk \
  gcc \
  gettext \
  git \
  guile-1.8 \
  libncurses5-dev \
  libpng12-dev \
  libssl-dev \
  locales \
  make \
  patch \
  python \
  rsync \
  subversion \
  tcl8.4 \
  unzip \
  xsltproc \
  zlib1g-dev  # Some are required to build the tool chain, some for certain packages
git clone git://projects.qi-hardware.com/openwrt-packages.git
git clone git://projects.qi-hardware.com/openwrt-xburst.git
cd openwrt-xburst/
git tag
git checkout release_2011-02-23  # alsa-lib Depends on !TARGET_xburst_qi_lb60 without this
cat <<EOF > feeds.conf
src-svn packages svn://svn.openwrt.org/openwrt/packages
src-link qipackages /home/$USER/openwrt-packages
EOF
wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/config" -O .config
sed -i '/CONFIG_ALL=y/d' .config
perl -i -pe 's/CONFIG_PACKAGE_(.+)=[ym]/CONFIG_PACKAGE_$1=n/ unless m/CONFIG_PACKAGE_kmod-(input|sound)/' .config
perl -i -pe 's/CONFIG_PACKAGE_wireless-tools=./CONFIG_PACKAGE_wireless-tools=m/' .config
make package/symlinks
cp feeds/qipackages/alsa-lib/patches/002-versionsort.patch feeds/packages/libs/alsa-lib/patches/
nice -19 make V=99

~/openwrt-xburst$ du -s * | sort -n
...
1476    tools
12456   package
12792   tmp
17288   toolchain
17864   target
62744   bin
66420   feeds
175644  staging_dir
209672  dl
3173940 build_dir

The last command gives a rough idea of disc space required for a very minimal build.

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export