How to flash NAND Yocto image to i.MX6UL Board using UUU.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to flash NAND Yocto image to i.MX6UL Board using UUU.

3,581 Views
harit
Contributor I

Hello,

We created a custom i.MX6UL board. We successfully able to load SDCard Yocto image to the board. Now we want to load Nand image to our custom board of i.MX6UL as we are using NAND FLash in our board. But the kernel is not able to find the UBI partition in the system and the boot stops there.Part number for our NAND Flash is 'MT29F32G08CBADBWP-12IT:D TR'. We are using following scrpit to load image to NAND Flash with UUU version 'uuu_version 1.2.39'

https://github.com/NXPmicro/mfgtools/wiki/Sample-script#burn-nand-flash-by-linux-kernel 

We also tired load image using the mfg-tools version L4.1.15_2.0.0-ga_mfg-tools. But it stuck at

'Starting UTP' . Below i attached the log for both UUU flash and Mfg-tool. I also attched the printenv log when flashed through UUU.

The files I used is as follows:
1) uboot-dtb.imx → _flash_fw.bin & _flash.bin
2) uTee-6ulevk → _tee
3) fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot (from L4.14.98 official demo) → _initramfs.cpio.gz.uboot
4) imx6ul-14x14-evk-gpmi-weim.dtb → _board.dtb
5) fsl-image-machine-test.rootfs.tar.bz2 → _rootfs.tar.bz2
6) zImage→ _Image

As support for i.MX6UL NAND UBOOT_CONFIG is not available in YOCTO-3.3 (Hardknott). So we created generated the U-Boot and kernel Image as guided in IMX_LINUX_USERS_GUIDE at page no.37. The U-boot and kernel version we are using to generate images are 'lf_v2021.04' and 'lf-5.10.y' respectively.

We also followed the below NXP guide to burn image to NAND FLASH but it stops after u-boot.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-To-use-NAND-boot-on-i-MX6UL-EVK-boar... 

UUU stops after erasing Nand Flash for writing rootfs in it.Any help will be appreciated.Screenshot from 2022-03-22 14-59-15.png

 

 

Labels (3)
0 Kudos
Reply
7 Replies

3,557 Views
BiyongSUN
NXP Employee
NXP Employee

since uuu 1.3.82  supports build-in command -b nand, which work with u-boot nandbcb cmd. 

uuu [-d -m -v] -b[run] <emmc|emmc_all|fat_write|nand|qspi|sd|sd_all|spl> arg...
Run Built-in scripts
emmc burn boot loader to eMMC boot partition
arg0: _flash.bin bootloader
arg1: _image[Optional] image burn to emmc, default is the same as bootloader
emmc_all burn whole image to eMMC
arg0: _flash.bin bootloader, which can extract from wic image
arg1: _image[Optional] wic image burn to emmc.
fat_write update one file in fat partition, require uboot fastboot running in board
arg0: _image image, which cp to fat partition
arg1: _device storage device, mmc\sata
arg2: _partition fat partition number, like 1:1
arg3: _filename[Optional] file name in target fat partition, only support rootdir now
nand burn boot loader to NAND flash
arg0: _flash.bin bootloader
arg1: _image[Optional] image burn to nand, default is the same as bootloader
qspi burn boot loader to qspi nor flash
arg0: _flexspi.bin bootloader
arg1: _image[Optional] image burn to flexspi, default is the same as bootloader
sd burn boot loader to sd card
arg0: _flash.bin bootloader
arg1: _image[Optional] image burn to emmc, default is the same as bootloader
sd_all burn whole image to sd card
arg0: _flash.bin bootloader, which can extract from wic image
arg1: _image[Optional] wic image burn to emmc.
spl boot spl and uboot
arg0: _flash.bin

uuu -bshow <emmc|emmc_all|fat_write|nand|qspi|sd|sd_all|spl>
Show built-in script

internal uuu -b nand 

uuu -bshow nand
uuu_version 1.2.39

# @_flash.bin | bootloader
# @_image [_flash.bin] | image burn to nand, default is the same as bootloader

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f _flash.bin

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
SDPS: boot -f _flash.bin

# These commands will be run when use SPL and will be skipped if no spl
# SDPU will be deprecated. please use SDPV instead of SDPU
# {
SDPU: delay 1000
SDPU: write -f _flash.bin -offset 0x57c00
SDPU: jump
# }

# These commands will be run when use SPL and will be skipped if no spl
# if (SPL support SDPV)
# {
SDPV: delay 1000
SDPV: write -f _flash.bin -skipspl
SDPV: jump
# }

FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f _image
FB: ucmd if test ! -n "$fastboot_bytes"; then setenv fastboot_bytes $filesize; else true; fi
# Burn image to nandfit partition if needed
FB: ucmd if env exists nandfit_part; then nand erase.part nandfit; nand write ${fastboot_buffer} nandfit ${fastboot_bytes}; else true; fi;
FB: ucmd nandbcb init ${fastboot_buffer} nandboot ${fastboot_bytes}
FB: Done

 

or you can use linux to use kobs-ng as mfg tool does. 

 

 

the script   example_kernel_nand.uuu is in binary demo release.

