Abstract: This article is about the ARM porting rz and sz commands. Embedded Linux porting rz and sz commands rz and sz are command-line tools for Linux/Unix and Windows to transfer ZModem files. Windows needs a telnet/ssh client that supports ZModem. , For example: SecureCRT
Tutorial Yunqi Conference Mysql Filing Document Domain Whois Query PHP Tutorial Backup Internet University Cloud Tutorial
Embedded Linux transplants rz and sz commands
rz and sz are command-line tools for ZModem file transfer between Linux/Unix and Windows. Windows needs a telnet/ssh client that supports ZModem, such as SecureCRT.
Run the command rz to receive the file, and SecureCRT will pop up a file selection dialog box. After selecting the file, close the dialog box, and the file will be uploaded to the current directory (binary transmission is used by default), run the command sz <file1name> <file2name> …(Multiple files can be sent at the same time) is to send files to windows.
The rz and sz files are transmitted through the serial port, and the transmission rate is slow, which is only suitable for the transmission of small files.
1. Download the rzsz source code package
http://freeware.sgi.com/source/rzsz/rzsz-3.48.tar.gz
I tried to find it on the Internet, but no download file was found. Those who are interested can try to download the source code. Here, the source code of Baidu rzsz can be downloaded under the Linux system command line, you can use the wget command to download.
wget http://freeware.sgi.com/source/rzsz/rzsz-3.48.tar.gz wget http://freeware.sgi.com/source/rzsz/rzsz-3.48.tar.gz
2. Unzip the rzsz file.
Use the tar xvzf command to decompress. Use the -C option to extract to the specified directory
[root@codeMonkey rzsz]# tar xvzf rzsz-3.48.tar.gz -C /root/ARM/
After decompression is complete, you can see a src file in the decompressed directory.
3. Modify the Makefile.
Modify lines 3 and 4 to read as follows:
CC = arm-linux-gcc OFLAG = -O -DREGISTERED -static
Line 3 means to specify the cross compiler, and line 4 means to remove the "UNREGISTERED COPY" prompt and use static compilation.
Note: static compilation must be specified here.
Because I did not add the -static option for the first time, the compiled command was downloaded to the /usr/bin directory of the root file system. When executing the rz command, the system prompts that the command cannot be found. The transplanted Linux system generally does not have a transplanted library file, so the dynamically compiled program will prompt that it cannot be found. This also indirectly proves that the compilation under the Linux system is dynamic compilation by default.
Regarding the difference between static compilation and dynamic compilation, please Baidu yourself. No more explanation here
You can also refer to this article: http://blog.csdn.net/zhengqijun_/article/details/51849968
4. Execute make posix to generate executable program.
[root@codeMonkey src]# make posix arm-linux-gcc -O -DREGISTERED -static -DPOSIX -DMD=2 rz.c -o rz size rz text data bss dec hex filename 501436 2120 17232 520788 7f254 rz rm -f rb rx rc ln rz rb ln rz rx ln rz rc arm-linux-gcc -O -DREGISTERED -static -DPOSIX sz.c -o sz size sz text data bss dec hex filename 508884 2176 50096 561156 89004 sz rm -f sb sx zcommand zcommandi ln sz sb ln sz sx ln sz zcommand ln sz zcommandi
Use the ls command to view
It can be found that many executable files have been generated, such as rz, sz, sx, etc.
5. Copy the generated executable file to the /usr/bin directory of the root file system
Use the cp command to assign
[root@codeMonkey src]# cp gz rb rc rx rz sb sx sz zcommand zcommandi ../../rootfs/usr/bin
6. Download to the development board and run.
After the Linux system starts successfully, execute the rz command to transfer files.
[root@MINI2440 /]# rz rz ready. Type "sz file ..." to your modem program Starting zmodem transfer. Press Ctrl+C to cancel. Transferring test.txt... Transferring test.txt... ?rz 3.48 01-27-98 finished.
Here I transferred a test.txt file. If the following picture appears after executing the rz command, there should be no problem.
The above is the entire content of ARM transplanting rz and sz commands. There are also related content of ARM transplanting rz and sz commands in the blog, Q&A, Yunqi account, people, courses and other columns of the Yunqi community. Please continue to use the search button in the upper right corner to search arm, transplant the rzsz command and download the rzsz source code so that you can get more relevant knowledge.