1 / 8

交叉编译

交叉编译. 对外包解密软件的. 交叉编译. 交叉编译的概念 在一个平台的上生成另一个平台上的可执行代码。 平台的概念 平台包含 两个概念: 体系结构、操作系统。 同一个 体系 结构可以运行不同 的操作系统;同样,同一个操作系统也 可 以 在不同的 体系结构上运行。 举例来说 ,我们常说的 x86 Linux 平台实际上是 Intel x86 体系结构和 Linux for x86 操作系统的统称。. 交叉编译. 宿主机: Intel x86 体系结构 和 Linux for x86 操作系统 目标机: ARM 体系结构和 Android 操作系统

kenda
Download Presentation

交叉编译

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 交叉编译 对外包解密软件的

  2. 交叉编译 • 交叉编译的概念 在一个平台的上生成另一个平台上的可执行代码。 • 平台的概念 平台包含两个概念:体系结构、操作系统。同一个体系结构可以运行不同的操作系统;同样,同一个操作系统也可以在不同的体系结构上运行。 举例来说,我们常说的x86 Linux平台实际上是Intel x86 体系结构和Linux for x86操作系统的统称。

  3. 交叉编译 宿主机:Intel x86体系结构和Linux for x86操作系统 目标机:ARM体系结构和Android操作系统 交叉编译器:android-ndk-r9b 动态库:gmp、pbc、openssl

  4. 编译过程(一) • Android-ndk的安装配置 • 动态库的生成 • 下载gmp、pbc、openssl的安装包 • 添加临时变量,修改编译器 • ./configure --host=arm-linux-androideabi生成Makefile • make编译 • 复制动态库和头文件到NDK中

  5. 编译过程(二) • 新建android jni工程 • 将外包解密的源文件拷入jni文件夹中 • 编写Android.mk • 使用ndk-build编译 • 编译成功,生成可执行代码

  6. 谢谢观看

  7. 临时变量 • export CC="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-gcc --sysroot=$NDKROOT/android_armeabi/sysroot" • export CXX="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-g++ --sysroot=$NDKROOT/android_armeabi/sysroot" • export AR="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-ar" • export SYSROOT="$NDKROOT/android_armeabi/sysroot" • export PATH="$NDKROOT/android_armeabi/bin":$PATH

  8. Android.mk include $(CLEAR_VARS) LOCAL_LDLIBS := -lfenc -lcrypto -lssl -lgmp -lpbc LOCAL_MODULE := abe-dec2 LOCAL_SRC_FILES := \ base64.h\ common.h\ base64.c\ common.c\ mgabe-dec2.c include $(BUILD_EXECUTABLE)

More Related