[meta-xilinx] [ZynqMP] Booting from QSPI instead of SD Card

Sandeep Gundlupet Raju SANDEEPG at xilinx.com
Thu Nov 16 21:16:19 PST 2017


Hi Giordon,

$ vim boota53.bif  //Add below content

the_ROM_image:
{
[fsbl_config] a53_x64
[pmufw_image] <PATH_TO_IMAGES>/pmu_fw.elf
[bootloader] <PATH_TO_IMAGES>/zynqmp_fsbl.elf
[destination_device=pl] <PATH_TO_IMAGES>/design_1_wrapper.bit
[destination_cpu=a53-0] <PATH_TO_IMAGES>/bl31.elf
[destination_cpu=a53-0] <PATH_TO_IMAGES>/u-boot.elf
}

Run below commands to generate the BOOT.bin
$ source vivado/setting.sh
$ bootgen -image boota53.bif -arch zynqmp -w -o i BOOT.bin

Using QSPI JFFS2 partition as root file system

Linux rootfs can be mounted from JFFS2 partition on the qspi. This document briefs about the steps to use qspi JFFS2 rootfs. This procedure describes generic flow, which can be more simplified if you are using petalinux.

Enabling JFFS2 support in Linux (enabled by default)

Enable Generic QSPI controller driver
CONFIG_SPI_ZYNQMP_GQSPI:                                                                                                                                                                                                                              │
  │                                                                                                                                                                                                                                                       │
  │ Enables Xilinx GQSPI controller driver for Zynq UltraScale+ MPSoC.                                                                                                                                                                                    │
  │                                                                                                                                                                                                                                                       │
  │ Symbol: SPI_ZYNQMP_GQSPI [=y]                                                                                                                                                                                                                         │
  │ Type  : tristate                                                                                                                                                                                                                                      │
  │ Prompt: Xilinx ZynqMP GQSPI controller                                                                                                                                                                                                                │
  │   Location:                                                                                                                                                                                                                                           │
  │     -> Device Drivers                                                                                                                                                                                                                                 │
  │       -> SPI support (SPI [=y])                                                                                                                                                                                                                       │
  │   Defined at drivers/spi/Kconfig:716                                                                                                                                                                                                                  │
  │   Depends on: SPI [=y] && SPI_MASTER [=y] && HAS_DMA [=y]

Enable JFFS2 file system support.
[cid:image001.png at 01D35F1D.FFD5FA60]



Create MTD partitions for the QSPI
MTD partitions can be defined in the qspi device tree node as flash device. Example of qspi partition is as below:
[X]
These partition can be seem from Linux prompt:
root at zcu102-zynqmp<mailto:root at zcu102-zynqmp>:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00002000 "qspi-fsbl-uboot"
mtd1: 01000000 00002000 "qspi-linux"
mtd2: 00020000 00002000 "qspi-device-tree"
mtd3: 04000000 00002000 "qspi-rootfs"


Preparing and populating rootfs in mtd partition

A jffs2 filesystem image can be created using mtd utilities, which can be then flashed to the desired mtd partition (mtd3 in our case). While creating jffs2 image, make sure to pass correct eraseblock size (can be found by sf probe 0 0 0 command on u-boot prompt).

Generating jffs2 image
In yocto project you can specify following two parameters in the local.conf:
IMAGE_FSTYPES += " jffs2"
JFFS2_ERASEBLOCK = "0x2000"
This will generate <image name>.jffs2 file in the deploy area.


Separately if you have tar.gz or rootfs directory, you can generate the rootfs image on the host machine by following command
mkfs.jffs2 --root=<rootfs directory location> --eraseblock=<erase block size> -p -o rootfs.jffs2



Flashing jffs2 image on the partition
It is possible to flash the generated image from u-boot as well as from the Linux prompt.
It is necessary to clean /erase the flash before writing new data (though Linux will take care).

1)      From Linux prompt:

a.      Erase the entire partition and also format it to jffs2

# flash_eraseall -j /dev/mtd3

b.      Write the jffs2 image on mtd 3 partition

# flashcp <path to rootfs.jffs2> /dev/mtd3



2)      From u-boot prompt

a.      Probe the flash device

