Author Topic: Boot from QSPI + eMMC (TE0820)  (Read 165 times)

r.brue

  • Active Member
  • *
  • Posts: 10
Boot from QSPI + eMMC (TE0820)
« on: March 23, 2021, 05:29:21 PM »
Hi, I'm pretty new to this and I can't figure out a specific flow to do this. I have always worked with a SD card on a custom board which uses the TE0820. The SD card is so formed:
  • FAT32: BOOT.BIN and image.ub
  • ext4: rootfs data
The board then works well. Now our customer has required us to move everything to the internal eMMC flash and he doesn't want to use (and to have any access) to the SD card slot. So we have removed the SD slot. Now I am not understanding how can I write the required partitions within the eMMC flash through the JTAG cable. Does anyone have any guide? So far I've understood the following statements, can you please verify these points?
  • In order to move everything inside the board without any SD access, I have to write the BOOT.BIN and the image.ub inside the QSPI
  • The rootfs is then moved inside the eMMC partition (8GB) formatted in ext4
  • The QSPI can be written using Vivado Design > Program QSPI tool
  • The eMMC is not partitioned when shipped, I have to do so using a temporary Linux image (through SD?! I haven't access to this!)
The questions are:
1. How can I then write the rootfs, and maybe move inside the eMMC also the kernel image (image.ub) using the JTAG cable?
2. Can I pure on the QSPI only the u-boot related files?
3. How can I specify to the u-boot parameters to load the image.ub from a eMMC partition? how then can specify to the image.ub to load the rootfs from the ext4 partiotion inside the eMMC?

Thank you.

r.brue

  • Active Member
  • *
  • Posts: 10
Re: Boot from QSPI + eMMC (TE0820)
« Reply #1 on: March 23, 2021, 06:01:40 PM »
In order to clarify what I am trying to obtain, I've created this table.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1611
Re: Boot from QSPI + eMMC (TE0820)
« Reply #2 on: March 24, 2021, 03:08:51 PM »
Hi,
you can't use JTAG to formate emmc.

Use running linux or uboot to format eMMC like you need.
1. Start for example your SD design with Linux and formate eMMC and copy all files to eMMC like you need.
2. Change Uboot configuration to search files on eMMC instead of SD
3. create new Boot.bin with your new uboot
4. Programm QSPI with your new Boot.bin

Instead of loading image.ub from SD to prepare emmc, also TFTP can be used in uboot to load image.ub from tftp server for first emmc preparing.

Note: you customer should always try to unmount emmc before he hard restart the module (power reset). It's like on your PC in worst case hard power reset without unmount can damage storage device.

br
John

r.brue

  • Active Member
  • *
  • Posts: 10
Re: Boot from QSPI + eMMC (TE0820)
« Reply #3 on: March 25, 2021, 10:11:55 AM »
Ok thank you, as I was suspecting, the easiest way to do this is to start the SOM on an evaluation board, partition the eMMC and store there the rootfs via an ad-hoc Linux image starting from an SD card, meanwhile I am able to flash the QSPI with the BOOT.BIN file through JTAG with "program_flash". Now the system is working well and it loads from the QSPI + eMMC correctly. Now I have a further question slightly different:
I am packaging the BOOT.BIN with the following command:
Code: [Select]
petalinux-package --boot --format BIN --force --fsbl images/linux/zynqmp_fsbl.elf --fpga ./hw/bitstream.bit --u-boot --kernelFinally I can observe that my BOOT.BIN will contain the following files:
  • "/images/linux/zynqmp_fsbl.elf"
  • "/images/linux/pmufw.elf"
  • "/hw/bitstream.bit"
  • "/linux/bl31.elf"
  • "/images/linux/u-boot.elf"
  • "/images/linux/image.ub"
I am flashing the QSPI with this other command:
Code: [Select]
program_flash -f images/linux/BOOT.BIN -fsbl images/linux/zynqmp_fsbl.elf -flash_type qspi-x8-dual_parallelNow I can see my "mtd" device (QSPI) from the running Linux with the following partitions (the same that I've set on petalinux-config):
Code: [Select]
cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00500000 00002000 "boot"
mtd1: 00900000 00002000 "bootenv"
mtd2: 018cba80 00002000 "kernel"
Now I have to perform an update of the bitstream, how can I do that in a running system on field in a easy way?
I was looking for the command "flashcp" but I don't understand where to place the bitstream.bin file in such mtd partitions. Any suggestion?

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1611
Re: Boot from QSPI + eMMC (TE0820)
« Reply #4 on: April 01, 2021, 06:27:08 AM »
Hi,
I'm sorry I can't give tutorial how you use Xilinx tools, please check Xilinx documentation.

--> flash partitions will be set and changed via petalinux-config menu (this must be done manually). Easiest way is simple that copy simple Boot.bin(include FSBL, bistream, application(uboot.elf)) in the first partition. --> Zynq Bootrom will search there for FSBL and FSBL for bitstream and application.

--> you can also put more things(like image.ub or other files) into Boot.bin if you want, in this case you please read also Xilinx documentation about this topics.

br
John