Copying Files to the Device

There are several ways of transferring files to and from your target device. Please reference the following for some possible methods.

Using a Network


Before being able to transfer files using network protocols, you will first need to establish a network connection and know the ip address of the target device. See the ethernet interface guide for more information.

Secure Copy Protocol

Secure Copy Protocol (SCP) is built around a Secure Shell connection (SSH) and offers all the same security features. One advantage of using this method for transferring single files is that it is generally pretty fast but you won’t get interactive functionality when pulling multiple files from a remote server. For example, you won’t be able to list out directory contents and see what other files are available. SCP also has no file size limitations.


The following SCP section can be done in a Linux machine (Ubuntu) or in Windows via command prompt. Window’s command prompt can be access easily by hitting the Window’s key and typing “cmd” + Enter.

  • Using the terminal on your host machine, navigate to the directory containing the file you wish to transfer to the target device.

    Host (Ubuntu)
    cd <insert-path-to-files>
  • Use the following command to transfer your file:

    Host (Ubuntu)
    sudo scp <insert-name-of-file> root@<insert-IP-address>:~
  • Your copied file will appear in the root directory on the target device.

  • To go the other direction and retrieve files from the target device, just flip the source and destination arguments:

    Host (Ubuntu)
    sudo scp root@<insert-IP-address>:<insert-name-of-file> <insert-path-to-destination>

Using Removable Storage Devices

USB Storage Device

These instructions walkthrough exercising the USB host interface on the development kit, but since your Ubuntu Host Machine is also a Linux system, you can similarly transfer files to the same storage media to exchange files.

The USB0 interface uses a USB hub to split the bus to 4x locations.

USB0 Split by USB Hub



Header Location



USB A Double Stacked





Mini PCIe





Pin Header


X27 (Pin 21, 22, 37, 39)




The USB super speed signals are muxed between the miniPCIe interface and the USB HUB. Enabling miniPCIe (done via device tree overlay) will disable USB3.0 speeds at the stacked type-A USB connector but USB2.0 speeds will still be available.

What You Will Need

Verifying USB Interface

  • With the phyCORE-AM64x development kit booted into Linux, see that there are 4 USB devices. There should be 2 devices on each bus.

    Target (Linux)
    Expected Output
    root@phyboard-electra-am64xx-1:device# lsusb
    Bus 002 Device 002: ID 0451:8240
    Bus 002 Device 001: ID 1d6b:0003
    Bus 001 Device 002: ID 0451:8242
    Bus 001 Device 001: ID 1d6b:0002
  • Insert a USB3.0 storage device into the bottom connector on X13. You should see something like the following on the serial console:

    Expected Output
    root@phyboard-electra-am64xx-1:device# [ 2359.689614] usb 2-1.2: new SuperSpeed Gen 1 USB device number 3 using xhci-hcd
      [ 2359.714497] usb 2-1.2: New USB device found, idVendor=0781, idProduct=5591, bcdDevice= 1.00
      [ 2359.722872] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      [ 2359.730201] usb 2-1.2: Product:  SanDisk 3.2Gen1
      [ 2359.734861] usb 2-1.2: Manufacturer:  USB
      [ 2359.738886] usb 2-1.2: SerialNumber: 0401a83fbd697e437712b826697973aaaf57d1c75e9691ad879dfe7934b8a81bea020000000000000000000037ac13c5ff935d18915581076e2cc649
      [ 2359.781446] usb-storage 2-1.2:1.0: USB Mass Storage device detected
      [ 2359.788793] scsi host0: usb-storage 2-1.2:1.0
      [ 2359.795673] usbcore: registered new interface driver usb-storage
      [ 2360.802478] scsi 0:0:0:0: Direct-Access      USB      SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
      [ 2360.811765] sd 0:0:0:0: [sda] 30031872 512-byte logical blocks: (15.4 GB/14.3 GiB)
      [ 2360.820424] sd 0:0:0:0: [sda] Write Protect is off
      [ 2360.831340] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
      [ 2360.862799]  sda:
      [ 2360.870177] sd 0:0:0:0: [sda] Attached SCSI removable disk
  • Re-run the ‘lsusb’ command and vaerify that the USB drive connected to bus 002.

    Target (Linux)
    Expected Output
    root@phyboard-electra-am64xx-1:device# lsusb
    Bus 002 Device 003: ID 0781:5591
    Bus 002 Device 002: ID 0451:8240
    Bus 002 Device 001: ID 1d6b:0003
    Bus 001 Device 002: ID 0451:8242
    Bus 001 Device 001: ID 1d6b:0002
  • To list more information about the USB device and buses on the development kit use the following command.

    This command will output a good chunk of information. This guide will only show a snippet of the expected output for the USB drive that was just connected.

    Target (Linux)
    lsusb -v
    Expected Output for Example USB Drive
    Bus 002 Device 003: ID 0781:5591
    Device Descriptor:
    bLength                18
    bDescriptorType         1
    bcdUSB               3.00
    bDeviceClass            0
    bDeviceSubClass         0
    bDeviceProtocol         0
    bMaxPacketSize0         9
    idVendor           0x0781
    idProduct          0x5591
    bcdDevice            1.00
    iManufacturer           1  USB
    iProduct                2  SanDisk 3.2Gen1
    iSerial                 3 0401a83fbd697e437712b826697973aaaf57d1c75e9691ad879dfe7934b8a81bea020000000000000000000037ac13c5ff935d18915581076e2cc649
    bNumConfigurations      1
    Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x002c
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
  • The speed of the USB device can be determined with either the lsusb -v from above or by reading the device’s “speed”

    Target (Linux)
    cat /sys/bus/usb/devices/2-1/speed
    Expected Output
    root@phyboard-electra-am64xx-1:~# cat /sys/bus/usb/devices/2-1/speed


    USB3.0 has transmission speeds up to 5000 Mbit/s, also known as “super speed”. USB2.0 has transmission speeds up to 480Mbit/s, also known as “full speed”.

