Embedded Linux: Transplantation of lrzsz software, a tool for serial port file transfer


 When the network is not connected, the serial port is YYDS! Well, this is it.

Buildroot direct configuration

Target packages  --->
	Networking applications  ---> 
		[*] lrzsz

insert image description here
Just choose it!

download source code

Official website: https://ohse.de/uwe/software/lrzsz.html
insert image description here

unzip configuration

After decompression, enter the decompressed directory, and then configure:

$ tar -zxvf lrzsz-0.12.20.tar.gz 
$ cd lrzsz-0.12.20/
$ CC=arm-linux-gnueabihf-gcc CFLAGS=-O2 ./configure

Print log:

liefyuan@ubuntu:~/Liefyuan/bingpi-v3s$ tar -zxvf lrzsz-0.12.20.tar.gz 
lrzsz-0.12.20/
lrzsz-0.12.20/Makefile.in
lrzsz-0.12.20/README
lrzsz-0.12.20/ABOUT-NLS
lrzsz-0.12.20/AUTHORS
...
liefyuan@ubuntu:~/Liefyuan/bingpi-v3s$ cd lrzsz-0.12.20/
liefyuan@ubuntu:~/Liefyuan/bingpi-v3s/lrzsz-0.12.20$ CC=arm-linux-gnueabihf-gcc CFLAGS=-O2 ./configure
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... arm-linux-gnueabihf-gcc
checking whether the C compiler (arm-linux-gnueabihf-gcc -O2 ) works... yes
checking whether the C compiler (arm-linux-gnueabihf-gcc -O2 ) is a cross-compiler... yes
checking whether we are using GNU C... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking whether arm-linux-gnueabihf-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 arm-linux-gnueabihf-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 off_t... yes
checking for speed_t... yes
checking for st_rdev in struct stat... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether sys/time.h and sys/select.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for errno declaration... yes
checking return type of signal handlers... void
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... no
checking for working alloca.h... yes
checking for alloca... yes
checking for gettimeofday... yes
checking for settimeofday... yes
checking for strchr... yes
checking for memcpy... yes
checking for select... yes
checking for vprintf... yes
checking for times... yes
checking for rdchk... no
checking for utime... yes
checking for syslog... yes
checking for siginterrupt... yes
checking for mkdir... yes
checking for mktime... yes
checking for strerror... yes
checking for strstr... yes
checking for strdup... yes
checking for strtoul... yes
checking for strtol... yes
checking for strpbrk... yes
checking for stpcpy... yes
checking for strftime... yes
checking for vasprintf... yes
checking for getopt_long... yes
checking for ftime... yes
checking that ftime works correctly... will check at run time
checking for timezone variable... yes
checking for LOG_UUCP... yes
checking for argz.h... yes
checking for limits.h... (cached) yes
checking for locale.h... yes
checking for nl_types.h... yes
checking for malloc.h... yes
checking for string.h... yes
checking for unistd.h... (cached) yes
checking for values.h... yes
checking for sys/param.h... (cached) yes
checking for getcwd... yes
checking for munmap... yes
checking for putenv... yes
checking for setenv... yes
checking for setlocale... yes
checking for strchr... (cached) yes
checking for strcasecmp... yes
checking for __argz_count... yes
checking for __argz_stringify... yes
checking for __argz_next... yes
checking for LC_MESSAGES... yes
checking whether NLS is requested... yes
checking whether included gettext is requested... no
checking for libintl.h... yes
checking for gettext in libc... yes
checking for msgfmt... /usr/bin/msgfmt
checking for dcgettext... yes
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for catalogs to be installed...  de
updating cache ./config.cache
creating ./config.status
creating Makefile
creating intl/Makefile
creating lib/Makefile
creating testsuite/Makefile
creating man/Makefile
creating po/Makefile.in
creating src/Makefile
creating debian/rules
creating Specfile
creating systype
creating src/lrzszbug
creating config.h

Compile and install

Compile and install commands:

make -j16

Enter the directory after compiling /src, and there are two important files in it: lrzand lsz
insert image description here

Copy the file to the development board

 Copy the generated lrz and lsz to the /bin directory of the development board (or your own directory, but then you need to set the system environment variable echo $PATH to view the environment variables and view the setting effect)

liefyuan@ubuntu:~/Liefyuan/bingpi-v3s/lrzsz-0.12.20/src$ ls
ansi2knr.1  lrz          lsyslog.o    Makefile.in  tcp.o      zm.o
ansi2knr.c  lrz.c        lsz          protname.c   timing.c   zmodem.h
canit.c     lrz.o        lsz.c        protname.o   timing.h   zperr.c
canit.o     lrzszbug     lsz.o        rbsb.c       timing.o   zperr.o
crctab.c    lrzszbug.in  Makefile     rbsb.o       zglobal.h  zreadline.c
crctab.o    lsyslog.c    Makefile.am  tcp.c        zm.c       zreadline.o
liefyuan@ubuntu:~/Liefyuan/bingpi-v3s/lrzsz-0.12.20/src$ scp lrz [email protected]:/bin
[email protected]'s password: 
lrz                                           100%   70KB  70.4KB/s   00:00    
liefyuan@ubuntu:~/Liefyuan/bingpi-v3s/lrzsz-0.12.20/src$ scp lsz [email protected]:/bin
[email protected]'s password: 
lsz                                           100%   76KB  75.6KB/s   00:00    

The /bin directory on the development board:
insert image description here
both the transmission and reception of files are carried out on the MobaXterm software!

Use lrz to transfer files from PC to development board

  • Step 1: Enter the MobaXterm command line lrz. At this time, there are garbled characters in the command line, which means that the development board is waiting to receive.
  • Step 2: Right-click the mouse in the black frame of MobaXterm, and select the options in the picture below:
    insert image description here- Step 3: Select the file to be sent on the computer at this time
    insert image description hereinsert image description here
# lrz
▒Sending: hehehehheh.txt*B0100000023be50
▒*B0900000000a87c
Bytes Sent:      9   BPS:55
▒*B0800000000022d
Transfer complete

That's it.

Use lsz to transfer files from the development board to the PC

Send files in the development board terminal

# lsz helloliefyuan.txt

There will be garbled characters. At this time, you need to control the mouse and right click on the terminal
insert image description here
insert image description here

# lsz helloliefyuan.txt
▒lrz waiting to receive.*CD@@@@▒Q▒3helloliefyuan.txt@16 4577 100644 0 1 16@k▒I▒▒

Receiving: helloliefyuan.txt
Downloading: 100% kBytes received:      0/     0   kBPS:0
▒OO# 00000000022d
Transfer complete

Then it was accepted.

Note that there will be problems if the file to be sent already exists!

Guess you like

Origin blog.csdn.net/qq_28877125/article/details/127505798