Compiling Oscam for Android
513
It's been a while since my last blog post useful, but life is not the same, that was before.
Anyway, Today I present to you a new textbook with detailed instructions on how, how to build Oscam for your Android box (eg, WeTek Play).
Official documentation Oscam contains some information about, how to compile it using the NDK toolchain, but it is outdated, and you can not rely on device, operating on Lollipop (5.0+), as the binary files will not work, because they are not independent executable files (PIE), and do not explain, as cross-compiling and installing OpenSSL.
I will show you, how to compile a good static binary, that should work on any Android device on the basis of arm.
First of all, you need a Linux machine, I use Linux Mint, which is based on Ubuntu, and all the instructions are for Ubuntu environments.
If you do not have linux environment, install Ubuntu virtual machine.
Install the required packages.
sudo apt-get update
sudo apt-get install subversion
Next you need to download the latest version of the Linux 64-bit (x86) Android NDK, which you can find at https://developer.android.com/ndk/downloads/index.html
At the time of this writing, the latest stable version is r21.
Extract the file NDK in your home directory and CD-ROM in the folder build / tools, so that we can build our chain of tools for cross-compiling.
cd ~/android-ndk-r21/build/tools
export TOOLCHAIN=~/android-toolchain
./make_standalone_toolchain.py --arch arm --api 24 --install-dir $TOOLCHAIN
This command takes a few seconds to start, and it should create a set of tools android in your home directory.
Before cross-compilation OScam using the chain tool we need to compile OpenSSL
Download, extract and build OpenSSL:
cd ~
wget http://www.openssl.org/source/openssl-1.1.1d.tar.gz
tar -xf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d
export CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc
export RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
./Configure --prefix=$TOOLCHAIN/sysroot/usr android
make
make install_sw
Now let's check oscam svn and set up assembly.
cd ~
svn checkout http://www.streamboard.tv/svn/oscam/trunk oscam-svn
cd oscam-svn
./config.sh --enable WEBIF WITH_SSL
Now comes the part, you have been waiting for, cross-compilation Oscam for Android.
make static EXTRA_FLAGS="-pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-
If everything worked, then you must have a good distribution in the binary file folder oscam-svn.
I know, what are you thinking about :
– “What the heck, this is not the AIC. How do I set up and running it on your device?”.
Well, then, we just did, It has been compiling its own C code to run on the Android environment.
APK – this package, which contains the byte code (compiled java code) and resources, which will run within the virtual machine android java (which can be Dalvik or ART, depending on your version of Android).
We will have our own binary file as a resource, remove it in place, where it can be formed (It does not work on SD-card), make it executable and run it.
But it will be for the next lesson.