OpenWRT Development with Eclipse

Home / OpenWRT Development with Eclipse

OpenWRT Development with Eclipse

December 9, 2015 | Uncategorized | No Comments

It is interesting deploying a small router using OpenWRT, turn a $20 into a multipurpose box. But, can we extend it’s awesomeness to something more? Yes, we can. We can write and develop an application for running inside of OpenWRT. Creating our own OpenWRT application in fact is not so difficult to do.

OpenWRT utilize machine with different architecture and system compared to our machine. Therefore, we can’t use our gcc on our machine to build an OpenWRT application. To do so, we will build the suitable compilers and other utils. In other words, we will create a cross-toolchain.

In this article, we will discuss about preparing environment for developing OpenWRT’s application. The language used for development is C\C++ and the IDE used will be Eclipse.

For this article I use:

  1. Slackware64 14.0
  2. OpenWRT Buildroot
  3. Eclipse Juno

For simplicity, we will break down the set up into smaller categories.

OpenWRT Buildroot Installation

OpenWRT Buildroot is a set of Makefiles and patches that allows us to easily generate both a cross-compilation toolchain and a root filesystem for embedded systems, especially OpenWRT. The OpenWRT buildroot is a heavy modification of Buildroot. The cross-compilation toolchain uses uClibc, a tiny C standard library.

Prerequisites

  1. 350MB of hard disk space for source files to download.
  2. 3-4GB of available hard disk space for building process (OpenWRT).

Another things to prepared are packages for building the Buildroot. Make sure we have these all:

  1. asciidoc
  2. bash
  3. binutils
  4. bzip2
  5. fastjar
  6. flex
  7. git
  8. g++
  9. gcc
  10. getopt
  11. GNU awk (gawk)
  12. gtk2.0-dev
  13. intltool-update
  14. jikes
  15. libz
  16. make
  17. ncurses
  18. openssl/ssl.h
  19. patch
  20. perl-ExtUtils-MakeMaker
  21. python2.6
  22. rsync
  23. ruby
  24. sdcc
  25. unzip
  26. wget
  27. working sdcc
  28. xgettext
  29. xsltproc
  30. zlib

Assume our build directory will be on ~/openwrt and when it is done, the cross-toolchain will be installed on /opt/OpenWRT.

Installation

Before proceeding, make sure you have svn installed!

First we need to create the working directory ~/openwrt and download the required source code form svn repository. It should be around 14.382 files with overall size of 150MB.

Now, do these commands as non-root user.

mkdir ~/openwrt
cd ~/openwrt
svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk

Check the missing packages on system used for building OpenWRT on. Use one of the following ommands:

make defconfig
make prereq
make menuconfig

Eclipse

Eclipse will act as our development environment. If you don’t install it yet, you should install it. You can follow this article for Eclipse installation on Linux.

Once Eclipse installed, all we have to do is install additional eclipse packages.

Start eclipse. Now navigate to:

Help -> Install New Software -> Add

enter the following information:

Name: Juno Download

Location: http://download.eclipse.org/releases/juno/

Click on OK. Now expand the Mobile and Device Development  section and check the C/C++ GCC Cross Compiler Support and Remo System Explorer End-User Runtime. Click Next to begin installation. After installation you will be prompted to restart the eclipse, do so.

, , ,

About Author

about author

xathrya

A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial