VAR-SOM-MX6 NAND Flash Burning Dart: Difference between revisions

From Variscite Wiki
(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...")
 
No edit summary
Line 2: Line 2:
= Introduction =
= Introduction =
Variscite DART-MX6 SOM uses eMMC to boot.  
Variscite DART-MX6 SOM uses eMMC to boot.  
{{note| NOTE:<br>This WIKI is only valid for DART-MX6.|info}}
{{note| NOTE:<br>This Wiki is only valid for DART-MX6.|info}}


== Yocto Build results ==
== Yocto Build results ==
The resulted images are locaated in tmp/deploy/images/var-som-mx6.<br/>Looking at tmp/deploy/images/var-som-mx6 you will find 6 main files that are linked to the actual file<br/>
The resulted images are located at tmp/deploy/images/var-som-mx6.<br>
Looking at tmp/deploy/images/var-som-mx6 you will find the following five required files for a complete system:<br/>
SPL, U-Boot, uImage, dtb file, file system image file.<br>


{| class="wikitable"
{| class="wikitable"
Line 12: Line 14:
! scope="col" | How to use<br/>
! scope="col" | How to use<br/>
|-
|-
| fsl-image-qt5-minimal-var-som-mx6.ext3<br/>
| style="padding: 5px;"| fsl-image-gui-var-som-mx6.tar.bz2
| Not in Use<br/>
| style="padding: 5px;"| Tarball of the rootfs
|-
|-
| fsl-image-qt5-minimal-var-som-mx6.sdcard
| style="padding: 5px;"| uImage
| 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.
| style="padding: 5px;"| Linux kernel image
|-
|-
| fsl-image-qt5-minimal-var-som-mx6.tar.bz2
| style="padding: 5px;"| SPL-sd
| Used to create an NFS root file system on the host. See apendix for setting an NFS server
| style="padding: 5px;"| SPL for SD/eMMC
|-
|-
| fsl-image-qt5-minimal-var-som-mx6.ubi
| style="padding: 5px;"| u-boot-sd-2015.04-r0.img
| Use the sdcard created above. Copy the file into it and use the following commands to flash them into nand.<br/>Coping files (mount the sd-card created above first):
| style="padding: 5px;"| U-Boot for SD/eMMC
|-
| 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
|-
|-
! scope="col" | Device Tree Name<br/>
! scope="col" | Device Tree Name<br/>
Line 39: Line 32:
! scope="col" | Evaluation Kit name<br/>
! scope="col" | Evaluation Kit name<br/>
|-
|-
| uImage-imx6q-var-som.dtb
| style="padding: 5px;"| uImage-imx6q-var-dart.dtb
| VAR-SOM-MX6_V2 (Quad / Dual)
| style="padding: 5px;"| VAR-SOM-SOLO / VAR-SOM-DUAL
| VAR-MX6CustomBoard
| style="padding: 5px;"| VAR-DT6CustomBoard
| Capacitive/Resistive touch
| style="padding: 5px;"| Capacitive LVDS touch
| VAR-DVK-MX6_V2-PRO<br/>VAR-STK-MX6_V2
| style="padding: 5px;"| VAR-DVK-DT6<br>VAR-STK-DT6
|-
| 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.
== eMMC Flashing scripts==
The NAND recovery utlity contains Android and Yocto.
If you followed the [[VAR-SOM-MX6 Yocto Jethro R4 Build Yocto release#Create_an_extended_SD_card |Create an extended SD card]] steps, the [[#eMMC flashing scripts |eMMC flashing scripts]] will be included in your SD card. <br>
The [[#eMMC flashing scripts |eMMC flashing scripts]] are easy-to-use example scripts for burning images into eMMC.<br>
 
=== eMMC images locations ===
Following is the directory structure on your SD card, which elaborates the files' location that the below flashing scripts are expecting:
<pre>
<pre>
/media/rootfs/opt/images/
/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
└── Yocto
    ├── SPL.mmc
     ├── rootfs.tar.bz2
     ├── rootfs.tar.bz2
    ├── rootfs.ubi.img
    ├── SPL
    ├── SPL.mmc
    ├── u-boot.img
     ├── u-boot.img.mmc
     ├── u-boot.img.mmc
     ├── uImage
     ├── uImage
     ├── uImage-imx6dl-var-som.dtb
     └── uImage-imx6q-var-dart.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
</pre>
</pre>
== 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.<br>
Copy all the mentioned yocto-built binaries to the SD card:
<br>
* <span style="color:red">Note:</span> If you followed the [[VAR-SOM-MX6 Yocto Jethro R4 Build Yocto release#Create an extended SD card |Create an extended SD card]] steps, the [[#eMMC flashing scripts|eMMC flashing scripts]] and all relevant binaries are already included in your SD card, and the below commands are redundant!<br>


<pre>
<pre>
Script files located on /media/rootfs/sbin/
$ export YOCTO_IMGS_PATH=~/var-som-mx6-yocto-jethro/tmp/deploy/images/var-som-mx6
android-emmc.sh
$ export P2_MOUNT_DIR=/media/rootfs/
mkmmc_yocto.sh   
 
yocto-dart.sh 
Linux:
yocto-nand.sh
$ sudo cp ${YOCTO_IMGS_PATH}/uImage ${P2_MOUNT_DIR}/opt/images/Yocto/
mkmmc_android.sh
nand-recovery.sh
yocto-emmc.sh
</pre>


== Copy Yocto files into SDCARD ==
SPL/U-Boot:
Plug the NAND recovery SDCARD into your host machine.
$ sudo cp ${YOCTO_IMGS_PATH}/SPL-sd ${P2_MOUNT_DIR}/opt/images/Yocto/SPL.mmc
Then your host machine should mount the rootfs partition on /media/rootfs.
$ sudo cp ${YOCTO_IMGS_PATH}/u-boot-sd-2015.04-r0.img ${P2_MOUNT_DIR}/opt/images/Yocto/u-boot.img.mmc
<pre>
$ 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
File System:
$ 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_IMGS_PATH}/fsl-image-gui-var-som-mx6.tar.bz2 ${P2_MOUNT_DIR}/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/
Device Tree:
$ 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_IMGS_PATH}/uImage-imx6q-var-dart.dtb ${P2_MOUNT_DIR}/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/
</pre>
</pre>


== Flash File System to eMMC ==
== eMMC flashing scripts ==
Flashing eMMC is a complex task. It requires several steps including partition, format and untar the file system.
The flashing scripts are located on the SD card at /usr/bin/:
We highly recommend to use our provided scripts to perform this task.
<pre>
Assuming that you use our NAND recovery utility.
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!)
</pre>


Make sure the eMMC is not mounted.
== 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.<br>
<br>
<pre>
<pre>
$ export node=/dev/mmcblk2
$ cd /opt/images/Yocto
$ cd /opt/images/Yocto
$ umount /dev/mmcblk1p*
$ node=/dev/mmcblk2
</pre>
</pre>


Delete all partition from the eMMC.
Make sure the eMMC is not mounted:
<pre>
<pre>
$ fdisk ${node} <<EOF
$ umount ${node}p*
d
1
d
2
d
3
d
w
EOF
 
$ sync
</pre>
</pre>


Delete MBR
Delete current data on eMMC:
<pre>
<pre>
$ dd if=/dev/zero of=${node} bs=512 count=1000
$ 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
$ sync
</pre>
</pre>


Call fdisk to create partition table
Create partition table:
<pre>
<pre>
$ fdisk /dev/mmcblk2 <<EOF
$ (echo n; echo p; echo 1; echo 8192; echo 24575; echo t; echo c; \
n
  echo n; echo p; echo 2; echo 24576; echo; \
p
  echo p; echo w) | fdisk -u $node
1
$ sync
8192
24575
t
c
n
p
2
24576
 
p
w
EOF
 
</pre>
</pre>


Format eMMC
Format the partitions:
<pre>
<pre>
$ umount /run/media/mmcblk2p1 2>/dev/null
$ mkfs.vfat ${node}p1 -n BOOT-VARSOM
$ umount /run/media/mmcblk2p2 2>/dev/null
$ mkfs.ext4 ${node}p2 -L rootfs
$ mkfs.vfat /dev/mmcblk2p1 -nBOT_varsomi
$ mkfs.ext4 /dev/mmcblk2p2 -Lrootfs
$ sync
$ sync
</pre>
</pre>


 
Flash SPL and U-Boot
Flash u-boot
<pre>
<pre>
$ cd /opt/images/Yocto
$ sudo dd if=SPL.mmc of=${node} bs=1K seek=1; sync
$ sudo dd if=u-boot.img.mmc of=/dev/mmcblk2 bs=1K seek=69; sync
$ sudo dd if=u-boot.img.mmc of=${node} bs=1K seek=69; sync
$ sudo dd if=SPL.mmc of=/dev/mmcblk2 bs=1K seek=1; sync
</pre>
</pre>
Flash Yocto BOOT partition
 
Flash the Linux kernel to the BOOT partition
<pre>
<pre>
$ mkdir -p /tmp/media/mmcblk2p1
$ mkdir /run/media/mmcblk2p1
$ mount -t vfat /dev/mmcblk2p1  /tmp/media/mmcblk2p1
$ mount -t vfat ${node}p1 /run/media/mmcblk2p1
$ cp uImage-imx6q-var-dart.dtb /tmp/media/mmcblk2p1/imx6q-var-dart.dtb
$ cp uImage-imx6q-var-dart.dtb /run/media/mmcblk2p1/imx6q-var-dart.dtb
$ cp uImage /tmp/media/mmcblk2p1/uImage
$ cp uImage /run/media/mmcblk2p1/uImage
$ sync
$ umount /tmp/media/mmcblk2p1
$ umount /tmp/media/mmcblk2p1
</pre>
</pre>


Flashing Yocto Root file System
Flash the rootfs:
<pre>
<pre>
$ mount /dev/mmcblk2p2  /tmp/media/mmcblk2p2
$ mkdir /run/media/mmcblk2p1
$ mkdir -p /tmp/media/mmcblk2p2
$ mount ${node}p2 /run/media/mmcblk2p2
$ rm -rf /tmp/media/mmcblk2p2/*
$ tar xvpf rootfs.tar.bz2 -C /run/media/mmcblk2p2
$ tar xvpf rootfs.tar.bz2 -C /tmp/media/mmcblk2p2/
$ sync
$ umount /tmp/media/mmcblk2p2
$ umount /run/media/mmcblk2p2
</pre>
</pre>


= Summary =
= 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.
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.<br>
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.
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.<br>
<br/>/media/rootfs/sbin/:
<br/>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. <br/>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)

Revision as of 17:41, 31 July 2016

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.