This guide was tested using BSP version 18.1.1 with the imx7s-phyboard-zeta-002 build from Artifactory

The phyBOARD-i.MX7 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 NAND is empty
  • Upgrade to a new release
  • Use custom built images

Configure SD Card for Flashing

In addition to the standard SD card formatted in Creating a Bootable SD Card, the following steps are required to copy over images to the NAND Flash.

  1. In order to save working environments and boot kernel images from NAND by default, the u-boot.imx-nand image is needed. The default u-boot.imx image will utilize the SD card.

    1. Using your Host Machine, copy u-boot.imx-nand to the Boot partition of the SD card. 

      Host (Ubuntu)

      sudo cp u-boot.imx-nand /media/user/Boot\ imx7s-/; sync
       Building U-Boot to use NAND

      To build a u-boot.imx-nand image with Yocto, follow the same instructions for building the BSP described in the Quickstart, but set the UBOOT_CONFIG variable to nand in $YOCTO_DIR/build/conf/local.conf before starting the build:


      UBOOT_CONFIG = "nand"
  2. Use the following command to find which device name was assigned to your SD card. 

    Host (Ubuntu)

    1. In the output of the above command, look for the device name assigned to your SD card.

      Expected Output

      user@ubuntu:~/Downloads$ mount
      sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
      proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
      udev on /dev type devtmpfs (rw,nosuid,relatime,size=6170936k,nr_inodes=1542734,mode=755)
      devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
      tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1240220k,mode=755)
      /dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
      tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
      tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
      tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
      cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
      pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
      cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
      cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
      cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
      cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
      cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
      cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
      cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
      cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
      cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
      cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
      cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
      systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=24,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=19648)
      mqueue on /dev/mqueue type mqueue (rw,relatime)
      debugfs on /sys/kernel/debug type debugfs (rw,relatime)
      hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
      sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
      configfs on /sys/kernel/config type configfs (rw,relatime)
      fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
      vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
      tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1240220k,mode=700,uid=1000,gid=1000)
      gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
      //fileserver2.phytec/share on /mnt/share type cifs (rw,relatime,vers=1.0,cache=strict,username=tloan,domain=,uid=1000,forceuid,gid=0,noforcegid,addr=,soft,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,echo_interval=60,actimeo=1)
      /dev/sdc1 on /media/user/Boot imx7s- type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
      /dev/sdc2 on /media/user/2c194653-91ee-4336-ae3c-c390d89aac10 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
    2. In the output example above, we can see that on the last 2 lines that the boot folder and root file system were mounted from a device called sdc. (sdc1 and sdc2 pertain to the two partitions within the SD card).

  3. Use the following command to create a new partition on the SD card to hold the root filesystem ext4 image. Ensure that the character 'X' is replaced with the letter we found in the previous step. X is commonly going to b, c, d, or e.

    Host (Ubuntu)

    sudo fdisk /dev/sdX
  4. 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

    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.

  5. Enter the following to name the new partition "data". Ensure that 'X' is replaced with the correct letter found from before.. 

    Host (Ubuntu)

    sudo mkfs.vfat -n "data" /dev/sdX3
  6. Due to the size of NAND, the standard 'fsl-image-gui' and 'fsl-image-validation-imx' file systems will not fit and so a smaller file system will need to be used.

    1. Copy the smaller file system image to the new "data" partition.  This example uses the Yocto image "core-image-minimal", which is included in the BSP release images.

      Host (Ubuntu)

      sudo cp core-image-minimal-<MACHINE NAME>.tar.bz2 /media/<user>/data/; sync
    2. Safely remove the SD card from your Host Machine and insert it into the SD card slot on the i.MX7 development kit.

  7. Set the boot switches according to Boot Configurations such that you boot from SD card and then power on the board and login to Linux. 

  8. Erase mtd0 and use NXP's utility "kobs-ng" to flash the u-boot.imx-nand file to NAND:

    Target (Linux)

    flash_erase /dev/mtd0 0 0
    kobs-ng init -x /run/media/mmcblk0p1/u-boot.imx-nand
  9. Flash zImage and the device tree :

    Target (Linux)

    flash_erase /dev/mtd1 0 0
    nandwrite -p /dev/mtd1 /run/media/mmcblk0p1/zImage
    flash_erase /dev/mtd2 0 0
    nandwrite -p /dev/mtd2 /run/media/mmcblk0p1/<MACHINE NAME>.dtb
  10. Flash the file system:

    Target (Linux)

    flash_erase /dev/mtd3 0 0
    ubiformat /dev/mtd3; ubiattach /dev/ubi_ctrl -m 3; ubimkvol /dev/ubi0 -N rootfs -m
    mkdir /tmp/rootfs
    mount -t ubifs ubi0:rootfs /tmp/rootfs
    tar -xf /run/media/mmcblk0p3/core-image-minimal-<MACHINE NAME>.tar.bz2 -C /tmp/rootfs/; sync
  11. Power off the board and then set the boot switches according to Boot Configurations for booting from NAND.

  12. Power on the board and login to Linux.