SystemTap for Android
This tutorial describes how to build SystemTap for Android. Further more, it is explained how to configure your workspace to be able to compile your own stap scripts for Android and to start them. It is possible that you have to do some shaky things with your Android device during this manual. Make sure you have backuped all your important data!
Requirements
A rooted android device with a self-built kernel - for further information on how to built your own kernel for android have a look at self-build Android kernel
- All requirements are met to build systemtap
- Get a copy of the systemtap-android repo:
git clone https://gitos.cs.tu-dortmund.de/systemtap4android/environment.git
- Before you can start, you have to clone the submodules:
git submodule init
git submodule update
Building SystemTap
Compile your own systemtap:
./build.sh
It automatically configures, build and installs systemtap for you. You can find this installation in the installed directory. It is independet from any other installation on your system. The script builds the arm binaries as well. There are located at src/android_binaries.
Setting up a device config
Before you can compile your stap script into a kernel module. You have to create a configuration for the target platform. So far, a configuration consists of a path to the kernel sourcetree.
To create such a configuration write the path in a textfile named <device>.conf and place it under the config directory. Here is an example for the Samsung Galaxy Nexus:
- omap.conf, contents: /path/to/my/kernel/omap
Compile a script for android
Ensure you have created a configuration for your device under conf/ and the kernel tree is prepared for compiling modules. Your script should be located in the scripts directory. To start the compilation:
./build_module.sh <script> <devicename>
Where <devicename specifies the configuration to be used and <script> the systemtap script. Important: Omit the filename extension from both parameters.
The compiled script is located in modules/<devicename>/.
Run a compiled script (aka kernelmodule) on android
First you need to install the SystemTap Android Application located in android-app on your device. It is an Eclipse project. So import it to Eclipse and install it on your device.
Now place the compiled script on the sdcard under the `/sdcard/systemtap/modules/ directory. Just start the android app, select the module and start it.