........

........

# write boot loader
FBK: ucmd source /tmp/mtd.sh; flash_erase /dev/mtd${nandboot} 0 0
FBK: ucp _flash.bin t:/tmp/boot
FBK: ucmd source /tmp/mtd.sh; cd /tmp; if [[ ! `cat /sys/devices/soc0/soc_id` =~ .*MX8(Q|DXL|MN|MP).* ]]; then pad="-x"; fi; kobs-ng init $pad -v --chip_0_device_path=/dev/mtd${nandboot} /tmp/boot

# burn FIT
FBK: ucmd if [[ `cat /tmp/mtd.sh` = *"nandfit"* ]]; then source /tmp/mtd.sh; flash_erase /dev/mtd${nandfit} 0 0; dd if=/tmp/boot of=/tmp/fit; nandwrite -p /dev/mtd${nandfit} -p /tmp/fit; fi

0 Kudos
Reply

3,548 Views
harit
Contributor I

Thank you, for your reply.

We already tried the built-in command available in UUU as you have shown. But as it is only for flashing u-boot we are able to load u-boot in our Nand Flash. And when we try to add _image parameter as our zImage file we get an error of 'unknown command nandbcb' on the serial terminal. I also exactly don't know what file we have to give in _image parameter, can you please also tell which file we have to give in _image parameter? And yes the script of 'example_kernel_nand.uuu' is the same one I get from the github repo of NXPmicro/mfgtools.

I hope you can see the attached log file of flashing from UUU. We are able to write U-boot, DTB, uTee and FIT in our Nand Flash but it fails at writing rootfs shows the error of 'UBI partition not available'. We have used the rootfs file generated by Yocto when I make yocto image for SDCard. Will this rootfs file will work for Nand Flash?

0 Kudos
Reply

3,520 Views
BiyongSUN
NXP Employee
NXP Employee

you could uuu -s   (shell mode) to debug this issue. 

in the uuu shell, you can use FBK: ucmd source /tmp/mtd.sh; flash_erase /dev/mtd${nandrootfs} 0 0

to step by step to do the script 

and you can use   FBK: ucmd ls /dev/mtd*  in  uuu shell to check it.

It could be this line, you are using i.MX6UL

FBK: ucmd source /tmp/mtd.sh; cd /tmp; if [[ ! `cat /sys/devices/soc0/soc_id` =~ .*MX8(Q|DXL|MN|MP).* ]]; then pad="-x"; fi; kobs-ng init $pad -v --chip_0_device_path=/dev/mtd${nandboot} /tmp/boot

0 Kudos
Reply

3,513 Views
harit
Contributor I

Hello,

We tired to run all the commands present in uuu script file line by line writing them in shell mode of uuu. But it still fails at same command "FBK: ucmd source /tmp/mtd.sh; ubiattach /dev/ubi_ctrl -m ${nandrootfs}" present in script while burning rootfs to Nand Flash.

We tired the command:

FBK: ucmd ls /dev/mtd*

This gives list of available device  as follow:

U>FBK: ucmd ls /dev/mtd* 
1:14>Start Cmd:FBK: ucmd ls /dev/mtd* 
New USB Device Attached at 1:14
/dev/mtd0
/dev/mtd0ro
/dev/mtd1
/dev/mtd1ro
/dev/mtd2
/dev/mtd2ro
/dev/mtd3
/dev/mtd3ro
/dev/mtd4
/dev/mtd4ro
/dev/mtdblock0
/dev/mtdblock1
/dev/mtdblock2
/dev/mtdblock3
/dev/mtdblock4
1:14>Okay (0.165s)
Okay

 

0 Kudos
Reply

3,497 Views
BiyongSUN
NXP Employee
NXP Employee

With uuu -s (shell mode), Now you are in front of a Linux. 

You can do step by step debug.

The knowledge of nand and command under linux are the same. 

Tags (1)
0 Kudos
Reply

3,484 Views
harit
Contributor I

It seems that it’s not finding a UBIATTACH,
When we are trying to run with uuu and ubi.We have tried finding any files related to kernel and ubiattach but the kernel(lf-5.10.y) that we are using doesn’t seems to have that.May be we are using a kernel that doesn’t support ubiattach. but we don’t know where to find a right one.Here is the log that we have when it fails.

 

run shell cmd: source /tmp/mtd.sh; flash_erase /dev/mtd${nandrootfs} 0 0
[   33.914966] random: crng init done
run shell cmd: source /tmp/mtd.sh; ubiattach /dev/ubi_ctrl -m ${nandrootfs}
ubiattach: error!: UBI is not present in the system

 

0 Kudos
Reply

3,467 Views
BiyongSUN
NXP Employee
NXP Employee

open the
fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot

found ubiattach is in /usr/sbin/

tree --charset . /usr/sbin/
/usr/sbin/
|-- aa-remove-unknown

|-- ubiattach
|-- ubiblock
|-- ubicrc32
|-- ubidetach
|-- ubiformat
|-- ubimkvol
|-- ubinfo
|-- ubinize
|-- ubirename
|-- ubirmvol
|-- ubirsvol
|-- ubiupdatevol

0 Kudos
Reply