1# compiling iozone
2
3Assuming you have compiler toolchain installed, just type  `make` to get a list of targets
4
5then to generate for your iozone for your `<OS/target>` simply type:
6`make <target>`
7
8**Android specifics**
9
10building iozone for Android means doing a cross compilation
11
12There is two options then.
13
14* cross compiling using Android NDK
15* cross compiling from android source tree. Due to the disk space
16  required to get an android source tree, this option is valuable
17  only if you are already working with android source tree.
18
19**_cross-compiling using Android NDK_**
20
21The prerequiste is to download SDK and NDK.
22SDK cannot easilly dissociated from Android Studio those days.
23
24Follow the following steps to get SDK and NDK and
25cross compile iozone.
26
271. Prerequesite : Ubuntu LTS release 16.04 or 18.04 or Mac OS
282. Download Android Studio for your platform from https://developer.android.com/studio/
293. Extract the archive to some place, e.g. your home directory
304. Start android studio
31    1. on linux: Android Studio needs to be started from a terminal so open a Terminal
32    2. in terminal type `<install_dir>/android-studio/bin/studio.sh`
33    3. on Mac OS Android Studio can be launch from lauchpad. if you wish to start it from terminal type `open -a Android\ Studio`
345. keep all the defaults proposed Android Studio.
356. Wait for the download to be ready
367. Download the NDK
37    1. Select Configure in Android Studio Splash Screen
38    2. Select SDK Manager
39    3. Go to system settings Android SDK on the left
40    4. Select tab SDK Tools
41    5. Select NDK and apply to install NDK
428. Set NDK environment variable to the ndk-bundle directory
43    1.  e.g. `export NDK=/home/parallels/Android/Sdk/ndk-bundle/`
449. download and extract iozone archive
45    1. you can opt for extacting only source directory.
46        1. `mkdir iozone`
47        2. `cd iozone`
48        3. `tar -xvf <path to tar archive>/iozoneX_XXX.tgz -C ./iozone --strip-components 3`
49    2. or extracting the full archive
50        1. `tar xvf iozoneX_XXX.tgz`
51        2. `cd iozoneX_XXX/src/current`
5210. build iozone
53    1. `make android` This will generate 4 version of iozone for different architecture: arm7, arm64, x86, x86_64
54    2. push the iozone excutable to your Android target e.g. `adb push libs/arm64-v8a/iozone /data/iozone`
55
56**_cross-compiling iozone within android source tree_**
57
58The Prerequisite is to have an Android source tree availavle.
59If you do not have it, download it android from Google
60
611. `cd <android root>`
622. `source ./build/envsetup.sh`
633. `lunch <target>`
644. `cd <android root>/external`
655. `mkdir iozone`
666. `curl http://www.iozone.org/src/current/iozoneX_XXX.tar -o iozoneX_XXX.tar` # assuming this version no proxy, etc`
677. `tar -xvf ./iozoneX_XXX.tar -C ./iozone --strip-components 3`
688. `cd iozone`
699. `mm`
70
71
72