Building OpenWRT on Mac OS X 10.10 Yosemite

After upgrading to Yosemite, I have to rebuild OpenWRT for new os. Here is the complete steps to build OpenWRT on Mac OS X 10.10 Yosemite. I tested it both Carambola 2 native and OpenWRT x86 architectures.

First, you need a disk image on your mac. Go to Disk Utiliy->New Image-> Case sensitive, sparse disk Image. I allocate 15GB to work on 2 different builds.

Second, install XCode from App Store, and Command Line Tools:

xcode-select --install

Then, install macports (clean install is needed) and update:

sudo port selfupdate

Install required ports:

sudo port install gcc47 coreutils asciidoc bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurses e2fsprogs ossp-uuid gawk findutils gnutar

Everything is ready to get the source code and build. Mount the disk we setup in the first step and cd into and get OpenWRT.

git clone git://git.openwrt.org/14.07/openwrt.git

clang can build everything from scratch.

gcc -v

Configured with: –prefix=/Applications/Xcode.app/Contents/Developer/usr –with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

export PATH=/opt/local/libexec/gnubin:/opt/local/bin:${PATH}

Setup your firmware options:

make menuconfig

and build:

make -j 8

make[1] world
make[2] tools/install
make[2] package/cleanup
make[3] -C tools/sed compile
make[3] -C tools/patch compile
make[3] -C tools/sstrip compile
make[3] -C tools/xz compile
make[3] -C tools/patch-image compile
make[3] -C tools/firmware-utils compile
make[3] -C tools/flock compile
make[3] -C tools/flock install
make[3] -C tools/patch-image install
make[3] -C tools/sstrip install
make[3] -C tools/firmware-utils install
make[3] -C tools/xz install
make[3] -C tools/sed install
make[3] -C tools/patch install
make[3] -C tools/ipkg-utils compile
make[3] -C tools/pkg-config compile
make[3] -C tools/m4 compile
make[3] -C tools/genext2fs compile
make[3] -C tools/mkimage compile
make[3] -C tools/yaffs2 compile
make[3] -C tools/cmake compile
make[3] -C tools/scons compile
make[3] -C tools/lzma compile
make[3] -C tools/squashfs4 compile
make[3] -C tools/ipkg-utils install
make[3] -C tools/yaffs2 install
make[3] -C tools/scons install
make[3] -C tools/squashfs4 install
make[3] -C tools/genext2fs install
make[3] -C tools/lzma install
make[3] -C tools/m4 install
make[3] -C tools/libtool compile
make[3] -C tools/mkimage install
make[3] -C tools/libtool install
make[3] -C tools/autoconf compile
make[3] -C tools/pkg-config install
make[3] -C tools/autoconf install
make[3] -C tools/automake compile
make[3] -C tools/automake install
make[3] -C tools/gmp compile
make[3] -C tools/e2fsprogs compile
make[3] -C tools/mklibs compile
make[3] -C tools/flex compile
make[3] -C tools/libelf compile
make[3] -C tools/mm-macros compile
make[3] -C tools/xorg-macros compile
make[3] -C tools/xfce-macros compile
make[3] -C tools/missing-macros compile
make[3] -C tools/mm-macros install
make[3] -C tools/xorg-macros install
make[3] -C tools/missing-macros install
make[3] -C tools/xfce-macros install
make[3] -C tools/libelf install
make[3] -C tools/mklibs install
make[3] -C tools/flex install
make[3] -C tools/bison compile
make[3] -C tools/e2fsprogs install
make[3] -C tools/qemu compile
make[3] -C tools/mtd-utils compile
make[3] -C tools/mtd-utils install
make[3] -C tools/qemu install
make[3] -C tools/gmp install
make[3] -C tools/mpfr compile
make[3] -C tools/bison install
make[3] -C tools/findutils compile
make[3] -C tools/bc compile
make[3] -C tools/bc install
make[3] -C tools/cmake install
make[3] -C tools/mpfr install
make[3] -C tools/mpc compile
make[3] -C tools/mpc install
make[3] -C tools/findutils install
make[3] -C tools/padjffs2 compile
make[3] -C tools/quilt compile
make[3] -C tools/padjffs2 install
make[3] -C tools/quilt install
make[2] toolchain/install
make[3] -C toolchain/gdb prepare
make[3] -C toolchain/gcc/minimal prepare
make[3] -C toolchain/kernel-headers prepare
make[3] -C toolchain/uClibc/headers prepare
make[3] -C toolchain/binutils prepare
make[3] -C toolchain/binutils compile
make[3] -C toolchain/uClibc/utils prepare
make[3] -C toolchain/uClibc prepare
make[3] -C toolchain/binutils install
make[3] -C toolchain/gdb compile
make[3] -C toolchain/gdb install
make[3] -C toolchain/kernel-headers compile
make[3] -C toolchain/gcc/initial prepare
make[3] -C toolchain/gcc/minimal compile
make[3] -C toolchain/gcc/final prepare
make[3] -C toolchain/gcc/minimal install
make[3] -C toolchain/kernel-headers install
make[3] -C toolchain/uClibc/headers compile
make[3] -C toolchain/uClibc/headers install
make[3] -C toolchain/gcc/initial compile
make[3] -C toolchain/gcc/initial install
make[3] -C toolchain/uClibc compile
make[3] -C toolchain/uClibc install
make[3] -C toolchain/gcc/final compile
make[3] -C toolchain/gcc/final install
make[3] -C toolchain/uClibc/utils compile
make[3] -C toolchain/uClibc/utils install
make[2] target/compile
make[3] -C target/linux compile
make[2] package/compile
make[3] -C package/boot/grub2 host-compile
make[3] -C package/libs/toolchain compile
make[3] -C package/system/opkg host-compile
make[3] -C package/libs/libjson-c compile
make[3] -C package/libs/libnl-tiny compile
make[3] -C package/libs/zlib compile
make[3] -C package/libs/ncurses compile
make[3] -C package/utils/lua compile
make[3] -C package/libs/lzo compile
make[3] -C package/libs/libreadline compile
make[3] -C package/firmware/linux-firmware compile
make[3] -C package/libs/gettext compile
make[3] -C package/libs/libiconv compile
make[3] -C package/libs/libtool compile
make[3] -C package/libs/libpcap compile
make[3] -C package/libs/ocf-crypto-headers compile
make[3] -C package/libs/polarssl compile
make[3] -C package/libs/gmp compile
make[3] -C package/network/services/dropbear compile
make[3] -C package/network/utils/linux-atm compile
make[3] -C package/network/utils/resolveip compile
make[3] -C package/network/utils/curl compile
make[3] -C package/network/utils/wireless-tools compile
make[3] -C package/utils/busybox compile
make[3] -C package/utils/mkelfimage compile
make[3] -C package/libs/ncurses compile
make[3] -C package/libs/libubox compile
make[3] -C package/utils/util-linux compile
make[3] -C package/devel/gdb compile
make[3] -C package/kernel/linux compile
make[3] -C package/libs/cyassl compile
make[3] -C package/libs/openssl compile
make[3] -C package/network/utils/iptables compile
make[3] -C package/network/ipv6/odhcp6c compile
make[3] -C package/network/services/ppp compile
make[3] -C package/network/utils/tcpdump compile
make[3] -C package/system/mtd compile
make[3] -C package/system/ubus compile
make[3] -C package/system/uci compile
make[3] -C package/utils/jsonfilter compile
make[3] -C package/network/config/netifd compile
make[3] -C package/system/ubox compile
make[3] -C package/network/config/firewall compile
make[3] -C package/network/services/hostapd compile
make[3] -C package/network/services/odhcpd compile
make[3] -C package/system/fstools compile
make[3] -C package/libs/nettle compile
make[3] -C package/network/utils/tcpdump compile
make[3] -C package/utils/ubi-utils compile
make[3] -C package/system/procd compile
make[3] -C package/base-files compile
make[3] -C package/network/services/hostapd compile
make[3] -C package/system/opkg compile
make[3] -C package/boot/grub2 compile
make[3] -C package/network/services/dnsmasq compile
make[2] package/install
make[3] package/preconfig
make[2] target/install
make[3] -C target/toolchain install
make[3] -C target/linux install
make[3] -C target/sdk install
make[2] package/index

