Serial File Uploads With Serio

So you’ve got an embedded device that’s running Linux, you’ve tapped into the board’s serial port and you have a root shell. You’re poking around and want to run netstat/netcat/grep/whatever – but it’s not installed! And what’s worse, the device doesn’t have any utilities to perform a network file transfer. How do you get the file you want to execute from your host machine up to the embedded device?

Transferring ASCII files can be done with minicom, but that method won’t work properly for binary files. ASCII encoding a binary file usually isn’t an option since most embedded systems won’t have utilities like base64 or uuencode in order to un-encode the transferred file, and other transfer methods (Xmodem/Ymodem/Zmodem, Kermit) require a corresponding utility to already be installed on the embedded device.

If the echo command on your serial shell supports the -n and -e options (most do), serio can help. It takes any local file and transfers it to the embedded system via the serial port with a series of echo commands.

The -n option is required in order to ensure that no additional new line characters get echoed into the resulting file, and the -e option allows serio to encode binary files as a series of escaped hex characters (\x41, \x42, etc).

This allows binary files to be transferred to a remote system via the serial port without any additional software requirements on the remote system:

Serio in action

Serio in action

File uploads are not very fast, so you’ll probably want to upload netcat/wget/tftp or similar utility in order to transfer additional files over the network. But in a pinch it works great for getting your cross-compiled binaries off your host system and onto that crippled embedded device that you’ve been dying to play with.

Bookmark the permalink.

4 Responses to Serial File Uploads With Serio

  1. asdfdsaf says:

    If the destination machine has rz, you could use minicom’s or qodem’s or even screen’s zmodem transfer capability.

    If the destination machine has uudecode or base64, you could just paste in the properly encoded files from the X clipboard on the source machine.

    Actually, one of the first binaries you might want to upload is rz, so you could transfer the rest via zmodem.

  2. Craig says:

    That’s true, but as pointed out in the post, embedded machines are often pretty stripped down and often don’t have utilities like rz, uudecode or base64. So it’s a bit of a catch-22; how do you get those tools onto the device if you can’t upload binaries to the device? That’s what serio is for.

    Actually the first binary I usually upload is netcat/tftp/ftp tools so I can transfer the files over the network, which I find much easier and faster than over the serial port.

  3. Roland says:

    Thank you,
    I spend Day’s to find a solution like this.
    I am working on an old “Freepad” and the 2.4.18 modifyed Linux did not have anything on it.

  4. Christopher says:

    For those looking, it’s here now:

Leave a Reply to Roland Cancel reply

Your email address will not be published. Required fields are marked *