【问题标题】:How to Cross Compile LTP for android如何为 android 交叉编译 LTP
【发布时间】:2012-08-30 23:44:37
【问题描述】:

是否有人交叉编译并使用 LTP for android,我尝试使用 arm-eabi 工具链、arm-linux-none-gnueabi 工具链交叉编译 LTP,但我无法在 android 设备中执行测试用例。

【问题讨论】:

  • LTP是Linux Test Project,可以用来测试任何模块的功能。例如,我们可以使用 LTP 测试 USB 驱动程序的功能。它适用于x86系统,我们需要交叉编译才能在android设备上运行。
  • @ZangMingJie:LTP 来源:github.com/linux-test-project/ltp

标签: android linux testing cross-compiling


【解决方案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

CREDITS:使用变量 ANDROID=1 记录在 LTP 源代码的 INSTALL 文件中,设置其他变量的灵感来自 android_configure.sh

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

目前,上游正在努力修复为 Android 构建 LTP。来自 google added LTP into AOSP 的人,但他们将代码贡献回 LTP 上游(请参阅 LTP 邮件列表中的信息 people from google planning to contributetheir instructions about building)。

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

目前在 AOSP 中使用 google 的存储库可能更容易(在 AOSP 树中的树内构建或带有独立工具链的树外构建),但 LTP 上游迟早应该从 google 的存储库中获得所有针对 android 的修复。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-10
    • 2016-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多