Configure Eclipse NS3 on Mac OS X 10.10 Yosemite

To get ns3 running with Mac OS X 10.10 Yosemite:

Configure Development Environment

  1. Download Xcode from Apple App Store https://itunes.apple.com/tr/app/xcode/id497799835?mt=12
  2. Install Xcode
  3. Download and install command line tools. You can type `xcode-select –install` terminal or https://developer.apple.com/downloads/index.action
  4. gdb 7 has some problems with on Mac OS X so, install gdb 6 with macports using `sudo port install gdb-apple` or homebrew
  5. Download ns3 source code using web site http://www.nsnam.org or get with mercuriel `hg clone http://code.nsnam.org/ns-3-dev`
  6. Change ns3 directory and run `./waf -d debug configure`

Configure Eclipse

  1. Download Eclipse IDE for C/C++ Developers from http://www.eclipse.org/downloads/
  2. From eclipse New->New Project select C++ Project
  3. Point location of the ns3 and name it
  4. Right click on the project and properties, C/C++ Build change build command to waf `${workspace_loc:/NS3Dev}/waf` and build directory to `${workspace_loc:/NS3Dev}/build`
  5. Change incremental build all to build
  6. Now build project
  7. If you get unnecessary errors,from Eclipse Preferences->C/C++->Code Analysis uncheck Syntax and Semantic Erros

