Skip to end of metadata
Go to start of metadata

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 that will be flashed. Execute from the host PC:

  1. Copy u-boot.imx-nand to the Boot partition of the SD card. In order to be able to save the environment to NAND and boot kernel images from NAND by default, the u-boot.imx-nand image is needed. The default u-boot.imx image will default to SD card. Both images are available in the release binaries. 

    cp u-boot.imx-nand /media/<user>/Boot\ imx7/; sync

    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. Create a new partition on the SD card to hold the root filesystem ext4 image.

    sudo fdisk /dev/sd<X>
    
            p           print current partitions (note end of partition 2, 1826815 for NXP 1.2.0 release)
            n           newpartition
            p           primary
            3           partition number
            1826816     (start after end of partition 2) first sector
            <enter>       Use defaultvalue forlast sector
            t           Change partition systemid
            3           Partition number
            c           FAT32
            w           write table to disk and exit
    
    sudo mkfs.vfat -n "data"/dev/sd<X>3
  3. Copy the filesystem image to the new "data" partition. Due to the size of NAND, the standard 'fsl-image-gui' and 'fsl-image-validation-imx' filesystems do not fit on NAND, so a smaller filesystem will need to be used. This example uses the Yocto image "core-image-minimal", which is included in the BSP release images.

    cp core-image-minimal-<MACHINE NAME>.tar.bz2 /media/<user>/data/; sync
  4. Set the boot switches, according to Boot Configurations, to boot from SD card and power on the board into Linux.
  5. Erase mtd0 and use NXP's utility "kobs-ng" to flash u-boot.imx-nand to NAND:

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

    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
  7. Flash filesystem:

    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
  8. Power off the board, set boot switches according to Boot Configurations, and power back on.