VAR-SOM-MX6 DART eMMC flashing Jethro

From Variscite Wiki
Revision as of 17:46, 31 July 2016 by Eran (talk | contribs) (Created page with "{{PageHeader|VAR-SOM-MX6 - eMMC Flash Burning Dart}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__ = Introduction = Variscite DART-MX6 SOM uses eMMC to boot. {{n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 located at tmp/deploy/images/var-som-mx6.
Looking at tmp/deploy/images/var-som-mx6 you will find the following five required files for a complete system:
SPL, U-Boot, uImage, dtb file, file system image file.

Image Name
How to use
fsl-image-gui-var-som-mx6.tar.bz2 Tarball of the rootfs
uImage Linux kernel image
SPL-sd SPL for SD/eMMC
u-boot-sd-2015.04-r0.img U-Boot for SD/eMMC
Device Tree Name
SOM type
Carrier Board type
LCD Type
Evaluation Kit name
uImage-imx6q-var-dart.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-DT6CustomBoard Capacitive LVDS touch VAR-DVK-DT6
VAR-STK-DT6

eMMC Flashing scripts

If you followed the Create an extended SD card steps, the eMMC flashing scripts will be included in your SD card.
The eMMC flashing scripts are easy-to-use example scripts for burning images into eMMC.

eMMC images locations

Following is the directory structure on your SD card, which elaborates the files' location that the below flashing scripts are expecting:

/opt/images/
└── Yocto
    ├── SPL.mmc
    ├── rootfs.tar.bz2
    ├── u-boot.img.mmc
    ├── uImage
    └── uImage-imx6q-var-dart.dtb

Prepare images for NAND flash / eMMC flashing

Plug the bootable SD card into your host machine. Then your host machine should mount the rootfs partition on /media/rootfs.
Copy all the mentioned yocto-built binaries to the SD card:

$ export YOCTO_IMGS_PATH=~/var-som-mx6-yocto-jethro/tmp/deploy/images/var-som-mx6
$ export P2_MOUNT_DIR=/media/rootfs/

Linux:
$ sudo cp ${YOCTO_IMGS_PATH}/uImage			${P2_MOUNT_DIR}/opt/images/Yocto/

SPL/U-Boot:
$ sudo cp ${YOCTO_IMGS_PATH}/SPL-sd			${P2_MOUNT_DIR}/opt/images/Yocto/SPL.mmc
$ sudo cp ${YOCTO_IMGS_PATH}/u-boot-sd-2015.04-r0.img	${P2_MOUNT_DIR}/opt/images/Yocto/u-boot.img.mmc

File System:
$ sudo cp ${YOCTO_IMGS_PATH}/fsl-image-gui-var-som-mx6.tar.bz2	${P2_MOUNT_DIR}/opt/images/Yocto/rootfs.tar.bz2

Device Tree:
$ sudo cp ${YOCTO_IMGS_PATH}/uImage-imx6q-var-dart.dtb	${P2_MOUNT_DIR}/opt/images/Yocto/

eMMC flashing scripts

The flashing scripts are located on the SD card at /usr/bin/:

install_yocto.sh	- Flash Yocto into NAND flash or eMMC (Run and follow usage instructions to install Yocto to DART eMMC)
(install_yocto_emmc.sh	- This script is being called by install_yocto.sh - it should not be called directly!)

Manual step-by-step flashing to eMMC

Flashing eMMC requires several steps including flashing of U-Boot and the Linux kernel, partition, format and untar of the file system. We recommend to use our provided scripts to perform this task.

$ export node=/dev/mmcblk2
$ cd /opt/images/Yocto

Make sure the eMMC is not mounted:

$ umount ${node}p*

Delete current data on eMMC:

$ dd if=/dev/zero of=${node}p1 bs=1024 count=1024
$ dd if=/dev/zero of=${node}p2 bs=1024 count=1024
$ dd if=/dev/zero of=${node}p3 bs=1024 count=1024
$ dd if=/dev/zero of=${node}p4 bs=1024 count=1024
$ dd if=/dev/zero of=${node}p5 bs=1024 count=1024
$ dd if=/dev/zero of=${node}p6 bs=1024 count=1024
$ dd if=/dev/zero of=${node}p7 bs=1024 count=1024
$ sync
$ (echo d; echo 1; echo d; echo 2; echo d; echo 3; echo d; echo w) | fdisk $node
$ sync
$ dd if=/dev/zero of=$node bs=1M count=4
$ sync

Create partition table:

$ (echo n; echo p; echo 1; echo 8192; echo 24575; echo t; echo c; \
   echo n; echo p; echo 2; echo 24576; echo; \
   echo p; echo w) | fdisk -u $node
$ sync

Format the partitions:

$ mkfs.vfat ${node}p1 -n BOOT-VARSOM
$ mkfs.ext4 ${node}p2 -L rootfs
$ sync

Flash SPL and U-Boot

$ sudo dd if=SPL.mmc of=${node} bs=1K seek=1; sync
$ sudo dd if=u-boot.img.mmc of=${node} bs=1K seek=69; sync

Flash the Linux kernel to the BOOT partition

$ mkdir /run/media/mmcblk2p1
$ mount -t vfat ${node}p1	/run/media/mmcblk2p1
$ cp uImage-imx6q-var-dart.dtb	/run/media/mmcblk2p1/imx6q-var-dart.dtb
$ cp uImage			/run/media/mmcblk2p1/uImage
$ sync
$ umount /tmp/media/mmcblk2p1

Flash the rootfs:

$ mkdir /run/media/mmcblk2p1
$ mount ${node}p2 /run/media/mmcblk2p2
$ tar xvpf rootfs.tar.bz2 -C /run/media/mmcblk2p2
$ sync
$ umount /run/media/mmcblk2p2

Summary

This page is only valid for DART-MX6. We described the results of a Yocto build, how to copy it to a bootable SD card and how to flash it to eMMC.
With our extended SD card and our recovery SD card we provide an installation script located at /usr/bin/install_yocto.sh. It is much safer to use it instead of flashing the system manually.