Chinaunix首页 | 论坛 | 博客
  • 博客访问: 315691
  • 博文数量: 81
  • 博客积分: 1810
  • 博客等级: 上尉
  • 技术积分: 725
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-25 17:38
文章分类

全部博文(81)

文章存档

2016年(4)

2015年(11)

2014年(16)

2013年(37)

2012年(11)

2011年(2)

我的朋友

分类: 嵌入式

2013-09-05 17:25:29

宿主机:fedora core 15
目标板:arm 。。。

systemtap里面有三个重要的工具:translator,compiler,staprun。
translator负责将stp脚本翻译为c代码;
compiler根据runtime环境和内核路径来生成module;
staprun负责装载、卸载模块,输出模块探测的信息。

translator和compiler都是在宿主机上运行,staprun在目标板上运行。

宿主机上如何安装systemtap,参考文章:
http://linux.chinaunix.net/techdoc/develop/2008/12/28/1055546.shtml

选用systemtap-2.3,该版本支持交叉编译选项。其他版本没试验。

生成目标板运行的staprun:
./configure --build=i686-redhat-linux --host=arm-linux-gnueabi  --disable-translator
make

生成一个简单的hello模块:
stap -r $(KERNEL_PATH) -a arm -B CROSS_COMPILE=arm-linux-gnueabi- -e 'probe begin {print("hello!\n") exit()}'
这里KERNEL_PATH是生成目标板内核镜像的build路径。
另外,编译模块的systemtap版本,与编译staprun的systemtap版本不一致时,会存在一些问题。

将stapio拷贝到/usr/local/libexec/systemtap/目录下
staprun拷贝到/usr/local/bin/目录下
然后运行staprun stao_xxx.ko
看到hello!,说明systemtap整个交叉编译环境已经搭好。


另外,systemtap wiki上找到的一篇文章,很不错。






阅读(7510) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~