Saturday, 22 June 2013

Transfering files over serial to Minix/arm using ZMODEM

Since Minix doesn't have a network driver for the BeagleBone Black yet and swapping out the SD card all the time just to put one or two files on it is labour intensive, we need to find another way to (relatively) quickly transfer files from the development machine to the BeagleBone. Luckily, there are tools which can help us in this area.

The terminal program I use to interact with the BeagleBone over the serial connection, picocom, can use an external program, lrzsz, to support transfers using the ZMODEM protocol. It just so happens that Minix provides a ZMODEM implementation too. This combination is easy to setup and can transfer files to the bone for us. This guide explains how to setup and use it.

The first step is to install lrzsz on your development machine.
emerge lrzsz
Then, create a test file so we have something to try transfering.
echo "Hallo, Wereld" > test.txt

Next, start picocom with these options.
picocom -b 115200 /dev/ttyUSB0 --send-cmd "sz -vv -y"
Then, boot Minix. Need a hint? Try my other guides: Minix on the BeagleBone Black (Part 1, Part 2, Part 3), Netbooting Minix on the BeagleBone Black, Minix on the BeagleBoard-xM. Once you've gotten Minix up and running, you can log in as root and proceed to the next step.

Do Ctrl-a+s a to initiate a transfer (i.e. hold down the control key, press and release 'a', press and release 's', and finally release the control key). You will be prompted to enter the name of the file you want to transfer. Below I entered the name of the example file (test.txt) and pressed the enter key. The transfer should go and end with "*** exit status: 0" Here's what the output looks like:

*** file: test.txt
sz -vv -y test.txt
Sending: test.txt
Bytes Sent:     14   BPS:14                             

Transfer complete

*** exit status: 0
# cat test.txt
Hallo, Wereld

No comments:

Post a Comment