usbmuxd通过交叉编译移植到Android上(一)

1、git clone http://git.libimobiledevice.org/usbmuxd.git

2、配置好ubuntu下ndk编译环境,配置好以后执行ndk-build会有如下的打印,证明配置ndk编译环境正确。

 3、编写.mk,在根目录下mkdir -p android/jni并创建如下:

usbmuxd通过交叉编译移植到Android上(一)_第1张图片

4、编译依赖库如下,需要自己一一整理编译,后续章节会持续更新如何一一编译如下依赖库

include $(CLEAR_VARS)
LOCAL_MODULE := plist
LOCAL_SRC_FILES := ../libplist.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := usb1.0
LOCAL_SRC_FILES := ../libusb1.0.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := imobiledevice
LOCAL_SRC_FILES := ../libimobiledevice.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := usbmuxd
LOCAL_SRC_FILES := ../libusbmuxd.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := decrepit
LOCAL_SRC_FILES := ../libdecrepit.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := crypto
LOCAL_SRC_FILES := ../libcrypto.a
include $(PREBUILT_STATIC_LIBRARY)

 5、步骤3、4创建编译规则后,在jni目录执行ndk-build

usbmuxd通过交叉编译移植到Android上(一)_第2张图片

 6、usbmuxd生成完,

     6.1 拷贝到android系统system/bin,

     6.2 并chmod 777 /system/bin/usbmuxd

     6.3 usbmuxd -v -f &,回车如下图表示移植OK

usbmuxd通过交叉编译移植到Android上(一)_第3张图片

你可能感兴趣的:(android,java,apache)