本文主要是介绍Android集成lrzsz,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
为啥要移植lrzsz
本文中的lrzsz代码点击此处获取
Hikey开发板有两类USB口,两组USB-TypeA母口作为Host,可以接键盘、鼠标。另一组mini-USB母口,作为devices,可以接到电脑上调试。但目前这两种接口无法同时使用,即通过键盘鼠标操作时不能使用ADB。
虽然可以通过minicom或者putty之类的工具连接串口查看LOG、执行命令。但Android系统中缺少通过串口传输文件的工具,有文件传输需求的时候还需要插上ADB口,通过adb push/pull操作,不是太方便。
通过busybox的rx命令虽然可以接收文件,但无法将系统中的文件传输到主机上。而且rx只支持xmodem协议。一些新的工具如Xshell只能支持Zmodem协议。
lrzsz能够同时支持xmodem、ymodem以及zmodem协议,具备发送接收功能,能满足我们的需要。
交叉编译lrzsz
交叉编译分为以下几步:
- 准备交叉编译链。
这里面使用的是arm-linux-gnueabihf-4.9。可以到Linaro的主页下载。将下载到的文件解压缩到/opt/目录,设置好环境变量。
[david@opt]$ cd arm-linux-gnueabihf-4.9/bin/
[david@bin]$ export PATH=`pwd`:$PATH
[david@bin]$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2015.01-3) 4.9.3 20150113 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2下载lrzsz源码
从官方主页下载lrzsz软件包 lrzsz-0.12.20.tar.gz 。解压缩。
[david@Code]$ tar -zxvf lrzsz-0.12.20.tar.gz
3./configure:
[david@lrzsz-0.12.20]$ ./configure --host=arm-linux
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... missing
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether gcc needs -traditional... no
checking for ranlib... ranlib
checking for POSIXized ISC... no
checking for AIX... no
checking for minix/config.h... no
checking for gcc option to accept ANSI C... none needed
checking for function prototypes... yes
checking for working const... yes
checking for inline... inline
checking for syslog in -lsocket... no
checking for syslog in -lbe... no
checking for gethostbyname in -lnsl... yes
checking for ANSI C header files... yes
checking for fcntl.h... yes
checking for limits.h... yes
checking for sys/ioctl.h... yes
checking for sys/time.h... yes
checking for unistd.h... yes
checking for sys/times.h... yes
checking for termios.h... yes
checking for sys/termios.h... yes
checking for termio.h... yes
checking for sys/termio.h... no
checking for sgtty.h... yes
checking for termios.h... (cached) yes
checking for sys/termios.h... (cached) yes
checking for termio.h... (cached) yes
checking for sys/termio.h... (cached) no
checking for sgtty.h... (cached) yes
checking for sys/mman.h... yes
checking for utime.h... yes
checking for syslog.h... yes
checking for sys/syslog.h... yes
checking for sys/param.h... yes
checking for sys/select.h... yes
checking for strings.h... yes
checking for arpa/inet.h... yes
checking for size_t... yes
checking for mode_t... yes
checking for
这篇关于Android集成lrzsz的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!