I am trying to load a simple Systemtap module on my GT-i9300
I get the error
Error inserting module '/sdcard/systemtap/modules/monitor_fopen.ko':
Unknown symbol in module
Steps that I took:
1. Get root on the device
I did this by installing this Rom
2. Build custom kernel
# ====================================================
# Add toolchain
user@ubuntu1210:~/Programs$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7
user@ubuntu1210:~$ sudo gedit .bashrc
# Toolchain
export PATH=${PATH}:~/Programs/arm-linux-androideabi-4.7/bin
# Reboot ubuntu
# ====================================================
# ====================================================
# Download and extract to ~/android/kernel :
# https://github.com/SlimRoms/kernel_samsung_smdk4412.git
user@ubuntu1210:~$ cd android/kernel/kernel_samsung_smdk4412/
# ====================================================
# ====================================================
# Set configuration for compiling
user@ubuntu1210:~/android/kernel/kernel_samsung_smdk4412$ make clean -j4 ARCH=arm SUBARCH=arm CROSS_COMPILE=arm-linux-androideabi-
user@ubuntu1210:~/android/kernel/kernel_samsung_smdk4412$ make ARCH=arm SUBARCH=arm CROSS_COMPILE=arm-linux-androideabi- slim_i9300_defconfig
user@ubuntu1210:~/android/kernel/kernel_samsung_smdk4412$ gedit .config
# Enable config parameters:
CONFIG_DEBUG_INFO, CONFIG_KPROBES, CONFIG_RELAY, CONFIG_DEBUG_FS, CONFIG_MODULES, CONFIG_MODULE_UNLOAD
# ====================================================
# Build Kernel
user@ubuntu1210:~/android/kernel/kernel_samsung_smdk4412$ make -j4 ARCH=arm SUBARCH=arm CROSS_COMPILE=arm-linux-androideabi-
3. Flash built zImage to device
# Download and extract bootimg_tools.zip from
# http://forum.xda-developers.com/showpost.php?p=44670032&postcount=12
#
# Download correct ROM .zip file and extract boot.img to the same folder as bootimg_tools
user@ubuntu1210:~/bootimg_tools$ perl split_bootimg.pl boot.img
user@ubuntu1210:~/bootimg_tools$ perl unpack_ramdisk boot.img-ramdisk.gz ramdisk
user@ubuntu1210:~/bootimg_tools$ perl repack_ramdisk ramdisk boot.img-ramdisk.cpio.gz
user@ubuntu1210:~/bootimg_tools$ cp /home/user/kernel_samsung_smdk4412/arch/arm/boot/zImage boot.img-kernel
user@ubuntu1210:~/bootimg_tools$ ./mkbootimg --kernel boot.img-kernel --ramdisk boot.img-ramdisk.cpio.gz --cmdline 'console=null androidboot.hardware=qcom user_debug=31 zcache' --base 0x80200000 --pagesize 2048 -o boot.img
# Download and install heimdall
# https://bitbucket.org/benjamin_dobell/heimdall/downloads
user@ubuntu1210:~/bootimg_tools$ adb reboot bootloader
user@ubuntu1210:~/bootimg_tools$ sudo heimdall flash --BOOT boot.img --verbose
4. Install systemtap on PC
user@ubuntu1210:~$ mkdir systemtap
user@ubuntu1210:~$ cd systemtap/
user@ubuntu1210:~/systemtap$ git clone https://github.com/flipreverse/systemtap-android.git
user@ubuntu1210:~/systemtap$ cd systemtap-android/
user@ubuntu1210:~/systemtap/systemtap-android$ git submodule init
user@ubuntu1210:~/systemtap/systemtap-android$ git submodule update
user@ubuntu1210:~/systemtap/systemtap-android$ sh build.sh
5. Create an .stp file
user@ubuntu1210:~$ cd /home/user/systemtap/systemtap-android/scripts/
user@ubuntu1210:~$ vi monitor_fopen.stp
#! /usr/bin/stap
probe begin
{
printf("start monitoring");
}
probe end
{
printf("end monitoring");
}
6. Build .ko file out of .stp file using compiled Kernel
user@ubuntu1210:~$ /home/user/systemtap/systemtap-android/installed/bin/stap
-p 4 -v
-a arm
-B CROSS_COMPILE=/home/user/Programs/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-
-r /home/user/android/kernel/kernel_samsung_smdk4412/
-j /home/user/systemtap/systemtap-android/installed/share/systemtap/tapset/
-R /home/user/systemtap/systemtap-android/installed/share/systemtap/runtime/
-t -g -m monitor_fopen /home/user/systemtap/systemtap-android/scripts/monitor_fopen.stp
7. Install Systemtap Android App on the device that runs the custom Kernel
https://github.com/flipreverse/systemtap-android-app
8. Start the app and give the app root access
Superuser.apk should ask you whether Systemtap can have root access
9. Push the .ko file from step 6 to the sdcard
user@ubuntu1210:~$ adb push monitor_fopen.ko /sdcard/systemtap/modules/monitor_fopen.ko
10. Load the module
user@ubuntu1210:~$ adb shell
shell@android:/ $ su
root@android:/ # cd /data/data/com.systemtap.android
root@android:/data/data/com.systemtap.android # sh start_stap.sh
modulename=monitor_fopen
moduledir=/sdcard/systemtap/modules
outputname=monitor_fopen_2014.mm.dd_sss
outputdir=/sdcard/systemtap/stap_output
logdir=/sdcard/systemtap/stap_log
rundir=/sdcard/systemtap/stap_run
stapdir=/data/data/com.systemtap.android
:q!
11. Read result from loading the module
user@ubuntu1210:~$ adb shell
shell@android:/ $ cd sdcard/systemtap/stap_log/
shell@android:/sdcard/systemtap/stap_log $ cat monitor_fopen_2014.mm.dd_sss.txt
Loaded kernel module: monitor_fopen.ko
Output file: monitor_fopen_2014.mm.dd_sss.*
Error inserting module '/sdcard/systemtap/modules/monitor_fopen.ko': Unknown symbol in module
I have no idea in what step I went wrong. Does anyone have a clue?