VAR-SOM-MX6 DART eMMC flashing Jethro: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{PageHeader|VAR-SOM-MX6 - DART eMMC flashing}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__
{{PageHeader|VAR-SOM-MX6 - DART eMMC flashing}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__
= Introduction =
= Introduction =
Variscite DART-MX6 SOM uses eMMC to boot.  
The Variscite DART-MX6 SOM has an on-SOM eMMC which can be used to boot from and to hold the filesystem.
{{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 ==
= eMMC structure =
0-4 MiB &nbsp;&nbsp;&nbsp;&nbsp; : Non-partitioned space, saved for U-Boot.<br>
4-12 MiB &nbsp;&nbsp; : "BOOT-VARSOM" - A FAT16 partition containing the Linux image and the device tree blob/s.<br>
12 MiB-End: "rootfs" - An ext4 partition containing the root file system (including the kernel modules).<br>
 
= Yocto Build results =
The resulted images are located at tmp/deploy/images/var-som-mx6.<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/>
Looking at tmp/deploy/images/var-som-mx6 you will find the following five required files for a complete system:<br/>
Line 40: Line 45:
|}
|}


== eMMC Flashing scripts==
= Installing the Yocto binaries =
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>
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 images locations|Yocto binaries]] and 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>
The eMMC flashing scripts are easy-to-use example scripts for flashing images into eMMC.<br>
There is also a section below describing how to [[#Manual step-by-step flashing to eMMC|flash the images manually]].


=== eMMC images locations ===
=== eMMC images locations ===
Line 56: Line 62:
</pre>
</pre>


== Prepare images for NAND flash / eMMC flashing ==
==== Prepare the images for eMMC flashing ====
Plug the bootable SD card into your host machine.
Plug the bootable SD card into your host machine and mount the rootfs partition - here we assume it is mounted on /media/rootfs.<br>
Then your host machine should mount the rootfs partition on /media/rootfs.<br>
Copy all the mentioned yocto-built binaries to the SD card:
Copy all the mentioned yocto-built binaries to the SD card:
<br>
<br>
Line 89: Line 94:


== Manual step-by-step flashing to eMMC ==
== 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.
Flashing the eMMC requires several steps including flashing of U-Boot and the Linux kernel, partitioning, file system formatting and image extraction.<br>
We recommend to use our provided scripts to perform this task.<br>
We recommend to use our provided scripts to perform this task.<br>
<br>
<br>
Use the prepared SD card to boot the board and run the following:
<br><br>
<pre>
<pre>
$ export node=/dev/mmcblk2
$ export node=/dev/mmcblk2
Line 118: Line 125:
</pre>
</pre>


Create partition table:
Create a partition table:
<pre>
<pre>
$ (echo n; echo p; echo 1; echo 8192; echo 24575; echo t; echo c; \
$ (echo n; echo p; echo 1; echo 8192; echo 24575; echo t; echo c; \
Line 133: Line 140:
</pre>
</pre>


Flash SPL and U-Boot
Flash SPL and U-Boot:
<pre>
<pre>
$ sudo dd if=SPL.mmc of=${node} bs=1K seek=1; sync
$ sudo dd if=SPL.mmc of=${node} bs=1K seek=1; sync
Line 139: Line 146:
</pre>
</pre>


Flash the Linux kernel to the BOOT partition
Copy the Linux kernel image and the device tree blob to the BOOT partition:
<pre>
<pre>
$ mkdir /run/media/mmcblk2p1
$ mkdir /run/media/mmcblk2p1
Line 146: Line 153:
$ cp uImage /run/media/mmcblk2p1/uImage
$ cp uImage /run/media/mmcblk2p1/uImage
$ sync
$ sync
$ umount /tmp/media/mmcblk2p1
$ umount /run/media/mmcblk2p1
</pre>
</pre>


Flash the rootfs:
Extract the rootfs archive:
<pre>
<pre>
$ mkdir /run/media/mmcblk2p1
$ mkdir /run/media/mmcblk2p2
$ mount ${node}p2 /run/media/mmcblk2p2
$ mount ${node}p2 /run/media/mmcblk2p2
$ tar xvpf rootfs.tar.bz2 -C /run/media/mmcblk2p2
$ tar xvpf rootfs.tar.bz2 -C /run/media/mmcblk2p2

Latest revision as of 13:47, 1 September 2016

VAR-SOM-MX6 - DART eMMC flashing

Introduction

The Variscite DART-MX6 SOM has an on-SOM eMMC which can be used to boot from and to hold the filesystem.

NOTE:
This Wiki is only valid for DART-MX6

eMMC structure

0-4 MiB      : Non-partitioned space, saved for U-Boot.
4-12 MiB    : "BOOT-VARSOM" - A FAT16 partition containing the Linux image and the device tree blob/s.
12 MiB-End: "rootfs" - An ext4 partition containing the root file system (including the kernel modules).

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

Installing the Yocto binaries

If you followed the Create an extended SD card steps, the Yocto binaries and the eMMC flashing scripts will be included in your SD card.
The eMMC flashing scripts are easy-to-use example scripts for flashing images into eMMC.
There is also a section below describing how to flash the images manually.

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 the images for eMMC flashing

Plug the bootable SD card into your host machine and mount the rootfs partition - here we assume it is mounted 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 the eMMC requires several steps including flashing of U-Boot and the Linux kernel, partitioning, file system formatting and image extraction.
We recommend to use our provided scripts to perform this task.

Use the prepared SD card to boot the board and run the following:

$ 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 a 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

Copy the Linux kernel image and the device tree blob 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 /run/media/mmcblk2p1

Extract the rootfs archive:

$ mkdir /run/media/mmcblk2p2
$ 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.