Compiling Oscam for Android

It has been a while since my last entry on the blog but life is not what it used to be.
Anyway, today I bring you a new tutorial with detailed instructions on how to build Oscam for your Android box (like Wetek Play).

The official Oscam documentation has some information on how to compile it using the NDK toolchain but it’s outdated and you will not be able to target devices running on Lollipop (5.0+) as the binaries will not run because they are not Position Independent Executables (PIE) and it also does not explain how to cross-compile and install OpenSSL.
I will show you how to compile a good static binary that should run on any arm-based Android device.

First of all, you will need a Linux machine, I am using Linux Mint which is based on Ubuntu and all the instructions are for Ubuntu environments.
If you dont have a a linux environment, install an Ubuntu virtual machine.

Install the required packages.

sudo apt-get update
sudo apt-get install subversion

Next you need to download the latest Linux 64-bit (x86) Android NDK which you can find at
At the time of this writing, the latest stable version is r13b.

Extract the NDK file to your home directory and cd into the build/tools folder so we can build our toolchain for Cross Compiliing.

cd ~/android-ndk-r13b/build/tools
export TOOLCHAIN=~/android-toolchain
./ --arch arm --api 24 --install-dir $TOOLCHAIN

This command takes a few seconds to run and it should create the android toolchain on your home directory.

Before cross-compiling OScam with this toolchain, we need to compile OpenSSL

Download, extract and build OpenSSL :

cd ~
tar -xf openssl-1.0.1g.tar.gz
cd openssl-1.0.1g
export CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc
export RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
./Configure --prefix=$TOOLCHAIN/sysroot/usr android
make install_sw

Now, lets checkout the Oscam svn and configure the build.

cd ~
svn checkout oscam-svn
cd oscam-svn
./ --enable WEBIF WITH_SSL

Now comes the part you have been waiting for, cross-compile Oscam for Android.

make static EXTRA_FLAGS="-pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-

If everything worked, you should have a nice binary in the Distribution folder of oscam-svn.

I know what you are thinking :

– “What the hell, this is not an APK. How will I install and run this on my device?”.

Well, what we have just done was compile native C code to run on an Android environment.
An APK is a package that contains bytecode (compiled java code) and resources that will run inside the android java virtual machine (which can be Dalvik or ART depending on your Android version).

We will basically need to build an Android app (APK) that contains our native binary as a resource, extract it to a place where it can be executed (does not work on the SDCard), make it  executable and run it.
But that, will be for the next tutorial that includes a sample on github ready-to-go.


This entry was posted in Android, C++, Java, Oscam.

Leave a Reply

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

Please calculate the arithmetic expression to validate you are human. *