Mounting USB Stroage Devices

  • Verify that a device directory was established for the USB drive.

    1. Run the following command to find the USB device name.

      Target (Linux)
      ls /dev/sd*
      Expected Output
      root@phyboard-electra-am64xx-1:~# ls /dev/sd*
    2. Remove the USB drive.

    3. Re-run the ‘ls /dev/sd’ command to confirm the device name.

      Expected Output
       root@phyboard-electra-am64xx-1:~# [ 4048.519498] usb 2-1.2: USB disconnect, device number 3
       root@phyboard-electra-am64xx-1:~# ls /dev/sd*
       ls: /dev/sd*: No such file or directory
    4. Re-insert the USB drive to the bottom connector of X13.


    In this example the device name for the USB drive is “sda”.

  • Make a directory for mounting the USB device.

    Target (Linux)
     mkdir ~/usb_sda
  • Mount the USB device to the directory.

    Target (Linux)
    mount /dev/sda ~/usb_sda/
  • See what media is on the USB drive.

    Target (Linux)
     ls ~/usb_sda/

Write to the USB Host Device

  • Generate a random 10 MB file to test transferring data from the storage device.

    Target (Linux)
    dd if=/dev/urandom of=test.file count=10 bs=1M
    Expected Output
    root@phyboard-electra-am64xx-1:~# dd if=/dev/urandom of=test.file count=10 bs=1M
    10+0 records in
    10+0 records out
  • Copy the file to your storage device.

Target (Linux)
cp test.file ~/usb_sda/ && sync

Read from the USB Host Device

  • Copy the test file we previously created during the write process back to the host:

    Target (Linux)
    cp ~/usb_sda/test.file readback-usb.file && sync
  • We can double check that the file was successfully copied to and from the USB device by checking the md5sum of the file:

    Target (Linux)
    md5sum test.file readback-usb.file
    Expected Output
    root@phyboard-electra-am64xx-1:~# md5sum test.file readback-usb.file
    d3aa3ee1db746d6f7fb66c9b42f4ea6b  test.file
    d3aa3ee1db746d6f7fb66c9b42f4ea6b  readback-usb.file

Unmounting the Drive


Make sure the drive is unmounted prior to physically disconnecting the device. Failure to do so may result in loss of data and corruption of files

Target (Linux)
umount ~/usb_sda/

SD Card (Root Partition)

Since our Host Machines have access to the SD Card readers, we can use the bootable SD Card itself to transfer files to and from the development kit too, the only down side for this is that you will want to power off the development kit before removing the primary booting device.

  • Power off the development kit.

    Target (Linux)
  • Remove the SD card and connect it to your Linux machine via an SD card reader.


    You will not be able to place files on the SD card using Windows because the SD Card is formatted for Linux. Windows does not recognize the format.

    The SD Card is formatted with a minimal root filesystem size by default and in order to transfer larger files it may become necessary to increase its size to take advantage of the full size of the SD Card.

  • Increase the root filesystem partition of the SD card.

    1. Run the following command without the SD card connected to the host machine.

      Host (Ubuntu)
      ls /dev/sd*
    2. Connect the bootable SD card to your Ubuntu host machine.

    3. Run the following command with the SD card connected to the host machine.

      The SD card device name is of the form /dev/sd[a-z] in Ubuntu and the letter identifier along with any partitions (signified by the numbers following the letter) on the SD card are enumerated upon connection to the host machine. Look at the second output of the command and look for new devices that appeared there, the new device will correspond to the SD card. Remember the /dev/sdX identifier corresponding to your SD card as you will need to use this in the following step.

      Host (Ubuntu)
      ls /dev/sd*
      **Be confident you have the correct */dev/sdX* device identified for your SD card before proceeding.** Specifying the incorrect disk using the *'fdisk'* utility in the steps below can potentially destroy your Virtual Machine and will require you to set it back up again from scratch.
    4. It is best to first backup the SD card to a file just in case something goes terribly wrong and you end up losing its contents:


      Be confident you have the correct */dev/sdX* device identified for your SD card before proceeding. Specifying the incorrect disk using the ‘fdisk’ utility in the steps below can potentially destroy your Virtual Machine and will require you to set it back up again from scratch.

      Host (Ubuntu)
       umount /dev/sdX*    #unmount the entire SD Card, not just any single partition
       sudo dd if=/dev/sdX of=~/backup.sdcard bs=1M conv=fsync && sync
    5. Use the fdisk utility and provided command sequence to create a new, larger root filesystem partition in the SD card’s partition table:

      Host (Ubuntu)
      sudo fdisk /dev/sdX
      # fdisk is an interactive utility, use the following command sequence
      # p (print the partition table and note the starting sector of the 2nd partition, call this START2. START2=196608 using the pre-built software)
      # d (delete a partition)
      # 2 (select the root filesystem)
      # n (create a new partition)
      # p (make it a primary partition)
      # 2 (make it the second partition)
      # START2 (specify the same starting sector for the 2nd partition as before)
      # ENTER (just hit ENTER to use the default size, which will automatically use up the remaining space on the SD Card)
      # w (write the changes)
    6. Disconnect and reconnect the SD card from the host machine at this point to ensure the new partition table is being picked up by the kernel.

    7. Finally, grow the root filesystem to take up the entire space in the partition:

      Host (Ubuntu)
      sudo resize2fs /dev/sdX2