Stephen Fry

"Education is the sum of what students teach each other in between lectures and seminars. " - Stephen Fry

Thursday, 26 July 2012

Iperf on Andriod, a new approach - Pt 4.3

This is blog post number 4, on try to run Iperf on Android, my previous attempts were:
  • Method 1 - getting the Google Play Store on a CyanogenMod phone and downloading the Iperf for Android application
  • Method 2 - SSHing into an Android phone and trying to run Iperf from the command line
  • Method 3 - repeating method 1 & 2 on another Android phone and trying a different application called Aperf
  • Method 4 - trying to run a cross-compiled version of Iperf on the Android phone
  • Potential Method 5 - cross-compile Iperf myself and try to run that version
  • Potential Method 6 - install Linux on android, following instructions here.
  • Potential Method 7 - write my own version of Iperf


  1. Get to grips with the basics of Android Debug Bridge (adb)
  2. Download the cross compiled Iperf and push it onto SD card
  3. Copy Iperf over the correct location in the system


Android Debug bridge (adb) is a command line tool for communicating with an android device via USB or an emulator instance. adb is not installed in the machine so it must be ran from the correct location, for me this was android-sdk-linux/platform-tools/.

I connect my android phone via USB and run ./adb devices to test that the device is connected. If multiple emulators/device instances are running then I will need to specify with device to use when using adb so for simplicity, I close all running emulators so that I have only my android phone running.

I can install applications from the .apk file using "adb install <path_to_apk>" and I can copy files between my device and computer using "adb pull <remote_location>  <local_location>" and adb push <local_location> <remote_location>"

I've downloaded Iperf compiled for android and I do the following:

 ./adb push ~/Downloads/iperf / sdcard/   
(* copy iperf from downloads to SDcard *)

./adb shell
(* starts a remote shell on the android device, the command prompt becomes #   *)

mount -o rw,remount /system
(* remount the /system filesystem so that its now read-write *)

cp /sdcard/iperf /system/bin
(*copy the iperf code over to newly remounted /system filesystem *)

mount -o ro,remount /system
(* remount the /system filesystem so that its now read-only *)

Now I try iperf, from the remote shell and IT WORKS !
Yes, that's right, it works perfectly. This time it was 4th time lucky.

And this right here, is the reason that I'm a computer scientist. For the high, that you get when something finally works and you know that it works because you made it work. Looking back over the past few days, I feel like I've learned so much about Android and given the opportunity I would definitely do it all over again but now its time for a coffee.


  1. can u please tell me where u download the cross compiled iperf i got confused in downloading

    1. Yes ! I can't find those file to :(

    2. I found it ! :)

  2. Awesome, been looking for this. Downloading the pre-compiled version makes it a lot easier. The trick is putting the "iperf" file in /local/data/tmp and the giving it a "chmod 0777 iperf" and then copying it to '/system/bin'. Works like a charm!