Signing gdb

Mac OS X requires gdb to be signed to access memory locations so:

  1. Open Keychain Access, Keychain Access->Certificate Assistant->Create a Certificate…
  2. Name the cert as `gdb-cert` select `Self Signed Root` and `Code Signing` also check override defaults
  3. Next, until “Specify a Location The Certificate” and select `System`
  4. Find cert in Keychain Access and if its not trusted trust the cert.
  5. From terminal sign the gdb `sudo codesign -s gdb-cert $(which gdb)`

Configure Eclipse Debugger

  1. Debug Configurations add new configuration
  2. Select C/C++ Application from list `build/scratch/scratch-simulator`
  3. In Environmental’s tab select new and add `DYLD_LIBRARY_PATH` variable and `${workspace_loc:/NS3Dev}/build` value
  4. In debug section select debugger path to gdb

Carambola2 OpenWRT on Mac OS X Mavericks

There are some sources about building developing OpenWRT on Mac OS X, you have follow different instructions in different web sites. Here is the complete steps to build OpenWRT on Mac OS X 10.9 Mavericks. I tested it both Carambola 2 native and OpenWRT x86 architectures.

First, you need a disk image on your mac. Go to Disk Utiliy->New Image-> Case sensitive, sparse disk Image. I allocate 15GB to work on 2 different builds.

Second, you have to install XCode from App Store, and Command Line Tools or run this on terminal;

xcode-select --install

Third, install macports and install required packages by macports using commandline;

sudo port selfupdate

sudo port install gcc47

sudo port install apple-gcc42

sudo port install coreutils asciidoc bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurses e2fsprogs ossp-uuid gawk findutils gnutar

Now, everything is ready to get the source code and build.  Mount the disk we setup in the first step and cd into and get OpenWRT stable version.

cd /Volumes/OpenWRT

git clone git://git.openwrt.org/12.09/openwrt.git

or you can clone Carambola 2 sources from github

git clone https://github.com/8devices/carambola2.git

Select gcc 4.2 to compile tools and gcc 4.7 for the rest.

sudo port select –set gcc apple-gcc42

export PATH=/opt/local/libexec/gnubin:/opt/local/bin:${PATH}

make menuconfig

If you are building carambola 2 don’t change architecture. For OpenWRT  you  can choose x86 or whatever you want. For development purposes, following options need to be enabled.

  • Advanced cofiguration options and Toolcahin options.
  • Build the OpenWrt SDK
  • Build the OpenWrt based Toolchain

Save changes and run;

make tools/install

After everything compiles successfully, select gcc 4.7 and run make;

sudo port select –set gcc mp-gcc47

make

References;
http://wiki.openwrt.org/easy.build.macosx

http://wiki.openwrt.org/doc/howto/buildroot.exigence.macosx

https://forum.openwrt.org/viewtopic.php?id=47058

 

How to set EDCA/DCF parameters in NS3?

Having throughput problems in OMNET++, we have to switch to the NS3 as network simulation platform. It  doesn’t have a builtin IDE like OMNET and simulation language is either C++ or python. I prefer C++.

