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

Giordon Stark kratsg at gmail.com
Thu Nov 16 22:17:14 PST 2017


Hi Sandeep,

Thanks for the detail! Is this not documented at all anywhere on a Xilinx
wiki? I'm surprised, given the slight complexity in the steps, that this
procedure isn't as straightforward as for an SD Card boot [but maybe that's
me]. I suppose I still have a few more questions using concrete examples:

My BIF looks like

//arch = zynqmp; split = false; format = BIN
the_ROM_image:
{
    [fsbl_config]a53_x64
    [bootloader]C:\Users\kratsg\Desktop\zu19eg_3.sdk\fsbl\Debug\fsbl.elf
    [destination_cpu = pmu]Z:\gfex-prototype3\pmu-gfex-prototype3.elf
    [destination_device =
pl]C:\Users\kratsg\Desktop\zu19eg_3.sdk\zcu19eg_top_hw_platform_0\zcu19eg_top.bit
    [destination_cpu = a53-0, exception_level = el-3,
trustzone]Z:\gfex-prototype3\arm-trusted-firmware.elf
    [destination_cpu = a53-0, exception_level =
el-2]Z:\gfex-prototype3\u-boot.elf
}

*Why does the BIF not contain the kernel image - as you would do so in the
procedure for SDCard boot?*

Next, our DTS files are here:
https://github.com/kratsg/meta-l1calo/tree/master/conf/machine/boards/gfex/prototype3.
Specifically, I'm looking at "spi1 = &qspi" in system-top.dts and I will
probably need to add the QSPI partitions under this. The point is that I
make a flash node flash at 0(???) { partition1; partition2; partition3; ....
}. *How do I know what to actually write for the flash at 0 stuff? It's not
clear to me how large these blocks should be and how to make sure the
offsets are correct and can be picked up via u-boot and so on. [I looked
here: http://www.wiki.xilinx.com/Linux+ZynqMP+GQSPI+Driver
<http://www.wiki.xilinx.com/Linux+ZynqMP+GQSPI+Driver> as an example since
your email about creating MTD partitions wasn't rendered correctly for me,
so I couldn't read that part, missing an image or something else?]*

*Finally, I'm a little confused about how you're able to have a Linux
prompt without the kernel or filesystem.* Since it looks like you're
programming QSPI with the devicetree, the kernel, and the filesystem -- how
would you have a linux prompt before linux is on there? Chicken before the
egg? Is the procedure that you flash the board with the BOOT.bin using the
XSDK, get the u-boot prompt, and program the QSPI from u-boot prompt?

Thanks!

Giordon

On Thu, Nov 16, 2017 at 11:16 PM Sandeep Gundlupet Raju <SANDEEPG at xilinx.com>
wrote:

> 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.
>
> [image: image001.png]
>
>
>
>
>
> 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:
>
> These partition can be seem from Linux prompt:
>
> 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> wrote:
>
>
>
> *Thanks,*
>
> *Sandeep*
>
>
>
> *From:* 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
> *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/201fddd2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 8979 bytes
Desc: not available
URL: <http://lists.yoctoproject.org/pipermail/meta-xilinx/attachments/20171117/201fddd2/attachment.png>


More information about the meta-xilinx mailing list