DART-6UL NAND Flash Burning: Difference between revisions
Line 65: | Line 65: | ||
== NAND Flashing scripts== | == NAND Flashing scripts== | ||
If you followed [[DART-6UL Yocto Fido R1 Build Yocto release#Create | If you followed [[DART-6UL Yocto Fido R1 Build Yocto release#Create an extended SD-Card |Create an extended SD-Card]] the [[DART-6UL NAND_Flash_Burning#NAND-Flash_Flashing_scripts|NAND flashing scripts]] will be included in your SD-Card. <br> | ||
The [[DART-6UL NAND_Flash_Burning#NAND-Flash_Flashing_scripts |NAND flashing scripts]] are easy-to-use example scripts for burning images into NAND Flash<br> | The [[DART-6UL NAND_Flash_Burning#NAND-Flash_Flashing_scripts |NAND flashing scripts]] are easy-to-use example scripts for burning images into NAND Flash<br> | ||
Revision as of 13:30, 3 January 2016
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 ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/SPL-nand /tmp/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/SPL-sd /tmp/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/u-boot-nand-2015.04-r0.img /tmp/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11/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_x11/tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-emmc_wifi.dtb /media/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-nand_wifi.dtb /media/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/deploy/images/imx6ul-var-dart/zImage-imx6ul-var-dart-sd_emmc.dtb /media/rootfs/opt/images/Yocto/ $ sudo cp ${YOCTO_ROOT}/build_x11/tmp/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/
$ yocto-emmc.sh - flash Yocto into eMMC $ yocto-nand.sh - flash Yocto into nand
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-nand --search_exponent=1 -v $ flash_erase /dev/mtd1 0 0 $ nandwrite -p /dev/mtd1 u-boot-nand-2015.04-r0.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/mtd3 0 0 $ nandwrite -p /dev/mtd3 zImage $ nandwrite -p /dev/mtd3 -s 0x7e0000 zImage-imx6ul-var-dart-nand_wifi.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/mtd4 0 0 $ ubiformat /dev/mtd4 -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 /dev/mmcblk1 1>/dev/null <<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/mmcblk1 <<EOF n p 1 8192 24575 t c n p 2 24576 p w EOF
Format Linux
$ mkfs.vfat /dev/mmcblk1p1 -nBOT_DART6UL $ mkfs.ext4 /dev/mmcblk1p2 -Lrootfs
Flash the file system and copy the relevant files to tjhe boot partition.
$ mount | grep mmcblk1 u-boot: $ sudo dd if=SPL-sd of=/dev/mmcblk1 bs=1K seek=1; sync $ sudo dd if=u-boot-sd-2015.04-r0.img of=/dev/mmcblk1 bs=1K seek=69; sync Mount: $ mkdir -p /tmp/media/mmcblk1p1 $ mkdir -p /tmp/media/mmcblk1p2 $ mount -t vfat /dev/mmcblk1p1 /tmp/media/mmcblk1p1 $ mount /dev/mmcblk1p2 /tmp/media/mmcblk1p2 Copy files to Yocto BOOT partition: $ cp zImage-imx6ul-var-dart-emmc_wifi.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-emmc_wifi.dtb $ cp zImage-imx6ul-var-dart-nand_wifi.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-nand_wifi.dtb $ cp zImage-imx6ul-var-dart-sd_emmc.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-sd_emmc.dtb $ cp zImage-imx6ul-var-dart-sd_nand.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-sd_nand.dtb $ cp zImage /tmp/media/mmcblk1p1/zImage flashing Yocto Root file System: $ rm -rf /tmp/media/mmcblk1p2/* $ tar xvf rootfs.tar.bz2 -C /tmp/media/mmcblk1p2/
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/:
yocto-nand.sh nand-recovery.sh yocto-emmc.sh.
Some of the scripts are used by the others.
Please use:
- 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)