After a long time period of  searching, I’ve managed to set DCF and EDCA parameters (like contention window) for wireless simulations (802.11 networks).  The problem is when you get Dca pointer and try to set CwMin and CwMax values, it doesn’t apply to the all nodes in the network, it has to be setup every device in the network.  For eaxample;

Ptr<NetDevice> dev = node->GetDevice(0);

Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice>(dev);

Ptr<WifiMac> mac = wifi_dev->GetMac();

PointerValue ptr;

mac->GetAttribute(“DcaTxop”, ptr);

Ptr<DcaTxop> dca = ptr.Get<DcaTxop>();

dca->SetMinCw(minCw);

dca->SetMaxCw(maxCw);

//dca->SetAifsn(2);

 

Ptr<EdcaTxopN> edca;

mac->GetAttribute(“VO_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

mac->GetAttribute(“VI_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

mac->GetAttribute(“BE_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

mac->GetAttribute(“BK_EdcaTxopN”, ptr);

edca = ptr.Get<EdcaTxopN>();

edca->SetMinCw(minCw);

edca->SetMaxCw(maxCw);

//edca->SetAifsn(2);

 

OMNET++ INET 802.11e Throughput Problem

It seems Omnet++ Inet still has problems with 802.11 mac layer  implementation.  The problem I face is, throughput decreases to half when the Max Contention Window  parameter is set to same value with Min Contention Window. I made the experiment with throughput example supplied in Inet. Simulation environment is set up as 1 AP and 1 Station when cwMinData and cwMaxData is set same value throughput is measured around 2.7 Mbps. Interesting thing is it is same regardless of the value I set (3, 7, 32 …). With 1 AP and 1 Station there shouldn’t be a collision and throughput shouldn’t decrease. I asked forums and reported as bug but still couldn’t find a solution. I guess I’ll be looking for alternative simulation environment, may be ns3?

Fixing OMNET++ on Mac OS X 10.9 Mavericks

Upgrading to Mac OS X 10.9 Mavericks breaks OMNET++, some actions required to get it working correctly. Here is the steps that I followed;

  1. Install latest Xcode 5.0.1 from Mac App Store
  2. Install command line tools  xcode-select –install
  3. Install macports Mavericks build
  4. Install gcc version 4.7 via macports
    sudo port selfupdate
    sudo port install gcc47
    sudo port select –set gcc mp-gcc47
    After this point you can compile OMNET++ and get working but, I faced problems when running simulations like missing icons/images in simulation. I think Tcl library has issues with Mavericks, in my case it has to reinstall too.
  5. sudo port install tcl
    sudo port install tcllib
  6. Now, edit configure.user in OMNET++ source directory
    CC=gcc-mp-4.7
    CXX=g++-mp-4.7
    TK_LIBS=”-L/opt/local/lib -ltk8.6 -ltcl8.6″
  7. Now you can follow OMNET++ standard installation instructions.
    ./configure
    make

 

Book Review: Learning OMNeT++

Last week I read Learning OMNeT++ , the book is published by Packt Publishing which is about popular network simulation software. Book is 102 pages and it is easy to read and follow, it took a few days to go over and finish it. It is available in  pdf, epub and Kindle formats which is good.

Book covers OMNET++ IDE, network structure, models, basic and compound modules, simulation environment, evaluation of simulation results and INET framework with example simulations.

It is a good resource to start learning OMNET++.  It’d be nice if wireless related topics was included too. If you want to make quick start to OMNET++, I’d recommend reading the book: Learning OMNET++.

Learning OMNET++

Learning OMNET++

 

 

Thoughts About Pebble Watch

I had my pebble watch a few weeks ago and actively using it. In general watch is really good. However it has some issues. Some pebble owners face oily looking screen but I was lucky to get working one. Battery life is 5 days in average, changing 4 to 7 days with usage. Most of the iOS notifications appear on watch except whatsapp (most important app for me) and watch doesn’t use unicode encoding. Caller ID is a really big problem, already memorised most popular phone numbers in my address book, thanks to Pebble !!!  IMG_2991 IMG_2981

WCNC 2014

One of the most important network conferences WCNC 2014 will be held in Istanbul. Our plan is to attend conference with a paper which we have been working for a while if we finalize it. I hope I’d manage to meet important people  in wireless networks.