LTP在arm-linux-交叉编译环境上的安装

来源:互联网 发布:热门网络歌曲 编辑:程序博客网 时间:2024/05/16 06:13
一、    LTP 交叉编译:
1.    运行configure命令:
./configure CC=arm-none-linux-gnueabi-gcc --build=i686-pc-linux-gnu --target=arm-linux --host=arm-linux  CFLAGS="-static" LDFLAGS="-static  -pthread”

2.    make
[make 过程中遇到的Error的修改]
(1)    strip: Unable to recognise the format of the input file `test_arch_stripped'
make[4]: *** [test_arch_stripped] Error 1
解决方法: 只要在运行make命令,就OK了。

(2)    /opt/toolchains/arm-2009q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/libc.a(syslog.o): In function `openlog':
syslog.c:(.text+0x448): multiple definition of `openlog'…….
make[4]: *** [random-access] Error 1
解决方法:将./testcases/kernel/fs/fs-bench/random-access.c文件中的openlog变量全部替换掉:
:%s/openlog/test_openlog/g

(3)    /opt/toolchains/arm-2009q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/libc.a(syslog.o): In function `openlog':
syslog.c:(.text+0x448): multiple definition of `openlog'…..
make[4]: *** [random-access-del-create] Error 1
解决方法:将./testcases/kernel/fs/fs-bench/ random-access-del-create.c文件中的openlog变量全部替换掉:
       :%s/openlog/openlog_test/g
3.    运行 sudo make install; /opt/ltp下就是可以在Android上运行的binary。

二、     LTP 运行环境的建立
由于LTP运行脚本中,用到很多shell的命令,而android的adb shell只支持部分linux标准的bash shell中的部分命令,所以需要用busybox。
1.    导入busybox
            adb remount
            adb push c:\busybox /data/busybox
            adb shell

2.    在adb shell中设置busybox的权限
            chmod 777 /data/busybox
    
3.    从busybox中导出需要支持的命令:
(1)    建立shell
                -    mount -o remount /dev/block/mmcblk0p9 /system
                - cd /system/bin;
                - rm sh;
               - ln -s /data/busybox sh
               
(2) 在/system/bin中建立如下软连接:
       - mount -o remount /dev/block/mmcblk0p9 /system
       - cd /system/bin
       - ln -s /data/busybox dirname
       - ln -s /data/busybox basename
           - rm rm;
       - ln -s /data/busybox rm
       - rm mkdir;
          - ln -s /data/busybox mkdir       
       - ln -s /data/busybox mktemp
       - ln -s /data/busybox awk
       - ln -s /data/busybox grep
       - ln -s /data/busybox sed
       - ln -s /data/busybox cut
       - ln -s /data/busybox free
       - ln -s /data/busybox head
       - ln -s /data/busybox ldd
       - ln -s /data/busybox fdformat
       - ln -s /data/busybox touch
       - ln -s /data/busybox tr
       
4.    导入编译好的binary
        adb push c:\ltp_arm.tgz /data/

5.    解压源文件
        /data/busybox  tar -xzvf ltp_arm.tgz            
            
6.    设置权限。

        /data/busybox  chmod 777 ltp -R


三、    LTP测试运行:

1.在adb shell中运行如下命令:
        mount -o remount rootfs /

2.运行LTP测试的命令:
        cd /data/ltp
        /data/busybox ./runltp -p -l /tmp/resultlog.20051221 -d /tmp -o /tmp/ltpscreen.20051221 -t 1m
        
        ./runltp -p -l /tmp/resultlog.20051221 -d /tmp -o /tmp/ltpscreen.20051221 -t 1m
        
具体的测试项需要继续研究。。。