______ Y ______

My own personal time capsule.

Cross Compile For ARM on Debian

Here is quick way of setting up and compiling ARM binaries when we want to deploy some custom code for Android. First we need to set the enviroment on Debian:

apt-get install emdebian-archive-keyring
echo "deb http://ftp.us.debian.org/debian/ squeeze main" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main" >> /etc/apt/sources.list
echo "deb http://www.emdebian.org/debian/ squeeze main" >> /etc/apt/sources.list
apt-get update
apt-get install g++-4.4-arm-linux-gnueabi

Now we are ready to compile and deploy simple binary via ADB:

arm-linux-gnueabi-gcc helloworld.c -o helloworld -static

After that all that remains is to upload our binary onto Android phone like this:

# upload binary
adb push /tmp/helloworld /data/local/tmp
# change perms
adb shell chmod 777 /data/local/tmp/helloworld
# execute
adb shell /data/local/tmp/helloworld
Hello World

Leave a comment