----------------------------------------------------------------- DIFFUSE for OpenWRT: Building Firmware (released 13th April 2012) ----------------------------------------------------------------- This document is part of DIFFUSE for OpenWRT: http://caia.swin.edu.au/urp/diffuse/ http://caia.swin.edu.au/urp/diffuse/openwrt/ It provides instructions for building OpenWRT firmware and installing DIFFUSE packages see also: http://http://caia.swin.edu.au/urp/diffuse/downloads/DIFFUSE-VirtualBox-howto.txt http://http://caia.swin.edu.au/urp/diffuse/downloads/DIFFUSE-Install-Firmware-howto.txt http://wiki.openwrt.org/doc/howto/buildroot.exigence http://wiki.openwrt.org/doc/howto/build (less helpful but some good info) http://wiki.openwrt.org/doc/devel/packages INTRODUCTION ------------ If you want to build your own firmware (to try DIFFUSE on a router other than the TP-Link WR-1043ND) you will need to use the OpenWRT build system. DIFFUSE has been tested with: - OpenWRT Attitude Adjustment (bleeding edge) r29537 If you decide the use the VirtualBox VMs from the DIFFUSE website, you can skip the PREPARING SYSTEM section and go directly to BUILDING (as the VMs come with sources and packages ready-to-go). DO visit the OpenWRT build page (link at the top of this page) - there is a lot of helpful information that will help in setting up your system and building firmware and packages. Consider this howto a subset of the information available at the OpenWRT site. Following this guide will allow you to build firmware for a DIFFUSE AN+CN, and with a few additional steps, a DIFFUSE AN. PREPARING SYSTEM ---------------- OpenWRT Buildroot - http://wiki.openwrt.org/doc/howto/buildroot.exigence Ubuntu requirements (see OpenWRT page for other distributions): sudo apt-get install build-essential subversion libncurses5-dev \\ zlib1g-dev gawk gcc-multilib flex git-core unzip Fetch sources and configure: You do not need to be root when building. I prefer to start from my home directory. Just making a folder for the sources ~: mkdir openwrt ~: cd openwrt This will pull the specific revision that DIFFUSE was tested with ~: svn co -r 29537 svn://svn.openwrt.org/openwrt/trunk/ trunk is the root folder of the source. make commands are issued from this folder. BUILDING -------- ~: cd openwrt/trunk ~: make defconfig ~: make prereq ~: make menuconfig Calling make menuconfig will bring up a graphical configuration for the firmware. All the packages required to use DIFFUSE as a CN+AN are selected by default. To use the router as an AN (with the DIFFUSE collector), there are additional steps to take after the build is complete. See INSTALLING 'AN' PACKAGE. The 'Target System' and 'Target Profile' are also set for the TP-Link WR-1043ND.(Target System -> Atheros AR71xx/AR7240/etc.. and Target Profile -> TP-LINK TL-WR1043N/ND) Change this to build images for a different router. Exit and save the configuration. Finally build the image using ~: make If you are building for the first time it will take a while to compile (additional sources will be fetched, so Internet access is required). Once complete the images are located in trunk/bin/ar71xx/ (it will be something else if you had a different target system). for the TP-1043ND the image to use is called: - openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-factory.bin - openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin Most often you should use the factory image unless you have an existing install of OpenWRT on your router and want to perform a sysupgrade (and keep some of your configuration). INSTALLING 'AN' PACKAGE ----------------------- To run as an AN, you will need to build and install the 'ipfwcol' package. In this example ipfwcol and sctp are built into the firmware. If you want to build them as seperate packages (in the event that you have already installed the DIFFUSE firmware built in the above section, then use the option in menuconfig). For a general guide on installing pacakges, see: http://http://caia.swin.edu.au/urp/diffuse/downloads/DIFFUSE-Build-Packages-howto.txt See the OpenWRT documentation on packages for more in-depth info. http://wiki.openwrt.org/doc/howto/build#building.single.packages After the packages are built, they can be found in bin/ar71xx/packages. ipfwcol requires libsctp to install on OpenWRT get sctp from svn (call from trunk folder): ~: svn export svn://svn.openwrt.org/openwrt/packages/libs/sctp package/sctp run make menuconfig and set Network -> sctp to <*> ~: make package/sctp/compile V=99 run make menuconfig and set Utilities -> ipfwcol to <*> make sure that the /usr path in ipfwcol/src/Makefile is set to the /usr path in the toolchain. E.g: - trunk/staging_dir/target-mips_r2_uClibc-0.9.32/usr/ make package/ipfwcol/compile V=99 The firmware will be rebuilt with sctp and ipwcol included. If you used the option (packages): This will generate the ipkg files and place them in the packages folder (bin/ar71xx/packages) now you can scp the ipkg files onto the router and install them using: - opkg install sctp_1.0.11-1_ar71xx.ipk - opkg install ipfwcol_1_ar71xx.ipk COMMON COMPILING PROBLEMS ------------------------- Make flags: The OpenWRT build documentation mentions that using "-j" with 'make' can cause 'random build errors'. Using 'make' without this option may prevent some errors. There could be a number of issues that occur when trying to build packages. This is not an exhaustive problem solving guide but may be helpful in some cases. If you have problems compiling (such as with paths), try the following: replace -I/usr/include with -I/home//trunk/openwrt/staging_dir_mipsel/usr/include in the Makefile of the package you are trying to build. Cross compiling kernel modules: set the path PATH=$PATH:/home//openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/bin/ CONTRIBUTIONS ------------- We welcome your feedback and contributions! If you have discovered a bug, have a request for a new feature, have produced a code patch or a new classifier model, please contact Nigel Williams (njwilliams@swin.edu.au). CONTACT ------- The DIFFUSE website is: http://www.caia.swin.edu.au/urp/diffuse If you have any questions or want to report any bugs please contact Nigel Williams (njwilliams@swin.edu.au). Centre for Advanced Internet Architectures Swinburne University of Technology Melbourne, Australia CRICOS number 00111D http://www.caia.swin.edu.au