移植oprofile到dm365
来源:互联网 发布:欧特克软件侵权案件 编辑:程序博客网 时间:2024/06/03 07:16
一、移植
1. 首先要下载OProfile的相关软件包,如下:
oprofile-0.9.6.tar.gz: http://oprofile.sourceforge.net/download/
popt-1.14.tar.gz: http://freshmeat.net/projects/popt/
binutils-2.20.tar.gz: http://ftp.gnu.org/gnu/binutils/
2. 使用交叉编译器编译OProfile
首先,确认你的目标板上运行的Linux是否支持下面的选项:
在安装oprofile之前,需要保证系统支持oprofile。即在系统编译内核的时候要将以下三项勾上
make menuconfig
General setup --->
[*] Profiling support
<*> OProfile system profiling
[*] Kernel performance events and counters
可以用自带的opcontrol来检测kernel是否支持oprofile.如果运行opcontrol --quick没有错误的话,就说明当前的内核支持oprofile。
为交叉编译器设置环境变量,如下:
export CC=arm-none-linux-gnueabi-gcc
export CXX=arm-none-linux-gnueabi-g++
export CFLAGS=-static
export CXXFLAGS=-static
export CPPFLAGS=-static
export ac_cv_va_copy=C99
2.1 交叉编译popt-1.14
进入"OProfile_Project/popt-1.14"目录,打开configure.ac文件,注释掉46行,如下:
AC_ISC_POSIX
AM_C_PROTOTYPES
#AC_CHECK_VA_COPY
AC_CHECK_HEADERS
然后在当前目录下创建一个"mypopt"的文件夹,并运行下面的命令进行配置,编译和安装:
#./configure --with-kernel-support --target=arm-linux --host=arm-linux --prefix=/workdir/popt-1.14/mypopt
#make && make install
然后拷贝所生成的头文件及库到你的交叉编译器的目录下面如下:
cp ./mypopt/include/* <your cross-compiler directory>/arm-none-linux-gnueabi/include
cp ./mypopt/lib/* <your cross-compiler directory>/arm-none-linux-gnueabi/lib
2.2 交叉编译binutils-2.20
首先进入"OProfile_Project/binutils-2.20/gas/config"目录,然后打开tc-arm.c,在2488行做如下的修改:
if (frag->tc_frag_data.last_map != NULL) {
know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE(symbolP))
}
也就是加上大括号,否则编译会出错。
在"OProfile_Project/binutils-2.20/"下创建"mybinutils"子目录,运行下面的命令进行编译:
./configure --with-kernel-support --target=arm-none-linux-gnueabi --host=arm-none-linux-gnueabi --prefix=/workdir/binutils-2.20/mybinutils --prefix
make
make install
2.3 交叉编译opofile-0.9.6
进入"OProfile_Project/oprofile"文件夹,运行下面的命令进行编译:
#./autogen.sh
.#/configure --with-kernel-support --target=arm-none-linux-gnueabi --host=arm-none-linux-gnueabi --with-binutils=/workdir/binutils-2.20/mybinutils/ --prefix=/workdir/oprofile-0.9.7/myoprofile
#make && make install
3. 拷贝OProfile到目标板上面
接下来,要将交叉编译好的oprofile及相关文件拷贝的目标板上面。
二、移植中碰到的问题
问题1:
# opcontrol --init
cat: can't open '/dev/oprofile/cpu_type': No such file or directory
Unable to open cpu_type file for reading
Make sure you have done opcontrol --init
cpu_type 'unset' is not valid
you should upgrade oprofile or force the use of timer mode
# cat /etc/mtab
nodev /dev/oprofile oprofilefs rw 0 0
解决:
执行:mount -t oprofilefs nodev /dev/oprofile
问题2:
#./opcontrol --init
Kernel support not available, missing opcontrol --init as root ?
检查/etc/mtab文件内容,确保是nodev /dev/oprofile oprofilefs rw 0 0
问题3:
opreport: /opt/lib/libstdc++.so.6: version `CXXABI_ARM_1.3.3' not found (required by opreport)
在网上下载个动态库libstdc++.so.6.0.10,将它放在/lib目录下,做了个软链接
ln -s libstdc\+\+.so.6.0.13 libstdc\+\+.so.6
问题4:
# opreport
objdump is not installed on this system, use opcontrol --kernel-range=start,end or opcontrol --xen-range= or install objdump
由于在分析内核时使用到objdump,复制binutilsimg/bin/objdump 至文件系统的/bin文件下。(objdump在符号分析时用到)
问题5:
如果得到的错误是
You cannot specify any performance counter events
because OProfile is in timer mode.
修改源码oprof.c (drivers\oprofile) 第36行如下(内核版本不一样,可能有所差别)
static int timer = 1;
不过,这个修改对DM368是无效。通过查看源码发现,上面的修改对于armv6,armv7架构都是可以的,但dm368是armv5,内核只能支持Time Interrupt模式。有点小遗憾!
三、使用
# opcontrol --init
# opcontrol --vmlinux=/opt/vmlinux ;使用前将vmlinux拷贝到开发板中
# opcontrol --start
opcontrolUsing 2.6+ OProfile kernel interface.
Reading module info.
Using log file /var/lib/oprofile/samples/oprofiled.log
Daemon started.
Profiler running.
# opcontrol --stop
Stopping profiling.
# opreport
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
TIMER:0|
samples| %|
------------------
191 89.6714 vmlinux
8 3.7559 libc-2.5.90.so
7 3.2864 busybox
7 3.2864 ld-2.5.90.so
- 移植oprofile到dm365
- Oprofile 移植到Android
- RT3070移植到TI DM365和Gm8126
- DM365-Openssh移植到MontaVista linux的步骤
- rt3070 AP驱动 移植到dm365和mini2440全过程
- DM365-368内核移植
- 移植oprofile到海思
- DM365平台移植QT4.6
- DM365 linux kernel 移植总结
- oprofile for godson2e 移植手记
- 附录1:Oprofile移植到intel xscale pxa 255开发板
- opencv2.0.0在dm365上的移植
- DM365的UBL源码分析和移植
- Android移植oprofile性能监测工具
- Android移植oprofile性能监测工具
- 【Linux】linux性能分析工具oprofile移植
- DM365
- DM365
- 【jzoj5085】【GDOI2017第四轮模拟day1】【游戏】 【sg函数】【线性基】
- 可重入(reentrant)函数
- POJ3414
- 阿里云ECS CentOs6.8 安装GNOME桌面和VNC Server
- bzoj1344: [Baltic2007]Connected Points连点
- 移植oprofile到dm365
- javascript基础
- Normalization on conv4_3 in SSD
- uml系列(八)——部署图与构件图
- 电商秒杀场景的解决策略与具体实现方案
- hdu1535—Invitation Cards(spfa)
- Android通过滑动实现Activity跳转(手势识别器应用)
- 信号处理第一课:向量的空间与子空间
- 软件工程师职业发展与晋升通道