We recommend following these steps using a browser on your Ubuntu Virtual Machine! This will ensure that the files you download are easily accessible in the VM. If you have a shared folder setup between your Host and Guest OS then this is not necessary.

This guide explains how to create a bootable SD card for the phyCORE-AM57x development kit using Linux. You will need the following to complete these instructions:

Requirements

  • SDHC SD card, at least 8GB for PHYTEC's TISDK release image
  • Linux Host PC or Virtual Machine
    • Ubuntu 16.04 LTS recommended
    • SD card reader (operational under Linux)
  • Pre-built Binary Images 

If you have built your own images by following the BSP Development Guide, then the images are located in: $YOCTO_DIR/build/arago-tmp-external-linaro-toolchain/deploy/images/<MACHINE>/

Flashing the SD Card

  • Download the pre-built Pre-built Binaries for the latest BSP release.
  • Download TI's create-sdcard.sh script which will be used to partition your SD card

    TI's create-sdcard.sh script will be built with the BSP by default. The script can be found in the PSDK tarball (processor-sdk-linux-image-am57xx-phycore-kit.tar.xz) which is also deployed automatically. For more information regarding the script, see: http://processors.wiki.ti.com/index.php/Processor_SDK_Linux_create_SD_card_script

  • From the Terminal, navigate to the directory containing the create-sdcard.sh script (the command below assumes your default download directory is Downloads). 

    Host (Ubuntu)

    cd ~/Downloads
    CODE
  • Add executable permissions to the create-sdcard.sh script. 

    Host (Ubuntu)

    chmod +x create-sdcard.sh
    CODE
  • Connect the SD card to the host PC
  • From a terminal run the SD card partition script with root permissions

    Host (Ubuntu)

    sudo ./create-sdcard.sh
    CODE
  • Select the drive corresponding to the SD card. In this case the SD Card was sdc which was selected by entering a 1.

    Example Output

    ################################################################################
    
    This script will create a bootable SD card from custom or pre-built binaries.
    
    The script must be run with root permissions and from the bin directory of
    the SDK
    
    Example:
     $ sudo ./create-sdcard.sh
    
    Formatting can be skipped if the SD card is already formatted and
    partitioned properly.
    
    ################################################################################
    
    
    Available Drives to write images to: 
    
    #  major   minor    size   name 
    1:   8       32    7761920 sdc
     
    Enter Device Number or n to exit: 1
    
    
    CODE
  • Enter 2 for the number of partitions

     Expand to view the Example Output

    Example Output

    ################################################################################
    
    Number of partitions needed [2/3] : 2
    
     
    Now partitioning sdc with 2 partitions...
     
    
    ################################################################################
    
    		Now making 2 partitions
    
    ################################################################################
    
    1024+0 records in
    1024+0 records out
    1048576 bytes (1.0 MB) copied, 0.913801 s, 1.1 MB/s
    Disk /dev/sdc doesn't contain a valid partition table
    DISK SIZE - 7948206080 bytes
    Checking that no-one is using this disk right now ...
    OK
    
    Disk /dev/sdc: 966 cylinders, 255 heads, 63 sectors/track
    
    sfdisk: ERROR: sector 0 does not have an msdos signature
     /dev/sdc: unrecognized partition table type
    Old situation:
    No partitions found
    New situation:
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
    
       Device Boot Start     End   #cyls    #blocks   Id  System
    /dev/sdc1   *      0+      8       9-     72261    c  W95 FAT32 (LBA)
    /dev/sdc2         10     965     956    7679070   83  Linux
    /dev/sdc3          0       -       0          0    0  Empty
    /dev/sdc4          0       -       0          0    0  Empty
    Successfully wrote the new partition table
    
    Re-reading the partition table ...
    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
    to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
    (See fdisk(8).)
    
    ################################################################################
    
    		Partitioning Boot
    
    ################################################################################
    mkfs.fat 3.0.26 (2014-03-07)
    mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
    
    ################################################################################
    
    		Partitioning rootfs
    
    ################################################################################
    mke2fs 1.42.9 (4-Feb-2014)
    Filesystem label=rootfs
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    480496 inodes, 1919767 blocks
    95988 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=1967128576
    59 block groups
    32768 blocks per group, 32768 fragments per group
    8144 inodes per group
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    CODE
  • Enter n when asked to continue. We will copy the necessary files to the partitions manually. 

    Example Output

    ################################################################################
    
       Partitioning is now done
       Continue to install filesystem or select 'n' to safe exit
    
       **Warning** Continuing will erase files any files in the partitions
    
    ################################################################################
    
    
    Would you like to continue? [y/n] : n
    CODE
  • Mount the newly created partitions. This can be done in Ubuntu by clicking boot and root in the file browser.

  • Use the terminal to copy U-Boot and MLO to the boot partition (be sure to replace <user> accordingly for your system):

    Host (Ubuntu)

    cp u-boot.img /media/<user>/boot/u-boot.img && sync
    cp MLO /media/<user>/boot/MLO && sync
    CODE
  • Use the terminal to extract the filesystem to the root partition. The filesystem includes the Linux kernel. 

    sudo tar -Jxf tisdk-rootfs-image-am57xx-phycore-kit.tar.xz -C /media/<user>/rootfs && sync
    CODE
  • Unmount the partitions and remove the SD card 

    Host (Ubuntu)

    umount /media/<user>/boot /media/<user>/rootfs
    CODE
  • You SD card should now be ready to boot your hardware into Linux.

