VAR-SOM-MX6 NAND Flash Burning Dart

From Variscite Wiki
VAR-SOM-MX6 - eMMC Flash Burning Dart

Introduction

Variscite DART-MX6 SOM uses eMMC to boot.

NOTE:
This WIKI is only valid for DART-MX6.

Yocto Build results

The resulted images are locaated in tmp/deploy/images/var-som-mx6.
Looking at tmp/deploy/images/var-som-mx6 you will find 6 main files that are linked to the actual file

Image Name
How to use
fsl-image-qt5-minimal-var-som-mx6.ext3
Not in Use
fsl-image-qt5-minimal-var-som-mx6.sdcard This image is for SD-Card boot. Default u-boot is built for SDCARD. Booting from SD-Card is explained in details below. See section 8.1 below for the sdcard structure.
fsl-image-qt5-minimal-var-som-mx6.tar.bz2 Used to create an NFS root file system on the host. See apendix for setting an NFS server
fsl-image-qt5-minimal-var-som-mx6.ubi Use the sdcard created above. Copy the file into it and use the following commands to flash them into nand.
Coping files (mount the sd-card created above first):
uImage Linux kernel image
SPL-nand,u-boot-nand-2014.04-r0.img SPl and u-boot built for nand
SPL-sd,u-boot-sd-2014.04-r0.img SPl and u-boot built for sdcard/eMMC
Device Tree Name
SOM type
Carrier Board type
LCD Type
Evaluation Kit name
uImage-imx6q-var-som.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Capacitive/Resistive touch VAR-DVK-MX6_V2-PRO
VAR-STK-MX6_V2
uImage-imx6q-var-som-vsc.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
uImage-imx6dl-var-som.dtb VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Capacitive/Resistive touch N/A
uImage-imx6dl-var-som-solo-vsc.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-SOLOCustomBoard Capacitive LVDS touch VAR-DVK-SOLO/DUAL VAR-STK-SOLO/DUAL
uImage-imx6dl-var-som-solo.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Capacitive/Resistive touch N/A
uImage-imx6q-var-dart.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-DT6CustomBoard Capacitive LVDS touch VAR-STK-DT6.VAR-DVK-DT6

NAND recovery file tree

We copy the image files into the NAND recovery utility. We also change the names of the products above. The NAND recovery utlity contains Android and Yocto.

/media/rootfs/opt/images/
├── Android
│   └── Emmc
│       ├── boot.img
│       ├── boot-imx6q-var-dart.img
│       ├── boot-som-mx6dl-c.img
│       ├── boot-som-mx6dl-r.img
│       ├── boot-som-mx6q-c.img
│       ├── boot-som-mx6q-r.img
│       ├── boot-som-mx6q-vsc.img
│       ├── boot-som-solo-c.img
│       ├── boot-som-solo-r.img
│       ├── boot-som-solo-vsc.img
│       ├── recovery.img
│       ├── recovery-imx6q-var-dart.img
│       ├── recovery-som-mx6dl-c.img
│       ├── recovery-som-mx6dl-r.img
│       ├── recovery-som-mx6q-c.img
│       ├── recovery-som-mx6q-r.img
│       ├── recovery-som-mx6q-vsc.img
│       ├── recovery-som-solo-c.img
│       ├── recovery-som-solo-r.img
│       ├── recovery-som-solo-vsc.img
│       ├── SPL
│       ├── SPL.mmc
│       ├── SPL.new
│       ├── system.img
│       ├── u-boot-var-imx6-nand.img
│       └── u-boot-var-imx6-sd.img
└── Yocto
    ├── rootfs.tar.bz2
    ├── rootfs.ubi.img
    ├── SPL
    ├── SPL.mmc
    ├── u-boot.img
    ├── u-boot.img.mmc
    ├── uImage
    ├── uImage-imx6dl-var-som.dtb
    ├── uImage-imx6dl-var-som-solo.dtb
    ├── uImage-imx6dl-var-som-solo-vsc.dtb
    ├── uImage-imx6q-var-dart.dtb
    ├── uImage-imx6q-var-som.dtb
    └── uImage-imx6q-var-som-vsc.dtb
Script files located on /media/rootfs/sbin/
android-emmc.sh
mkmmc_yocto.sh    
yocto-dart.sh  
yocto-nand.sh
mkmmc_android.sh
nand-recovery.sh
yocto-emmc.sh

