Hello everyone,
we are working with iMX8MP at a custom board with 1GB NAND storage.
Trying to face a possible uboot corruption we thought about the chapter "6.1.6 Boot Image" of the Reference manual, where it states that two booting images can be stored on memory in order to overcome a possible boot image corruption.
I've been able to test this feature booting from an SD by just burning the "flash.bin" file at SD offsets: 32K and 4M. Once done that, if we erase the first uboot, iMX8M jumps directly to the 4M offset and run the secondary image.
Now I'm trying to reproduce this behaviour from the NAND memory but I find no way to do it.
Is it even possible?
Any clue, tutorial or link that might be helpful?
Thanks in advance!
kobs-ng could write two copies for firmware(bootloader). it is default.
since uuu 1.3.82 supports build-in script for nand "-b nand " with need nandbcb in u-boot, which does the similar as the kobs-ng.
And I suggest you to use emmc, because
a. nand flash bad block handling is a problem could not overcome by linux.
b. using nand will spend more time for mass production.
c. the price difference is small between emmc and nand.
example_kernel_nand.uuu 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
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
Please use uuu to burn image:
uuu -b nand flash.bin xxx.rootfs
uuu:https://github.com/NXPmicro/mfgtools/releases