DART-6UL NAND Flash Burning
Introduction
The Variscite DART-6UL use the on-SOM NAND-Flash or eMMC-Flash to boot.
The file system can reside either on the NAND-Flash or the eMMC.
When file system resides on NAND, UBIFS file system will be used.
When file system resides on eMMC, EXT3 file system will be used.
This WIKI is only valid for DART-6UL.
NAND Structure
When system boots, kernel logs will present 5 relevant partitions defined.
0x000000000000-0x000000200000 : "spl" 0x000000200000-0x000000400000 : "uboot" 0x000000400000-0x000000600000 : "uboot-env" 0x000000600000-0x000000e00000 : "kernel" 0x000000e00000-0x000040000000 : "rootfs"
Yocto Built binaries for NAND-Flash
The resulted images are located in tmp/deploy/images/imx6ul-var-dart/.
Looking at tmp/deploy/images/imx6ul-var-dart/ you will find 6 main files that are linked to the actual file
Image Name |
How to use |
---|---|
fsl-image-gui-imx6ul-var-dart.ext3 |
Not in Use |
fsl-image-gui-imx6ul-var-dart.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-gui-imx6ul-var-dart.tar.bz2 | Used to create an NFS root file system on the host. See apendix for setting an NFS server |
fsl-image-gui-imx6ul-var-dart.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): |
zImage | Linux kernel image |
u-boot-nand-2015.04-r0.imx | u-boot built for nand |
u-boot-sd-2015.04-r0.imx | u-boot built for sdcard/eMMC |
Device Tree Name |
Boot Device |
zImage-imx6ul-var-dart-emmc_wifi.dtb | Boot from internal eMMC with WI-FI enabled. (SDCARD & NAND disabled) |
zImage-imx6ul-var-dart-nand_wifi.dtb | Boot from internal NAND with WI-FI enabled. (SDCARD & eMMC disabled) |
zImage-imx6ul-var-dart-sd_emmc.dtb | SDCARD and eMMC enabled (WIFI & NAND disabled). You can boot from eMMC or SDCARD |
zImage-imx6ul-var-dart-sd_nand.dtb | SDCARD and NAND enabled (WIFI & eMMC disabled). You can boot from NAND or SDCARD |
NAND Flashing scripts
If you followed Create an extended SD-Card the NAND flashing scripts will be included in your SD-Card.
The NAND flashing scripts are easy-to-use example scripts for burning images into NAND Flash
NAND-Flash images locations
The below directory stucture on your SD-Card, elaborates the files' location which the below burning scripts are expecting
/media/rootfs/opt/images/ └── Yocto ├── rootfs.sdcard ├── rootfs.tar.bz2 ├── rootfs.ubi.img ├── SPL-nand ├── SPL-sd ├── u-boot-nand-2015.04-r0.img ├── u-boot-sd-2015.04-r0.img ├── zImage ├── zImage-imx6ul-var-dart-emmc_wifi.dtb ├── zImage-imx6ul-var-dart-nand_wifi.dtb ├── zImage-imx6ul-var-dart-sd_emmc.dtb └── zImage-imx6ul-var-dart-sd_nand.dtb
Script files located on /media/rootfs/sbin/ yocto-nand.sh nand-recovery.sh yocto-emmc.sh
Prepare images for NAND-Flash / eMMC burning
Plug the bootable SDCARD into your host machine.
Then your host machine should mount the rootfs partition on /media/rootfs.
Copy all yocto-built binaries into SD-Card:
- Note: If you followed Create an extended SD-Card the NAND flashing scripts and all relevant binaries are already included in your SD-Card! and below commands are redundant
$ export YOCTO_ROOT=~/var-dart-6ul-yocto-fido Linux: $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/zImage /media/rootfs/opt/images/Yocto U-boot: sudo cp tmp/deploy/images/imx6ul-var-dart/SPL-nand /tmp/rootfs/opt/images/Yocto/ sudo cp tmp/deploy/images/imx6ul-var-dart/SPL-sd /tmp/rootfs/opt/images/Yocto/ sudo cp tmp/deploy/images/imx6ul-var-dart/u-boot-nand-2015.04-r0.img /tmp/rootfs/opt/images/Yocto/ sudo cp tmp/deploy/images/imx6ul-var-dart/u-boot-sd-2015.04-r0.img /tmp/rootfs/opt/images/Yocto/ File System: $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.tar.bz2 /media/rootfs/opt/images/Yocto/rootfs.tar.bz2 $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.ubi /media/rootfs/opt/images/Yocto/rootfs.ubi.img Device Tree: $ sudo cp ${YOCTO_ROOT}/build_x11tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-emmc_wifi.dtb /media/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-nand_wifi.dtb /media/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-sd_emmc.dtb /media/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-sd_nand.dtb /media/rootfs/opt/images/Yocto/
NAND-Flash Flashing scripts
The flashing scripts are located at /media/rootfs/sbin/
$ android-emmc.sh - flash Android into eMMC $ yocto-emmc.sh - flash Yocto into eMMC (See note below) $ yocto-dart.sh - flash Yocto into eMMC DART only. $ yocto-nand.sh - flash Yocto into nand
- in case of yocto-emmc.sh, change boot arguments to :
$ setenv bootargs console=ttymxc0,115200 video=mxcfb1:off root=/dev/mmcblk1p1 rootwait rw $ saveenv
Manual step-by-step flashing to NAND
Flash U-BOOT
Flashing U-BOOT reguire to flash 2 parts: SPL and u-boot.img. Assume you copy SPL-nand and u-boot-nand-2014.04-r0.img to the right directory as showed above.
$ cd /opt/images/Yocto $ flash_erase /dev/mtd0 0 0 $ kobs-ng init -x SPL --search_exponent=1 -v $ flash_erase /dev/mtd1 0 0 $ nandwrite -p /dev/mtd1 u-boot.img
Flash Linux Kernel
Flashing Linux kernel reguire to flash 2 parts: uImage and device tree. Assume you copy uImage and device tree to the right directory as showed above. You also need to pick and coose the right DTB file. See table above for a complete description.
$ cd /opt/images/Yocto $ flash_erase /dev/mtd2 0 0 $ nandwrite -p /dev/mtd2 uImage $ nandwrite -p /dev/mtd1 -s 0x1e0000 uImage-imx6q-var-som.dtb (Example, select the right one!)
Flash UBIFS
The parameters for the UBIFS UBI_SUB_PAGE_SIZE=2048 and UBI_VID_HDR_OFFSET=2048.
$ cd /opt/images/Yocto $ flash_erase /dev/mtd3 0 0 $ ubiformat /dev/mtd3 -f rootfs.ubi.img -s 2048 -O 2048
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/mmcblk1
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 sfdisk to create partition table
$ node=/dev/mmcblk1 $ seprate=40 $ total_size=`sfdisk -s ${node}` $ total_size=`expr ${total_size} / 1024` $ sfdisk --force -uM ${node} << EOF ,${total_size},83 EOF
Format Linux
$ mkfs.ext4 ${node} -Lrootfs
Flash Linux
$ mkdir /run/media/mmcblk1p1 $ mount ${node} /run/media/mmcblk1p1 $ tar xvpf rootfs.tar.bz2 -C /run/media/mmcblk1p1/
in case of Yocto eMMC file system stop at u-boot and change boot arguments to :
$ setenv bootargs console=ttymxc0,115200 video=mxcfb1:off root=/dev/mmcblk1p1 rootwait rw $ saveenv
Summary
We describe the results of Yocto build, how to copy it to SDCARD and how to flash it to NAND and eMMC.
This page is not valid for DART-MX6. Please follow the link to the relevant page.
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)