2012-08-30 131 views
1

是否有人交叉编译和使用Android的LTP,我尝试使用arm-eabi工具链,arm-linux-none-gnueabi工具链交叉编译LTP,但我无法执行测试用例Android设备。如何交叉编译LTP为android

+0

什么是'LTP'? –

+0

LTP是Linux测试项目,可用于测试任何模块的功能。例如我们可以使用LTP来测试USB驱动程序的功能。它可用于x86系统,我们需要交叉编译才能在android设备上运行它。 – LKL

+0

@赞歌杰:LTP来源:https://github.com/linux-test-project/ltp – pevik

回答

1

首先创建独立工具链(使用make-standalone-toolchain.sh脚本)并将其安装到/opt/android-standalone-toolchain.api-${API}中。

构建本身:

API=24 
export TOOLCHAIN_ROOT=/opt/android-standalone-toolchain.api-${API} 
export SYSROOT=$TOOLCHAIN_ROOT/sysroot 
export CROSS_COMPILE=$TOOLCHAIN_ROOT/bin/arm-linux-androideabi- 
export HOST=arm-linux-androideabi 

# Non-exhaustive lists of compiler + binutils 
# Depending on what you compile, you might need more binutils than that 
export CPP=${CROSS_COMPILE}cpp 
export AR=${CROSS_COMPILE}ar 
export AS=${CROSS_COMPILE}as 
export NM=${CROSS_COMPILE}nm 
export CC=${CROSS_COMPILE}gcc 
export CXX=${CROSS_COMPILE}g++ 
export LD=${CROSS_COMPILE}ld 
export RANLIB=${CROSS_COMPILE}ranlib 

export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include \ 
    -I${ANDROID_PREFIX}/include" 
export CPPFLAGS="${CFLAGS}" 
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib" 

make autotools 
./configure --host=${HOST} --with-sysroot=${SYSROOT} 
make -j$(getconf _NPROCESSORS_ONLN) ANDROID=1 
make install 
adb push /opt/ltp /data/local/tmp 

学分:使用可变ANDROID=1被记录在INSTALL文件在LTP源代码,设置的其它变量是由android_configure.sh启发。

但是,目前构建失败,因为许多测试需要被禁用(仿生学不支持许多必需的功能,请参阅谷歌人制作的list of tests needed to be disabled)。

目前,上游方面正在努力修复为Android构建LTP的问题。来自谷歌的人added LTP into AOSP,但他们将代码返回给LTP上游(请参阅LTP邮件列表中的信息people from google planning to contribute,their instructions about building)。

一些与android相关的修补程序(来自google和其他人):fix the executable shell pathfix temp dirfix stack_clash test

目前在AOSP中使用谷歌仓库可能会更容易(AOSP树中的in-tree内置或独立工具链的out-of-tree),但是早晚LTP上游应该从android仓库获得所有android修正。