Copy Yocto files into SDCARD

Plug the NAND recovery SDCARD into your host machine. Then your host machine should mount the rootfs partition on /media/rootfs.

$ export YOCTO_ROOT=~/var-som-mx6-yocto-fido

$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage /media/rootfs/opt/images/Yocto
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/fsl-image-qt5-var-som-mx6.tar.bz2 /media/rootfs/opt/images/Yocto/rootfs.tar.bz2
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/fsl-image-qt5-minimal-var-som-mx6.ubi /media/rootfs/opt/images/Yocto/rootfs.ubi.img

$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage-imx6dl-var-som-solo.dtb /media/rootfs/opt/images/Yocto/
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage-imx6dl-var-som-solo-vsc.dtb /media/rootfs/opt/images/Yocto/
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage-imx6dl-var-som.dtb /media/rootfs/opt/images/Yocto/
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage-imx6q-var-som.dtb /media/rootfs/opt/images/Yocto/
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage-imx6q-var-som-vsc.dtb /media/rootfs/opt/images/Yocto/
$ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/var-som-mx6/uImage-imx6q-var-dart.dtb /media/rootfs/opt/images/Yocto/

Flash File System to eMMC

Flashing eMMC is a complex task. It requires several steps including partition, format and untar the file system. We highly recommend to use our provided scripts to perform this task. Assuming that you use our NAND recovery utility.

Make sure the eMMC is not mounted.

$ cd /opt/images/Yocto
$ umount /dev/mmcblk1p*
$ node=/dev/mmcblk2 

Delete all partition from the eMMC.

$ fdisk ${node} <<EOF
d
1
d
2
d
3
d
w
EOF

$ sync 

Delete MBR

$ dd if=/dev/zero of=${node} bs=512 count=1000
$ sync

Call fdisk to create partition table

$ fdisk /dev/mmcblk2 <<EOF 
n
p
1
8192
24575
t
c
n
p
2
24576

p
w
EOF

Format eMMC

$ umount /run/media/mmcblk2p1 2>/dev/null
$ umount /run/media/mmcblk2p2 2>/dev/null
$ mkfs.vfat /dev/mmcblk2p1 -nBOT_varsomi
$ mkfs.ext4 /dev/mmcblk2p2 -Lrootfs
$ sync


Flash u-boot

$ cd /opt/images/Yocto
$ sudo dd if=u-boot.img.mmc of=/dev/mmcblk2 bs=1K seek=69; sync
$ sudo dd if=SPL.mmc of=/dev/mmcblk2 bs=1K seek=1; sync

Flash Yocto BOOT partition

$ mkdir -p /tmp/media/mmcblk2p1
$ mount -t vfat /dev/mmcblk2p1  /tmp/media/mmcblk2p1
$ cp uImage-imx6q-var-dart.dtb /tmp/media/mmcblk2p1/imx6q-var-dart.dtb
$ cp uImage /tmp/media/mmcblk2p1/uImage
$ umount /tmp/media/mmcblk2p1

Flashing Yocto Root file System

$ mount /dev/mmcblk2p2  /tmp/media/mmcblk2p2
$ mkdir -p /tmp/media/mmcblk2p2
$ rm -rf /tmp/media/mmcblk2p2/*
$ tar xvpf rootfs.tar.bz2 -C /tmp/media/mmcblk2p2/
$ umount /tmp/media/mmcblk2p2

Summary

We describe the results of Yocto build, how to copy it to SDCARD and how to flash it to eMMC. This page is only valid for DART-MX6. With the NAND recovery utility we provide a set of scripts located on /sbin and listed below. It is much safer to use them instead of the manual operation.
/media/rootfs/sbin/:
android-emmc.sh mkmmc_yocto.sh yocto-dart.sh yocto-nand.sh mkmmc_android.sh nand-recovery.sh yocto-emmc.sh. Some of the scripts are used by the others.
Please use:

  • android-emmc.sh to flash Android int eMMC
  • yocto-dart.sh To flash Yocto into eMMC on DART-MX6
  • yocto-nand.sh To flash Yocto into NAND (not relevant on DART-MX6)
  • yocto-emmc.sh To flash Yocto into eMMC (not relevant on DART-MX6)