在pc上,无论是windows还是linux都可以连接管理你的ios设备,那么如何去实现在arm平台下与ios通信呢,其实你你需要把linux下的usbmuxd和libimobiledevice交叉编译就可以了,管道就打通了,接下你也可以用ssh或ifuse。
编译环境:
系统:Linux 2.6.32-74-generic #142-Ubuntu SMP i686 GNU/Linux
交叉编译器: arm-none-linux-gnueabi-gcc RDK: DVRRDK_04.00.00.03(没有这个可以根据需要编译自己需要的库)
设备: arm linux板(dm368)+ ipone5s(ios8.3) +usb线
编译步骤
环境配置
export PREFIX=/opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usrexport HOST=arm-none-linux-gnueabiexport BUILD=x86_64-unknown-linux-gnuexport LD_LIBRARY_PATH=$PREFIX/libexport PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
libusb
Package: libusb-1.0.8.tar.bz2
a. 先声明上面的环境
b. ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX --disable-static --disable-logc. maked.make install
libplist
Package: libplist-1.3.tar.bz2
这个需要用cmake编译,自己写一个toolchain.cmake 修改交叉编译变量
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)#this one not so muchSET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER /opt/arm-2009q1/bin/arm-none-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER /opt/arm-2009q1/bin/arm-none-linux-gnueabi-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
然后在源码目录下 新建build文件夹
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake ..
make DESTDIR=$PREFIX install
usbmuxd
Package: usbmuxd-1.0.4.tar.bz2
编译方法和libplist是一样的。现在通道已经打通。
后续
采用上面的方法,你也可以编译出
libgpg-error
Package: libgpg-error-1.7.tar.gz
libgcrypt
Package: libgcrypt-1.4.6.tar.gz
libtans1
Package: libtasn1-2.7.tar.gz
gnutls
Package: gnutls-2.8.6.tar.bz2
需要修改一下src/makefile 的LDFLAGS 值
LDFLAGS=/opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/lib/libgcrypt.so /opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/lib/libgpg-error.so
libimobiledevice
新建一个build.sh
./configure --build=$BUILD --host=$HOST --prefix=$PREFIX libusbmuxd_CFLAGS="-I$PREFIX/include" libusbmuxd_LIBS="-L$PREFIX/lib" libgnutls_CFLAGS="-I$PREFIX/include" libgnutls_LIBS="-L$PREFIX/lib" libtasn1_CFLAGS="-I$PREFIX/include" libtasn1_LIBS="-L$PREFIX/lib" libplist_CFLAGS="-I$PREFIX/include" libplist_LIBS="-L$PREFIX/lib" libglib2_CFLAGS="-I$PREFIX/include -I$PREFIX/lib/glib-2.0/include" libglib2_LIBS="-L$PREFIX/lib" --without-swig LDFLAGS="-L/opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/lib -L/opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/usr/local/lib -lusbmuxd " CFLAGS="-I/opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/usr/local/include -I/opt/dvrrdk/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/include"
sh build.sh
make
make install
也许你需要继续 编译fuse 和ifuse ,那么你就可以去mount ios设备了。
文章参照 Mounting an iPod/iPhone on a Linux device http://paguilar.org/?p=31
补充说明
上面usbmuxd的1.0.4版本不支持ipone5s 的ios8.3,又试了usbmuxd 1.0.7 是ok的。 我只使用了发现设备连接设备(libplist usbmuxd),打通管道,你也可以编译文章提到的其他工具,甚至写个qt程序。