Difference between revisions of "Android"

From sigrok
Jump to navigation Jump to search
m
Line 8: Line 8:
  $ '''mkdir android'''
  $ '''mkdir android'''
  $ '''cd android'''
  $ '''cd android'''
  $ '''wget http://dl.google.com/android/ndk/android-ndk-r8d-linux-x86.tar.bz2'''
  $ '''wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2'''
  $ '''tar xfvj android-ndk-r8d-linux-x86.tar.bz2'''
$ '''or wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2''' (If you have 64b bits)
  $ '''cd android-ndk-r8d'''
  $ '''tar xfvj android-ndk-r9d-linux-x86.tar.bz2'''
  $ '''cd android-ndk-r9d'''


Now, create a toolchain installation that can be used for cross-compiling for Android (adapt '''--platform''' and '''--arch''' as needed):
Now, create a toolchain installation that can be used for cross-compiling for Android (adapt '''--platform''' and '''--arch''' as needed):


  $ '''./build/tools/make-standalone-toolchain.sh --platform=''android-9'' --install-dir=$HOME/android/android-arm-toolchain --arch=''arm'''''
  $ '''./build/tools/make-standalone-toolchain.sh --platform=''android-15'' --install-dir=$HOME/android/android-arm-toolchain --arch=''arm'''''


You now have a working toolchain and build environment in '''$HOME/android/android-arm-toolchain'''.
You now have a working toolchain and build environment in '''$HOME/android/android-arm-toolchain'''.
You may need to install additional packages: libtool, ...


=== Cross-compiling ===
=== Cross-compiling ===

Revision as of 21:33, 25 March 2014

Building from source

Initial setup

First, download the latest Android NDK and extract it, e.g. in $HOME/android.

$ cd $HOME
$ mkdir android
$ cd android
$ wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2
$ or wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2 (If you have 64b bits)
$ tar xfvj android-ndk-r9d-linux-x86.tar.bz2
$ cd android-ndk-r9d

Now, create a toolchain installation that can be used for cross-compiling for Android (adapt --platform and --arch as needed):

$ ./build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/android/android-arm-toolchain --arch=arm

You now have a working toolchain and build environment in $HOME/android/android-arm-toolchain.

You may need to install additional packages: libtool, ...

Cross-compiling

$ git clone git://sigrok.org/sigrok-util
$ cd sigrok-util/cross-compile/android
$ ./sigrok-cross-android

Please check the README and edit the sigrok-cross-android as needed.