This how-to describes how you can add new files (executables, libraries, data/config, etc.) to a running Linux system.

Task Dependencies (Pre-requisites)


Input Files Required

  • Files that are to be added to the target

FTP File Transfer

If there is an Ethernet connection, and an FTP server is running on the target machine, files may be transferred via SFTP:
host> sftp root@<IP of target> 21
root@<IP of target>'s password: root
sftp> cd <directory>
sftp> put <file(s) to be copied>
sftp> quit
Keep in mind that when the target is shutdown any changes to the root filesystem will be lost since the instructions on the this Wiki use a RAM based filesystem.

UART File Transfer

This external guide explains the principles for transferring files to a running system via the UART and this page describes how to use minicom as terminal emulator.

First encode your file using uuencode. Uuencode encodes files in a way that they contain of ASCII characters only, so they can be sent across a UART connection expecting ASCII encoded data.
host$ uuencode source_file_name target_file_name > encoded_file

Then in the connected minicom execute
zynq$ cat > tmp_file

And then hit ctrl+a, s navigate the popup and select encoded_file, which was created above. The file will be transferred over the line.
Back at the prompt press ctrl+d to stop the cat process.
And finally decode the transferred file back to its original binary format
zynq$ uudecode tmp_file

SSH File Transfer

When the target is running an ssh daemon scp can be used to easily transfer files between the target and host computer.
The basic syntax for the scp command is as follows
scp <user>@<host1>:<source path> <user>@<host2>:<destination path>

If either file is directly accessible from the local machine, the '<user>@<host>:' part can be omitted.
The path after the colon is relative to the user's home directory, unless it starts with a '/', which indicates an absolute path.

Copying files into the root filesystem image

See the Build and Modify a Rootfs page for instructions on embedding the files into the rootfs (in order to make the changes to the filesystem persistent everytime Linux boots).
For MicroBlaze and PowerPC, the new initramfs will need to be embedded in the the kernel image (see the Build Linux Kernel page).

Related Links