RZ & SZ Porting and User Guide


1. Porting

lrzsz is a command line tool for file transfer. This tool set supports the ZModem protocol and can transfer files reliably and efficiently. The lrzsz tool set can transfer files only through the UART serial port without going through the network, USB and other hardware. It is simple and easy to use. It contains two main tools, rz and sz. rz is used to receive files, and sz is used to send files. Since it is based on the serial port for transmission, the speed is limited and it is generally used to transfer small files. If the embedded board needs to interact with the host (usually a Windows system) for files, the host needs to have a client that supports ZModem, such as XShell and SecureCRT under Windows.

1.1. Source code download

lrzsz download address

The code version used in this porting is lrzsz-0.12.20.

1.2. Cross-compiling

tar -zxvf lrzsz-0.12.20.tar.gz
cd lrzsz-0.12.20/
export PATH= /tools/toolchain/gcc-10.2.1-20210303-sigmastar-glibc-x86_64_aarch64-linux-gnu/bin: $PATH ; export ARCH= arm64 ; export CROSS_COMPILE= aarch64-linux-gnu-
./configure --prefix=$PWD/install  CC=aarch64-linux-gnu
make -j8
make install

Note that the export command in the above example steps specifies the compilation chain address. In actual operation, please declare it according to the actual compilation chain path. After executing the above steps, you will find the generated lrz and lsz programs in the lrzsz-0.12.20/install/bin path.

The original generated program is large in size and can be trimmed using the following command:

cd install/bin/
aarch64-linux-gnu-strip lsz --strip-unneeded -o sz
aarch64-linux-gnu-strip lrz --strip-unneeded -o rz

2. Environment Setup

2.1. Copy Files

Copy the rz and sz files to the project/release/chip/pcupid/dispcam/common/glibc/10.2.1/release/bin/debug directory and add executable permissions using the chmod +x command.

2.2. Image packaging

Executing make image_install under project will package rz and sz to project/image/output/customer.


3. Test verification

Here we take XShell as an example, start a serial port session, and enter rz and sz on the board for verification.

3.1. rz verification

Execute the rz command on the board, and a file selection dialog box will pop up on the host serial port session. After selecting a file on the host, click OK to transfer.

3.2. sz verification

Execute the sz command on the board to connect to a file on the board. The host serial port session will pop up a path selection dialog box. After specifying the target path to be transferred, click OK to start the transfer.