Android Systemtap无法加载模块

Android Systemtap无法加载模块,android,linux-kernel,systemtap,Android,Linux Kernel,Systemtap,我试图在GT-i9300上加载一个简单的Systemtap模块 我得到了错误 插入模块“/sdcard/systemtap/modules/monitor\u fopen.ko”时出错: 模块中的未知符号 我采取的步骤: 1.在设备上获取根目录 我安装了这个 2.构建自定义内核 3.闪存内置zImage到设备 4.在PC上安装systemtap 5.创建一个.stp文件 6.使用编译后的内核从.stp文件构建.ko文件 7.在运行自定义内核的设备上安装Systemtap Android应用程序

我试图在GT-i9300上加载一个简单的Systemtap模块

我得到了错误

插入模块“/sdcard/systemtap/modules/monitor\u fopen.ko”时出错: 模块中的未知符号

我采取的步骤:


1.在设备上获取根目录 我安装了这个

2.构建自定义内核 3.闪存内置zImage到设备 4.在PC上安装systemtap 5.创建一个.stp文件 6.使用编译后的内核从.stp文件构建.ko文件 7.在运行自定义内核的设备上安装Systemtap Android应用程序

8.启动应用程序并授予应用程序根用户访问权限 Superuser.apk应该询问您Systemtap是否可以拥有root访问权限

9将.ko文件从步骤6推送到SD卡 10加载模块 11读取加载模块的结果 加载的内核模块:monitor_fopen.ko 输出文件:monitor_fopen_2014.mm.dd_sss* 插入模块“/sdcard/systemtap/modules/monitor\u fopen.ko”时出错:模块中的未知符号



我不知道我错在哪一步。有人有线索吗?

多亏了@adelphus,他记得我使用了dmesg,我发现了错误:

Android:未知符号\u全局\u偏移量\u表_

在的帮助下,我将内核的Makefile编辑为

CFLAGS_MODULE   = -fno-pic

在我的OP中,重做所有其他步骤都有效。

尝试加载模块后,在设备上运行dmesg-日志应该包含它遇到问题的符号的名称。我收到了一个奇怪的错误:/root/sukritk/systemtap android/installed//share/systemtap/runtime/linux/alloc.c:345:14:错误:“vzalloc”的静态声明后面是非静态声明static void*vzalloc(未签名的长大小)^是否需要设置其他环境变量或运行时参数/root/sukritk/systemtap android/installed//bin/stap-p 4-v-a arm-B CROSS_COMPILE=arm linux androidiabi--r/root/sukritk/kernel/goldfish/-r/root/sukritk/systemtap android/installed//share/systemtap/runtime/-t-g-m monitor_fopen scripts/monitor_fopen.stp
# 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
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 
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");
}
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
user@ubuntu1210:~$ adb push monitor_fopen.ko /sdcard/systemtap/modules/monitor_fopen.ko
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!
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
CFLAGS_MODULE   = -fno-pic