How to partition QSPI NOR Flash on iMX6UL-EVL ?

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

How to partition QSPI NOR Flash on iMX6UL-EVL ?

Jump to solution
3,023 Views
toanjunifer
Senior Contributor I

Hi,

   As question above, this issue actually hardly with me. So I hope someone can help me.

   I trying to flash U-boot, zImage, .dts file and rootfs into QSPI. And I'm using mfgtools. So the problem is when I read ucl2.xml, in part QSPI Nor Flash, this tool is flash only .imx file and header file.

   Then, I check mtd partition in Linux command line:

$ cat /proc/mtd

mtd0: 02000000 00010000 "21e0000.qspi"

   It's show me only one part is mtd0 with size 32Mb. Then I try to customize the device tree file and devide it into 4 parts.

&qspi {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_qspi>;
    status = "okay";
    ddrsmp=<0>;

    flash0: n25q256a@0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "micron,n25q256a";
        spi-max-frequency = <29000000>;
        spi-nor,ddr-quad-read-dummy = <6>;
        reg = <0>;
        partition@0 {
            /* 1M for Uboot */
            reg = <0x00000000 0x00100000>;
            label = "uboot";
        };
        partition@1 {
            /* 8M for kernel- zImage */
            reg = <0x00100000 0x00800000>;
            label = "kernel";
        };
        partition@2 {
            /* 1M for device tree */
            reg = <0x00800000 0x00100000>;
            label = "dts";
        };
        partition@3 {
            /* 20M for root file system */
            reg = <0x00900000 0x01400000>;
            label = "rootfs";
        };
    };
};

And I execute again this command: 

$ cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00010000 "uboot"
mtd1: 00800000 00010000 "kernel"
mtd2: 00100000 00010000 "dts"
mtd3: 01400000 00010000 "rootfs"

 Okay, It's seem be right. But when I access uboot environment and check with:

$ printenv

baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootcmd=run findfdt;mmc dev ${mmcdev};mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};
bootdelay=3
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
ethact=FEC1
ethaddr=00:04:9f:04:d3:8d
ethprime=FEC
fdt_addr=0x83000000
fdt_file=undefined
fdt_high=0xffffffff
findfdt=if test $fdt_file = undefined; then if test $board_name = EVK && test $board_rev = 9X9; then setenv fdt_file imx6ul-9x9-evk.dtb; fi; if test $board_name = EVK && test $board_rev = 14X14; then setenv fdt_file imx6ul-14x14-evk.dtb; fi; if test $fdt_file = undefined; then echo WARNING: Could not determine dtb to use; fi; fi;
image=zImage
initrd_addr=0x83800000
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x80800000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.file=/fat g_mass_storage.ro=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber="" clk_ignore_unused
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
panel=TFT43AB
script=boot.scr

Environment size: 2457/8188 byte

And I can not found mtdparts environment. Then I try execute this command to add mtdparts environment:

$ setenv mtdparts mtdparts=21e0000.qspi:1m(uboot),8m(kernel),1m(dtb),20(rootfs)

Then I check with command: 

$ printenv mtdparts

mtdparts=mtdparts=21e0000.qspi:1m(uboot),8m(kernel),1m(dtb),20(rootfs)

Next step, I customize the ucl2.xml to flash all 4 parts above. <In attached file below>

But I got error with:

UTP: received command '$ flash_erase /dev/mtd1 0 20'
UTP: executing "flash_erase /dev/mtd1 0 20"
flash_erase: error!: /dev/mtd1
error 2 (No such file or directory)
UTP: sending Non-success to kernel for command $ flash_erase /dev/mtd1 0 20.
utp_poll: exit with status 65280

This mean I do something wrong in partition. May I only partition in kernel but actually in default It still one partition is mtd0. 

Someone can help me ?

Thank you so much,

Toan

Labels (1)
1 Solution
2,754 Views
Yuri
NXP Employee
NXP Employee

Hello,

   kernel and DTBs are described in Table, named  "Kernel and device tree configurations" of 

i.MX_Linux_Release_Notes.pdf.

Regards,

Yuri.

View solution in original post

3 Replies
2,754 Views
Yuri
NXP Employee
NXP Employee

Hello,

  try the following in U-boot, as an example :

 

setenv bootargs 'console=${console},${baudrate} root=${mmcroot} mtdparts=21e4000.qspi:1m(uboot),8m(kernel),1m(dtb),-(user)'

 The Linux kernel's mtdparts command line option is used for dynamic partitioning.

UBootCmdGroupFlash < DULG < DENX 

Regards,

Yuri.

2,754 Views
toanjunifer
Senior Contributor I

Hi YuriMuhin_ng‌,

Thank you for your reponse. I going to try follow your guide. May I ask you one more question ?

What is the kernel file for iMX6UL-EVK with boot from QSPI ?

This is list of kernel which I search in build directory.

pastedImage_3.png

Thank you so much,

Toan

0 Kudos
2,755 Views
Yuri
NXP Employee
NXP Employee

Hello,

   kernel and DTBs are described in Table, named  "Kernel and device tree configurations" of 

i.MX_Linux_Release_Notes.pdf.

Regards,

Yuri.