Updating Individual Parts of the SD Card

Once the SD card has been formatted and flashed the first time, you may update the kernel, root filesystem, and U-Boot images individually. This will be necessary to do throughout development as you modify individual components to suit your application requirements.

 Click here to expand...

Root Filesystem

  • Delete the contents of the current root filesystem:

    Host (Ubuntu)

    sudo rm -rf /media/<user>/rootfs/*
    CODE
  • Extract the new filesystem to the SD Card:

    Host (Ubuntu)

    sudo tar -Jxf tisdk-rootfs-image-am57xx-phycore-kit.tar.xz -C /media/<user>/rootfs && sync
    CODE

Linux Kernel

The root filesystem tarball already contains a default kernel and default dtb files in its /boot directory.

  • Remove the existing Linux kernel and device tree image pertaining to your SOM (in this example we will assume the SOM is the standard kit option PCM-057-41300111I):

    Host (Ubuntu)

    sudo rm /media/<user>/rootfs/boot/zImage
    sudo rm /media/<user>/rootfs/boot/am5728-phycore-kit-41300111i.dtb
    CODE

    You may notice that the /boot directory contains many dtb files for various SOM configurations. This is because the EEPROM on the phyCORE-AM57x SOM is used to help select which device tree should be used at boot. This strategy allows for the use of a single software image to support all phyCORE-AM57x variants.


    For more information on this EEPROM mechanism, checkout Using the PHYTEC EEPROM Flashtool.

  •  Load the new Linux kernel and device tree images to the SD Card. Note that u-boot expects the kernel to be named zImage and the standard SOM dtb file to be named am5728-phycore-kit-41300111i.dtb:

    Host (Ubuntu)

    sudo cp zImage /media/<user>/rootfs/boot/zImage && sync
    sudo cp am5728-phycore-kit-41300111i.dtb /media/<user>/rootfs/boot/am5728-phycore-kit-41300111i.dtb && sync
    CODE

Bootloader

  • Remove the existing U-Boot and MLO images:

    Host (Ubuntu)

    rm /media/<user>/boot/u-boot.img
    rm /media/<user>/boot/MLO
    CODE
  • Copy the new images to the SD Card:

    Host (Ubuntu)

    cp u-boot.img /media/<user>/boot/u-boot.img && sync
    cp MLO /media/<user>/boot/MLO && sync
    CODE