The phyBOARD-Zeta is delivered with a pre-flashed bootloader. The following instructions for flashing images from SD card will be useful if you want to:

  • Flash images because eMMC is empty
  • Upgrade to a new release
  • Use custom built images

Pre-built images are available on PHYTEC's Artifactory. If you have built your own images, then the images are located in:  $YOCTO_DIR/build/tmp/deploy/images/<MACHINE NAME>/ 

Note that the names of the images differ between releases. YOCTO_IMAGE in the instructions below refers to the Yocto image name that was used to build the image, and YOCTO_MACHINE refers to the machine that was selected to build the image. Refer to the "Built Images" section of the Quickstart pertaining to the specific release you are using for clarification on image names.

Configure SD Card for Flashing

The SD card image "<YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard" can be flashed to eMMC. This image will need to be copied to the boot partition of a properly formatted SD card as described in Create a Bootable SD Card

Due to the UUIDs of the partitions in the sdcard image, it is recommended that you manually format the SD card if you plan on using it after flashing the image to eMMC, otherwise if using the sdcard image for both eMMC and SD, mmcblk0p1 and mmcblk1p1 as well as mmcblk0p2 and mmcblk1p2 will have the same UUID.


  1. First, enter this command once before connecting your SD card to your host machine and again after it has been connected. Keep an eye out for the device that appears after connecting the SD Card and remember the name assigned to it (of the form 'sdX' where X is a letter b, c, d, or e).

    Host (Ubuntu)

    ls /dev/sd*
    CODE
  2. Due to the size of the image, a new partition is required on the SD card to hold it. To create an additional partition that extends to the rest of the SD card, execute the following from your host machine by replacing 'X' with correct letter that was assigned to the mounted device. fdisk is an interactive command line utility that will accept further commands: 

    Host (Ubuntu)

    sudo fdisk /dev/sdX
    CODE
    1. When prompted, enter the following sequence of characters one at a time. Do not enter the comments following the "#".

      fdisk Prompt

      p           #print partition table. *Note end of partition /dev/sd<x>2*   
      n           #new partition
      p           #primary
      3           #partition number
      <start>     #enter the value the sector after the end of partition 2 from partition table. This will be the first sector of partition 3. See note.
      <enter>     #Use default value for last sector
      t           #Change partition system id
      3           #Partition number
      c           #FAT32
      w           #write table to disk and exit
      CODE

      The following is an example of a partition table that could be displayed after entering 'p' in fdisk.

      For the <start> value in the above letter/command sequence, find the end of partition 2 and enter this value plus 1. For this example, the value 2007040 was entered to be the start of partition 3.

  3. Enter the following to name the new partition "data". Ensure that 'X' is replaced with the correct letter found in step 1.

    Host (Ubuntu)

    sudo mkfs.vfat -n "data" /dev/sdX3
    CODE
  4. Copy the sdcard image to the new "data" partition: 

    Host (Ubuntu)

    cp <YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard /media/user/data/; sync
    CODE

    If this command fails due to the "data" partition not existing, ensure that it wasn't named something else inadvertently. Check the mounted partitions by entering the following: 

    Host (Ubuntu)

    ls /media/user
    CODE

Option 1: Flash eMMC from Linux

 Click here to expand...
  1. Configure the boot switch to boot from SD Card as described in Boot Configurations. Power on the board and boot into Linux.
  2. Flash <YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard from the SD card to eMMC. This will partition the card and copy U-Boot, zImage, dtb, and root filesystem to eMMC.

    Umount existing partitions (if any) and write the image to flash. 

    Target (Linux)

    umount /run/media/mmcblk2p*
    dd if=/run/media/mmcblk0p3/<YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard of=/dev/mmcblk2 bs=1M; sync
    CODE

Option 2: Flash eMMC from U-Boot

 Click here to expand...

The default <YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard image is larger than the DDR3 so cannot be loaded into memory from U-Boot. Use Option 1 for flashing eMMC.

  1. Configure the boot switch to boot from SD Card as described in Boot Configurations. Power on the board and stop in U-Boot. This is done by entering any key during boot-up when prompted by the boot messages. 

  2. Flash <YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard from the SD card to eMMC. This will partition the card and copy U-Boot, zImage, dtb, and root filesystem to eMMC. 

    Only enter the lines beginning with '=>'. The following lines are expected outputs. 

    Target (U-Boot)

    => fatload mmc 0:3 ${loadaddr} <YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard
    reading <YOCTO_IMAGE>-<YOCTO MACHINE>.sdcard
    935329792 bytes read in 41164 ms (21.7 MiB/s)
     
    => mmc dev 1
    switch to partitions #0, OK
    mmc1(part 0) is current device
    
    => mmc write ${loadaddr} 0x0 <number of blocks to write. In this case 0x1BF000>
    MMC write: dev # 1, block # 0, count 1830912 ... 1830912 blocks written: OK
    CODE
  3. Reset the board. Stop in U-Boot again and check that the partition table for eMMC is as expected. 

    Target (U-Boot)

    => reset
     
    => mmc dev 1
    switch to partitions #0, OK
    mmc1(part 0) is current device
    
    => mmc part 
    Partition Map for MMC device 1  --   Partition Type: DOS
     
    Part    Start Sector    Num Sectors     UUID            Type
    1     8192            16384           ef3963c1-01     0c
    2     24576           1794048         ef3963c1-02     83
    CODE


Updating Individual Images

U-Boot

Flash U-Boot to eMMC. The i.MX7 expects an Image Vector Table offset of 0x400 bytes for SD/MMC boot device type. Type the following in U-Boot (alternatively, use dd command in Linux): 

Target (U-Boot)

=> fatload mmc 0:1 ${loadaddr} u-boot.imx
=> mmc dev 1
=> mmc write ${loadaddr} 0x2 <u-boot image size in blocks>
CODE


Linux/DTB

From Linux, copy the kernel and device tree file to eMMC: 

Target (Linux)

# The eMMC partitions will mount to /run/media/ on boot. If you just partitioned eMMC, you may manually mount the partition:
mkdir /run/media/mmcblk2p1
mount /dev/mmcblk2p1 /run/media/mmcblk2p1
  
cp /run/media/mmcblk0p1/zImage /run/media/mmcblk2p1/; sync
cp /run/media/mmcblk0p1/zImage-<YOCTO_MACHINE>.dtb /run/media/mmcblk2p1/oftree; sync
CODE

Root Filesystem

From Linux, flash the root filesystem to eMMC, partition 2. 

Target (Linux)

dd if=/run/media/mmcblk0p3/<YOCTO_IMAGE>-<YOCTO MACHINE>.ext4 of=/dev/mmcblk2p2 bs=1M
CODE

Boot Options in U-Boot

The target can be booted from on-board media. In our standard configuration, this BSP release loads the kernel and root filesystem from MMC if an SD card is inserted in the micro SD card slot. If no SD card is present, it will boot from eMMC.

Stand Alone SD/MMC Card Boot

This is the default boot configuration. Simply type the following: 

Target (U-Boot)

=> boot
CODE

Stand-Alone eMMC Boot

By default, the U-Boot environment is configured to autodetect which mmc interface U-boot was booted from (See Boot Configurations) and boot the kernel and root file system from the same device. However, if you would like to boot Linux from eMMC regardless of the boot source for U-Boot, then disable auto-detection and set the mmc boot device to mmc1 by modifying the environment as follows: 

Target (U-Boot)

=> setenv mmcautodetect no
=> setenv mmcdev 1
=> saveenv
CODE

Reset the board and let it boot fully into Linux, or use the "boot" command within U-boot: 

Target (U-Boot)

=> boot
CODE