> sf probe 0 0 0

b.      Erase the entire partition (here you need to know the offset and size)

> sf erase 0x1300000 0x4000000

c.      Load the jffs2 image in the memory location (ddr) from sd card (other tftp from network)

> fatload mmc 0 0x10000000 rootfs.jffs2

d.      Write the image from the memory on to the flash

> sf write 0x10000000 0x1300000 ${filesize}



3)      From Linux prompt with tar.gz image (not jffs2)

Rootfs content can be simply copied after mounting jffs2 partition

a.      Erase the entire partition and also format it to jffs2 (mandatory)

# flash_eraseall -j /dev/mtd3

b.      Determine the location of rootfs.tar.gz image (can be on sd card or network. Assuming sd card for now)

                                                    i.     Mount the sd card

#  mount /dev/mmcblk0p1 /media

c.      Mount jffs2 partition on the /mnt

# mount -t  jffs2 /dev/mtdblock3 /mnt

d.      Copy the file system to the jffs2 partition

# cd /mnt/

# tar zxvf /media/rootfs.tar.gz (choose appropriate path here).

Setting kernel rootfs

One can use rootfs from the jffs2 partition regardless of the boot-mode. Rootfs path can be specified to kernel through bootargs. One can change the bootargs from the u-boot prompt.
For sd-boot, the the bootargs for the root partition is set by sdroot0 variable. You can change the sdroot0 variable to add following to the bootargs
root=/dev/mtdblock3 rw rootwait rootfstype=jffs2
u-boot> setenv sdroot0 "setenv bootargs earlycon clk_ignore_unused root=/dev/mtdblock3 rw rootwait rootfstype=jffs2"
u-boot> saveenv  # for next boot
u-boot> run sdboot

Similarly for other bootmodes make sure that the bootargs is set properly.

Thanks,
Sandeep

From: Giordon Stark [mailto:kratsg at gmail.com]
Sent: Thursday, November 16, 2017 2:11 PM
To: Sandeep Gundlupet Raju <SANDEEPG at xilinx.com>
Cc: meta-xilinx at yoctoproject.org
Subject: Re: [meta-xilinx] [ZynqMP] Booting from QSPI instead of SD Card

Thanks a lot Sandeep,

Do you know what you are supposed to do with the filesystem? E.G. if you create a bif file, that contains what specifically? The linked User Guide seems to indicate not using that, but I'm unclear. I suppose I need the following in order:

- FSBL
- PMU
- ATF
- uramdisk.gz
- devicetree
- u-boot
- Image

Correct?

Giordon
On Thu, Aug 17, 2017 at 9:46 PM Sandeep Gundlupet Raju <SANDEEPG at xilinx.com<mailto:SANDEEPG at xilinx.com>> wrote:

Thanks,
Sandeep

From: meta-xilinx-bounces at yoctoproject.org<mailto:meta-xilinx-bounces at yoctoproject.org> [mailto:meta-xilinx-bounces at yoctoproject.org<mailto:meta-xilinx-bounces at yoctoproject.org>] On Behalf Of Giordon Stark
Sent: Thursday, August 17, 2017 6:10 PM
To: meta-xilinx at yoctoproject.org<mailto:meta-xilinx at yoctoproject.org>
Subject: [meta-xilinx] [ZynqMP] Booting from QSPI instead of SD Card

Hi,

Many thanks to the folks here for helping me get the SD Card booting working (especially with the data duplicator command to burn the SD card correctly with partitions). What's the general procedure for having the board boot from the QSPI instead of the SD card? Do you need specific software on the computer and transfer over JTAG?
Refer UG1209 https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_1/ug1209-embedded-design-tutorial.pdf

It would be great if someone could point me to a set of instructions.

Giordon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-xilinx/attachments/20171117/ba200014/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 8979 bytes
Desc: image001.png
URL: <http://lists.yoctoproject.org/pipermail/meta-xilinx/attachments/20171117/ba200014/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oledata.mso
Type: application/octet-stream
Size: 5700 bytes
Desc: oledata.mso
URL: <http://lists.yoctoproject.org/pipermail/meta-xilinx/attachments/20171117/ba200014/attachment.obj>


More information about the meta-xilinx mailing list