Porting iw tools to Android

June 13th, 2012


This posts is a guide for porting iw to Android ICS.

iw is a new utility for wireless devices on Linux. It developed by linuxwireless.org.

You can see more detail about how to use it in here.

1.Build requirements: libnl

Frist, you need Grab the tree for libnl:

$git clone git://git.infradead.org/users/tgr/libnl.git
$cd libnl/
$git checkout tags/libnl2_0
$./autogen.sh    (generate the configure file)

Be sure to make ANDROID_PATH point to your android build environment.

Download the android.sh, and apply it.

$source android.sh

Apply this libnl.patch to your ./lib/Makefile and build it.

$patch lib/Makefile libnl.patch

It will have error happen during the compile process, but if you’re lucky enough, you will find 4 file in ./lib folder (libnl.a libnl-genl.a libnl-nf.a libnl-route.a) . That is exactly what we want. We will static build iw, and wrap those files in iw.

2.Build iw

$git clone http://git.sipsolutions.net/iw.git
$cd iw/
$export LIBNL=your_libnl_path

Make $LIBNL point to your libnl folder.
Download the iw.patch, and apply it to iw/Makefile

$patch Makefile iw.patch

Finally, we get iw binary file in current folder, if you want know more detail, please read the 2 patch file and android.sh. All compile progress was run in Ubuntu 10.10. Hope you lucky.

* The iw’s Makefile is very unfriendly for cross compile.

* You can add V=1 option when build Android. This option will let build process output full command, I collected all output compiler options and put them in Android.sh.

* Also you can just download this binary file on iw.tar, which is I compiled for my android ics. Hope you lucky enough.

30 thoughts on “Porting iw tools to Android

  1. an error occur when excute “configure” in step1

    configure: error: unrecognized option: `-I/home/dangku/samsung/lenovo/basewin/A2105/bionic/libc/arch-arm/include\’

    1. You can try to run the options of the android.sh file in command line. Don’t source the android.sh

  2. Hey,
    trying to compile using your instructions…
    you have some excessive \’s in your script and you don’t really use the $ANDROID_PATH, you might want to fix that..
    but never mind that, I’m now at the stage where it tells me the test binaries can’t be run and that I should use –host to set the target… what did you put there? it seems a bit backwards to my intuition (build should be android and host should be i686, isn’t it?)

    1. I’ve guessed –host=arm

      applied the patch manually 🙂
      got only 2 out of 4 =\
      missing libnl-nf.a libnl-route.a..

    2. Thank you remind me about the $ANDROID_PATH things, I will fix it. I upload the iw’s binary file on this page, It should be ok on android ICS. You can try it.

  3. Hi,
    Could you show me how to add iw support into android source code “external” directory? I need iw as a part of android system not as an external binary. Thanks in advance!

  4. Pingback: Homepage
  5. Pingback: więcej
  6. Pingback: more information
  7. Pingback: SignUp Today
  8. Hi,
    the pre-built binaries looks to be broken as the tar package is bad.

    Is there any other android arm package to try?


  9. good moning.
    I did not understand. that for the variable ANDROID_PATH .
    This is the core or what? Could explain.

  10. Hello,

    I am getting command failed operation not supported on transport endpoint (-95) while changing bitrates using iw. I am using CM11 4.4.2 on my phone. Could you help me with this ?

    Thank You.

  11. Aw, this was a very nice post. Spending some time and actual effort to make a really good article… but what can I
    say… I put things off a whole lot and never manage to get anything done.

  12. Hey, thanx for this instruction, but I’ve got few (stupid?) questions:

    1. I dont get how to use GIT on Android terminal if there is no git?
    >I’ve installed GIT app, so it downloaded all the files, but I still guess how should I have used it without app.

    2. I can’t run autogen.sh by just typing “./autogen.sh”, I have to type “sh autogen.sh”, but it still doesnt work: “autogen.sh: line 12: autoreconf: not found”
    >How should I install the autoreconf if there is no APT or YUM or any packet manager in Android?

    I’ve read a lot of articles about android, iw and so on, but I still dont understand how to solve such troubles 😐

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.