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
- Get to grips with the basics of Android Debug Bridge (adb)
- Download the cross compiled Iperf and push it onto SD card
- 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.
(* 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.