iMX6sx How to flash a whole image to QSPI flash

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

iMX6sx How to flash a whole image to QSPI flash

828 Views
mpilia
Contributor III

Hi,

I am looking for a way to burn the QSPI flash of the iMX6sx SABRE board with an image of the whole system, I mean containing bootloader, kernel, DTB and root file system.

I built an image starting from the repo https://github.com/Freescale/fsl-community-bsp-platform -b dunfell, with these settings:

MACHINE=imx6sxsabresd
DISTRO=poky
UBOOT_CONFIG = "qspi2 sd"
core-image-minimal
  1. Is it possible to transfer a whole image to QSPI flash, maybe with the UUU tool?
  2. If 1. is true, how must be the virtual image partitioned, using for instance kpartx like explained in this post? looking at section "Flash Memory maps" of the "i.MX Linux User's Guide" I found this:

mtdparts=[memory type designator]:[size]([name of partition]),[size]([name of partition]),-([name of final partition])

and, for the QuadSPI in particular, this:

mtdparts=21e4000.qspi:1m(uboot),8m(kernel),1m(dtb),-(user)

Does it mean that when I set the partitions I have to leave 1MB free for the bootloader, then make a first partition (8MB) for the kernel, a second one (1MB) for the DTB and a third one for user space?

 

I tried to use UUU following its user guide where I found these:

SDP: boot -f u-boot-imx7dsabresd_sd.imx -nojump
SDP: write -f zImage -addr 0x80800000
SDP: write -f zImage-imx7d-sdb.dtb -addr 0x83000000
SDP: write -f fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot -addr 0x83800000
SDP: jump -f u-boot-dtb.imx -iv

 but I'm not sure about it.

Does anybody suggest me the right way?

0 Kudos
1 Reply

811 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Unfortunately we don't have examples for flashing whole Linux image into the QSPI.

I could suggest to take a look to the script to flash uboot into the QSPI and modify it accordingly for this purpose.

qspi_burn_loader script

Spoiler

uuu_version 1.2.39

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

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

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM, skip QSPI header
SDPS: boot -f _flexspi.bin -skipfhdr

# 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 _flexspi.bin -offset 0x10000 -skipfhdr
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 _flexspi.bin -skipspl -skipfhdr
SDPV: jump
# }

FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f _image

# Check Image if include flexspi header
FB: ucmd if qspihdr dump ${fastboot_buffer}; then setenv qspihdr_exist yes; else setenv qspihdr_exist no; fi;

FB[-t 60000]: ucmd if test ${qspihdr_exist} = yes; then qspihdr init ${fastboot_buffer} ${fastboot_bytes} safe; else true; fi;

#if uboot can't support qspihdr command, use uboot image to write qspi image, which require image include qspi flash header
FB: ucmd if test ${qspihdr_exist} = no; then sf probe; else true; fi;
FB[-t 40000]: ucmd if test ${qspihdr_exist} = no; then sf erase 0 +${fastboot_bytes}; else true; fi;
FB[-t 20000]: ucmd if test ${qspihdr_exist} = no; then sf write ${fastboot_buffer} 0 ${fastboot_bytes}; else true; fi;
FB: done

Best regards,
Aldo.

0 Kudos