I'm using XMODEM to transfer a binary file from an Ubuntu VM to an embedded Linux target, like so:
$ sudo screen /dev/ttyUSB0 115200
$ rx test
CTRL-A:
$ exec !! sx -b test
Now, "test" transfers successfully, but when I inspect it on both the VM and the target, I get the following:
In addition, the permissions are reduced on the target.
Why is this, and how can I ensure the file transferred is the same as the source?
XMODEM transfers in 128-byte blocks, so the file will always be padded up to the next 128-byte boundary. YMODEM and ZMODEM include the filesize in the protocol and can transfer the correct number of bytes, but if you are limited to XMODEM, I suggest using tar
to wrap up the file on the host, which will encode the file size and perms, then untar it on the target. tar
might complain about the spare padding bytes, but it should still work.