Author Topic: Building u-boot with PetaLinux for ZynqBerry  (Read 1420 times)

kampi

  • Active Member
  • *
  • Posts: 22
Building u-boot with PetaLinux for ZynqBerry
« on: January 11, 2021, 11:26:00 PM »
Hello,

I want to build my own u-boot with PetaLinux to use it for the BOOT.bin file. Which options do I have to change in PetaLinux to disable the external script file for the u-boot configuration? Or do I have to integrate the script file for u-boot in my BOOT.bin?

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #1 on: January 12, 2021, 07:51:46 AM »
Hi,
I'm not sure what you mean with " Which options do I have to change in PetaLinux to disable the external script file for the u-boot configuration?"

Normally there is nothing to change for u-boot.  Import xsa and generate linux files. but fsbl, bistream and uboot into boot.bin and boot and program flash.
We have reference designs and some general notes:
https://wiki.trenz-electronic.de/display/PD/TE0726+Reference+Designs
https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart

In case you will still change somthing on u-boot, you can change u-boot configuration with petalinux-config -c u-boot. Instead of using predefined u-boot sources from the petalinux installation, it should be also possible to change to other local version of u-boot source code with petalinux config menue.
Which version Xilinx used for different petalinux version did you find on the Xilinx AR, for example 19.2:
https://www.xilinx.com/support/answers/72950.html
https://github.com/Xilinx/u-boot-xlnx

Or build u-boot manually (I would not recommend this, in case you has no experience on this topic) .
For more details see petalinux user guide

br

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #2 on: January 12, 2021, 09:50:48 AM »
Hello,

I build it in this way with the default settings:

Code: [Select]
$ petalinux-config --get-hw-description ../hardware/System_wrapper.xsa
$ petalinux-build
$ petalinux-package --boot --fsbl  --fpga  --u-boot


I copy the generated "BOOT.bin" into the flash of the ZynqBerry and after powering up I get the following messages.

PetaLinux also generates a "boot.scr" file which I have normally copied, together with u-boot, onto the same SD card. So I think the error comes from the missing file.


« Last Edit: January 12, 2021, 10:12:55 AM by kampi »

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #3 on: January 12, 2021, 10:06:45 AM »
Hi,
ZYBO is a digilent board, in this case you should write i´to digilent forum:
https://reference.digilentinc.com/reference/programmable-logic/zybo/start
https://forum.digilentinc.com/


For Zynqberry, we offer reference designs (with prebuilt binaries to test), petalinux templates and additional information how we have setup petalinux build environment:
https://wiki.trenz-electronic.de/display/PD/TE0726+Test+Board
https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart


I think your exported XSA did not match the the real platform. Did you use correct PS configuration in your design where you has exported XSA?

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #4 on: January 12, 2021, 10:21:24 AM »
Hi,
ZYBO is a digilent board, in this case you should write i´to digilent forum:

Sorry, it was the wrong board. I have tried it with the ZynqBerry (I fix the wrong post)

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #5 on: January 12, 2021, 10:27:41 AM »
Hi,
so please try out the reference design.
At first prebuilt Boot.bin and image.ub. Note: Zynq package from Zynqberry allows only QSPI for primary boot, so configure Flash with Boot.bin and put image.ub only on SD.
If this works, generate linux again with the testboard petalinux template and the provided xsa file. --> Use the same petalinux like we have done.
if this works, create our vivado project and export XSA and use our template.
Later you can start to modify.
What we has changed on petalinux config is described on the Test Board Wiki page, instead you want create the petalinux project from scratch.


br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #6 on: January 12, 2021, 10:55:41 AM »
Hello,

I have done these steps already. My own PetaLinux base does work very well when I regenerate the "BOOT.bin" file from PetaLinux with my own file, which I generate with the FSBL from the PetaLinux image, the bitstream from the XSA file, and the u-boot from the reference design and I get the above error when I change the u-boot to the u-boot version from PetaLinux.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #7 on: January 12, 2021, 11:07:52 AM »

Which Vivado/Petalinux version did you use?

Did you installed all packages which are required in the petalinux installation guide? Did you use supported OS, which are listed in the petalinux installation guide?

Did you use our petalinux template with prebuilt xsa? this makes the same issue?

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #8 on: January 13, 2021, 12:18:36 PM »
Hi,

I use PetaLinux 2020.2 (same for Vivado). The PetaLinux installation works very well because I have successfully generated a Linux image for my ZYBO (same block diagram as for the ZynqBerry, but different SoC). I also have used your template with the same behaviour.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #9 on: January 13, 2021, 01:04:33 PM »
compatibility of the templates depends on the changes from petalinux between the versions.

We test only with 2019.2.

2020.2 updates are planned.


Wen you use  petalinux 2020.2, maybe you can help me. Can you export changes in uboot or kernel to the user layer as receipe?
I mean, change something on on the configuration ("petalinux-config -c kernel" or "petalinux-config -c u-boot"). With 2019.2 you must run "petalinux-build -c kernel -x finish -f " or "petalinux-build -c u-boot -x finish -f" to export changes from developer part into the user layer. This doesn't work with 2020.2, I didn't found a solution until now, excepted to generate the layer manually.

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #10 on: January 14, 2021, 04:15:31 PM »
Hello,

sorry, but I´m not so experienced with PetaLinux for now. So I don´t know how to do it...
I checked the documentation for the function of this command but I didn´t found the parameter "finish" in the documentation of PetaLinux 2019.1 (unfortunately I didn´t found the command-line documentation for 2019.2),

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_1/ug1157-petalinux-tools-command-line-guide.pdf

so I don´t know exactly what this command is doing. But maybe I can repeat the question in the Xilinx Forum.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #11 on: January 14, 2021, 04:47:44 PM »
Hi,
no problem.
Quote
so I don´t know exactly what this command is doing. But maybe I can repeat the question in the Xilinx Forum.
Is not needed, I can do the same in case I didn't find a solution.

Note 2019.2 works. I would recommend to use Vivado/Vitis/Petalinux 2019.2 at the moment. I will publish 20.2 version, when I get it running.
br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #12 on: January 14, 2021, 06:19:23 PM »
Ok. Let me know when you have a solution. Until then  I will use the pre-compiled u-boot from your reference project.

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #13 on: January 17, 2021, 08:12:57 PM »
Hi,

I think I found the "problem":

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/749142017/Using+Distro+Boot+With+Xilinx+U-Boot

PetaLinux 2020.1+ uses something that is called "Distro boot" with the "boot.scr" method. So I have to place "boot.scr" in the flash memory of the ZynqBerry.

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #14 on: January 18, 2021, 12:39:54 AM »
Okay, I got stuck now...

I followed these two guides:

https://tuxengineering.com/blog/2020/09/03/U-Boot-changes-to-distro-boot.html
https://forums.xilinx.com/t5/Embedded-Development-Tools/Unable-to-boot-from-QSPI-using-Petalinux-2020-1-Upgrading-from/td-p/1145107

First I have created a new partition for the "boot.scr" (see screenshot). Then I modify "recipes-bsp/u-boot/files/platform-top.h" with the address

Code: [Select]
CONFIG_BOOT_SCRIPT_OFFSET=0xFA0000

and run

Code: [Select]
petalinux-config -c u-boot

I change the boot script offset to 0xFA0000 (see screenshot) and finish the build

Code: [Select]
petalinux-build

In the next step I try to write the "boot.scr" file into the flash memory by using the following TCL command:

Code: [Select]
program_flash -f .../ZynqBerry/MinimalLinux/flash/boot.scr -offset 0xFA0000 -fsbl .../ZynqBerry/fsbl_flash/fsbl_flash.elf -flash_type qspi-x4-single -verify -target_name jsn-JTAG-ONB4-251633001BB2A -url tcp:localhost:3121

The command exit with the error (but why?)

Code: [Select]
ERROR: Given target do not exist

So I try another way. I use the "zynq_fsbl", "u-boot.elf", "boot.scr" and my bitstream to generate a new "BOOT.bin" with Vitis:

Code: [Select]
//arch = zynq; split = false; format = BIN
the_ROM_image:
{
[bootloader]...\ZynqBerry\MinimalLinux\zynq_fsbl.elf
...\ZynqBerry\MinimalLinux\application\MinimalLinux\hw\System_wrapper.bit
...\ZynqBerry\MinimalLinux\u-boot.elf
[offset = 0xFA0000]...\ZynqBerry\MinimalLinux\boot.scr
}

The resulting file is written into the flash and the ZynqBerry was bootet, but throw this error:

Code: [Select]
U-Boot 2020.01 (Jan 17 2021 - 22:20:11 +0000)

CPU:   Zynq 7z010
Silicon: v3.1
DRAM:  ECC disabled 512 MiB
Flash: 0 Bytes
NAND:  0 MiB
MMC:   mmc@e0101000: 0
Loading Environment from SPI Flash... SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Net:   No ethernet found.
Hit any key to stop autoboot:  0
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0xfa0000, size 0x40000
SF: 262144 bytes @ 0xfa0000 Read: OK
QSPI: Trying to boot script at 0x3000000
## Executing script at 03000000
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Offset exceeds device limit
sf - SPI flash sub-system

Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus
                                  and chip select
sf read addr offset|partition len       - read `len' bytes starting at
                                          `offset' or from start of mtd
                                          `partition'to memory at `addr'
sf write addr offset|partition len      - write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf erase offset|partition [+]len        - erase `len' bytes from `offset'
                                          or from start of mtd `partition'
                                         `+len' round up `len' to block size
sf update addr offset|partition len     - erase and write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf protect lock/unlock sector len       - protect/unprotect 'len' bytes starting
                                          at address 'sector'

Wrong Image Format for bootm command
ERROR: can't get kernel image!
QSPI: SCRIPT FAILED: continuing...
JTAG: Trying to boot script at 0x3000000
## Executing script at 03000000
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Offset exceeds device limit
sf - SPI flash sub-system

So why does u-boot print out this:

Code: [Select]
Trying to boot script at 0x3000000

This is the wrong address for the boot script.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #15 on: January 18, 2021, 06:49:06 AM »
Hi, thanks for your note. "boot.scr" is new for me, I will check it.

To your problem. You did not put linux into  flash, you must check and modify "boot.scr" maybe. Did you want to boot linux from flash or from SD? We put image.ub normally on SD (flash is also possible, but you has limit space only), so check boot.scr is set to SD  card for image search.

PS: I think "petalinux-config -c u-boot"  changes will not be used by petalinux build at the moment, because this changes are in the developer space. Export receipt must be done --> that was the problem I've (Which I wrote in a older post). In your case you has done the same changes on platform-top.h with "CONFIG_BOOT_SCRIPT_OFFSET=0xFA000" that's the same like modify on uboot config menu, so you has done 2 times the same changes and I think this  one from platform-top is used and this one from uboot config is ignored during build.

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #16 on: January 18, 2021, 10:33:04 AM »
Hi,

I want to boot the Linux from the SD card, so I have to do some additional research on how I modify the "boot.scr". I have checked "/project-spec/meta-user/recipes-bsp/u-boot/u-boot-zynq-scr" and found the file "boot.cmd.default" which consist the plaintext script:

Code: [Select]
# This is a boot script for U-Boot
# Generate boot.scr:
# mkimage -c none -A arm -T script -d boot.cmd.default boot.scr
#
################
## Please change the kernel_offset and kernel_size if the kernel image size more than
## the 100MB and BOOT.BIN size more than the 30MB
## kernel_offset --> is the address of qspi which you want load the kernel image
## kernel_size --> size of the kernel image in hex
###############
fdt_addr=0x1000
imageub_addr=0x10000000
kernel_addr=0x80000
kernel_offset=0x1E00200
kernel_size=0x7800000
kernel_type=image.ub

for boot_target in ${boot_targets};
do
if test "${boot_target}" = "jtag" ; then
booti ${kernel_addr} - ${fdt_addr};
exit;
fi
if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" ; then
if test -e ${devtype} ${devnum}:${distro_bootpart} /image.ub; then
fatload ${devtype} ${devnum}:${distro_bootpart} ${imageub_addr} image.ub;
bootm ${imageub_addr};
exit;
fi
if test -e ${devtype} ${devnum}:${distro_bootpart} /Image; then
fatload ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr} Image;
booti ${kernel_addr} - ${fdt_addr};
exit;
fi
booti ${kernel_addr} - ${fdt_addr};
exit;
fi
if test "${boot_target}" = "xspi0"; then
sf probe 0 0 0;
if test "${kernel_type}" = "image.ub"; then
sf read ${imageub_addr} ${kernel_offset} ${kernel_size};
bootm ${imageub_addr};
exit;
fi
if test "${kernel_type}" = "Image"; then
sf read ${kernel_addr} ${kernel_offset} ${kernel_size};
booti ${kernel_addr} - ${fdt_addr};
exit;
fi
exit;
fi
done

I think you are right with your mention that the build system doesn´t use the changes, because the guy from Tux Engineering wrote the same:

"...
Now somewhat redundantly, we need to inform u-boot again, where to find the bootscr partition offset, by modifying the following lines in recipes-bsp/u-boot/u-boot-zynq-scr.bbappend:
..."

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #17 on: January 19, 2021, 12:08:18 AM »
Hey John,

quick update because I got u-boot working, but I have to write the "boot.scr" script (and I don´t have any experience with it...).
I do the following steps (all with PetaLinux 2020.2 and Vivado 2020.2):

1) Create a new partition for the boot script:

Code: [Select]
$ petalinux-config
-> Subsystem AUTO Hardware Settings
   -> Flash Settings
      -> Partition 3
         -> Name = bootscr
         -> Size = 0x40000

2) Set the script address in u-boot

Code: [Select]
$ petalinux-config -c u-boot
-> ARM-Architecture
   -> Boot script offset = 0xFA0000

3) Create the boot script

Code: [Select]
fatload mmc 0 0x10000000 image.ub;
bootm 0x10000000;

4) Compile the boot script

Code: [Select]
mkimage -c none -A arm -T script -d boot.txt boot.scr

5) Build the project

Code: [Select]
$ petalinux-build
$ petalinux-package --force --boot --fsbl zynq_fsbl.elf --fpga system.bit --u-boot

6) Take u-boot, the FSBL, the compiled boot script and the bitstream and create your own "BOOT.bin"

Code: [Select]
//arch = zynq; split = false; format = BIN
the_ROM_image:
{
[bootloader]...\ZynqBerry\linux\zynq_fsbl.elf
...\ZynqBerry\linux\system.bit
...\ZynqBerry\linux\u-boot.elf
[offset = 0xFA0000]...\ZynqBerry\linux\boot.scr
}

Code: [Select]
$ bootgen -image .../ZynqBerry/linux/BootImage.bif -arch zynq -o .../ZynqBerry/linux/flash/BOOT.bin -w on

7) Load "BOOT.bin" into the flash

It´s not perfect, because my custom script needs to be used as default in PetaLinux and PetaLinux has to add this script to "BOOT.bin" at the given offset. This needs a little more research... (and yes, the u-boot script is very crappy...)

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #18 on: January 19, 2021, 06:54:05 AM »
Hi,
thanks for your additional notes.

I've test first U+ Zynq device with SD boot. In this case boot.src can be put on SD instead to put it into the boot.bin.

The Zynq on your TE0726 doesn't support primary SD boot, so Boot.bin must on SD, but secondary boot from SD is OK. Uboot has access to SD card, so I think put boot.scr on SD should also works. ---> Maybe you must remove the extra boot partion at first or ""CONFIG_BOOT_SCRIPT_OFFSET=0xFA000" from your uboot platform-top.h, this maybe force uboot to search on QSPI instead of SD card for boot.scr

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #19 on: January 19, 2021, 10:09:03 AM »
Hi John,

"...so Boot.bin must on SD..."

what do you mean? I thought "BOOT.bin" has to be placed in the flash because it contains the u-boot and the ZYNQ needs u-boot to access the SD card. And I don´t found any option to set the SD card as a source for "boot.scr". I can set the address for the script or enable the support for SD cards as boot medium, but I do not really know the difference when I enable this option, because u-boot already uses the SD card to load "image.ub".

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #20 on: January 19, 2021, 02:46:40 PM »
Hi,
Boot.bin into qspi flash (because the Zynq on the TE0726 can only boot from QSPI (Xilinx Zynq devices in CLG225 package do not support SD Card boot directly from ROM bootloader. Use QSPI for primary boot and SD for secondary boot (uboot) --> See Xilinx TRM))
image.ub and "boot.scr" can be put on the SD card.

--> I didn't test it on zynqberry until now but I would expect that it works.

I've test it only on a U+Zynq module which support SD boot  as primary boot (in this case I've put Boot.bin, image.ub and boot.scr on the SD card) and uboot has used the boot.scr from SD automatically.

br
John 

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #21 on: January 19, 2021, 03:22:10 PM »
Okay - I just wanted to ask, because you wrote "BOOT.bin" must be placed on the SD card in your post before :)

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #22 on: January 21, 2021, 07:26:43 AM »
Hi,
Quote
because you wrote "BOOT.bin" must be placed on the SD card i
I think this was a misunderstanding, sorry for confusion.
br
John

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #23 on: January 25, 2021, 09:36:21 AM »
Hi,
export changes from u-boot and kernel  config to the user layer can be done with:
"petalinux-devtool finish u-boot-xlnx ${PWD}/project-spec/meta-user/ -f"
"petalinux-devtool finish kernel-xlnx ${PWD}/project-spec/meta-user/ -f"

I've add some additional notes here:
https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart#PetaLinuxKICKstart-PetalinuxConfiguration
https://wiki.trenz-electronic.de/display/PD/Petalinux+Troubleshoot#PetalinuxTroubleshoot-Petalinux2020.2

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #24 on: January 26, 2021, 11:27:12 PM »
Hi John,

thank you. I will test it next week and report the result to you. Why do I have to export the changes to the user-layer? What are the next steps after doing this or is this just for you as feedback about the changes?
« Last Edit: January 26, 2021, 11:28:48 PM by kampi »

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #25 on: January 27, 2021, 07:03:54 AM »
Hi,
Quote
Why do I have to export the changes to the user-layer?
In case you need to change kernel or uboot setting or something else on your linux os. This depends on your design and application
br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #26 on: January 28, 2021, 07:18:20 PM »
Hello John,

okay I run "petalinux-config -c u-boot" first and then "petalinux-devtool finish u-boot-xlnx ${PWD}/project-spec/meta-user/ -f". Can you please explain to me a little bit deeper what the second command is doing? I´m not very experienced with the Yocto build system and the PetaLinux documentation doesn´t help me (because of my lack of experience...). Do I have to rebuild the image now?

Thank you :)

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #27 on: January 29, 2021, 06:56:14 AM »
Hi,
I think Xilinx will switch nearly completly to yocto with the next petalinux releases. This is probably also correct, and in the longer term this is the better solution. But leads to more processing steps for the end user.

So in the past user changes on uboot, kernel,  was directly saved in the user-layer and was used together with Xilinx default configuration and XSA import autoconfiguration. during the build process (petalinux-build ).

Now changes will be saved in the yocto developer folder, which will not be used on petalinux-build process. There are commands for devtool available to built it in the developer section --> see help of petalinux-devtool and general description for devtool.
petalinux-build will not use this temporary changes from the yocto developer folder, this must be exported to the user layer before.

I have little experience with Yocto myself, so I can't explain much more.


PS: yes you must rebuilt your images after you has done some changes.

br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #28 on: February 02, 2021, 10:22:24 PM »
Hey John,

I run the following steps:

1 )
Run
Code: [Select]
$ petalinux-config -c u-boot
2 )
Set the Boot script offset to 0xFA0000 and save the config

3 )
Run
Code: [Select]
$ petalinux-devtool finish u-boot-xlnx ${PWD}/project-spec/meta-user/ -f
INFO: Sourcing build tools
[INFO] Sourcing build environment
[INFO] Generating workspace directory
[INFO] devtool finish u-boot-xlnx /var/development/Git/ZynqBerry/MinimalLinux/petalinux/project-spec/meta-user/ -f
NOTE: Starting bitbake server...
Loading cache: 100% |#########################################################################################################################################################################################################| Time: 0:00:05
Loaded 4262 entries from dependency cache.
Parsing recipes: 100% |#######################################################################################################################################################################################################| Time: 0:00:23
Parsing of 2993 .bb files complete (2991 cached, 2 parsed). 4263 targets, 204 skipped, 0 masked, 0 errors.
INFO: Handling main branch (devtool)...
INFO: No patches or local source files needed updating
INFO: Handling branch devtool-override-pn-device-tree...
INFO: No patches or local source files needed updating
INFO: Cleaning sysroot for recipe u-boot-xlnx...
INFO: Leaving source tree /var/development/Git/ZynqBerry/MinimalLinux/petalinux/components/yocto/workspace/sources/u-boot-xlnx as-is; if you no longer need it then please delete it manually

4 )
Run
Code: [Select]
$ petalinux-config -c kernel
5 )
Don´t change anything and save the config

6 )
Run
Code: [Select]
petalinux-devtool finish kernel-xlnx ${PWD}/project-spec/meta-user/ -f
INFO: Sourcing build tools
[INFO] Sourcing build environment
[INFO] Generating workspace directory
[INFO] devtool finish kernel-xlnx /var/development/Git/ZynqBerry/MinimalLinux/petalinux/project-spec/meta-user/ -f
NOTE: Starting bitbake server...
ERROR: No recipe named 'kernel-xlnx' in your workspace

7 )
Run
Code: [Select]
$ petalinux-build
8 )
Use "boot.scr", "system.bit", "u-boot.elf" and "zynq_fsbl" with the following bif file
Code: [Select]
//arch = zynq; split = false; format = BIN
the_ROM_image:
{
[bootloaderZynqBerry\linux\zynq_fsbl.elf
ZynqBerry\linux\system.bit
ZynqBerry\linux\u-boot.elf
[offset = 0xFA0000]ZynqBerry\linux\boot.scr
}

to create "BOOT.bin"
Code: [Select]
bootgen -image BootImage.bif -arch zynq -o flash/BOOT.bin -w on

9 )
Use Vivado to copy the file into the flash of the ZynqBerry

10 )
Boot the device

Code: [Select]
U-Boot 2020.01 (Feb 02 2021 - 20:30:20 +0000)

CPU:   Zynq 7z010
Silicon: v3.1
DRAM:  ECC disabled 512 MiB
Flash: 0 Bytes
NAND:  0 MiB
MMC:   mmc@e0101000: 0
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Warning: SPI speed fallback to 100 kHz
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0xfa0000, size 0x40000
SF: 262144 bytes @ 0xfa0000 Read: OK
QSPI: Trying to boot script at 0x3000000
## Executing script at 03000000
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Offset exceeds device limit
sf - SPI flash sub-system

Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus
                                  and chip select
sf read addr offset|partition len       - read `len' bytes starting at
                                          `offset' or from start of mtd
                                          `partition'to memory at `addr'
sf write addr offset|partition len      - write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf erase offset|partition [+]len        - erase `len' bytes from `offset'
                                          or from start of mtd `partition'
                                         `+len' round up `len' to block size
sf update addr offset|partition len     - erase and write `len' bytes from memor                                                                                                                                                             y
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf protect lock/unlock sector len       - protect/unprotect 'len' bytes starting
                                          at address 'sector'

Wrong Image Format for bootm command
ERROR: can't get kernel image!
QSPI: SCRIPT FAILED: continuing...
JTAG: Trying to boot script at 0x3000000
## Executing script at 03000000
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Offset exceeds device limit
sf - SPI flash sub-system

Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus
                                  and chip select
sf read addr offset|partition len       - read `len' bytes starting at
                                          `offset' or from start of mtd
                                          `partition'to memory at `addr'
sf write addr offset|partition len      - write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf erase offset|partition [+]len        - erase `len' bytes from `offset'
                                          or from start of mtd `partition'
                                         `+len' round up `len' to block size
sf update addr offset|partition len     - erase and write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf protect lock/unlock sector len       - protect/unprotect 'len' bytes starting
                                          at address 'sector'

Wrong Image Format for bootm command
ERROR: can't get kernel image!
JTAG: SCRIPT FAILED: continuing...
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
MMC Device 1 not found
no mmc device at slot 1
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0xfa0000, size 0x40000
SF: 262144 bytes @ 0xfa0000 Read: OK
QSPI: Trying to boot script at 0x3000000
## Executing script at 03000000
SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Offset exceeds device limit
sf - SPI flash sub-system

Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus
                                  and chip select
sf read addr offset|partition len       - read `len' bytes starting at
                                          `offset' or from start of mtd
                                          `partition'to memory at `addr'
sf write addr offset|partition len      - write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf erase offset|partition [+]len        - erase `len' bytes from `offset'
                                          or from start of mtd `partition'
                                         `+len' round up `len' to block size
sf update addr offset|partition len     - erase and write `len' bytes from memory
                                          at `addr' to flash at `offset'
                                          or to start of mtd `partition'
sf protect lock/unlock sector len       - protect/unprotect 'len' bytes starting
                                          at address 'sector'

Wrong Image Format for bootm command
ERROR: can't get kernel image!
QSPI: SCRIPT FAILED: continuing...


no devices available
NAND: SCRIPT FAILED: continuing...
NOR: Trying to boot script at 0x3000000
## Executing script at 03000000
Wrong image format for "source" command
NOR: SCRIPT FAILED: continuing...
starting USB...
Bus usb@e0002000: USB EHCI 1.00
scanning bus usb@e0002000 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device

Device 1: unknown device
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-zynq-zynq
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-zynq
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
No ethernet found.
No ethernet found.
Zynq>

TL;DR: It doesn´t work without my custom script from below :(

Code: [Select]
fatload mmc 0 0x10000000 image.ub
bootm 0x10000000

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #29 on: February 03, 2021, 07:29:28 AM »
Hi,
when you didn't change anything on kernel, than you can also not export something with devtool to the user layer. devtool command must be only used in case you has changed something.

You should check your uboot environment which targets are defined:
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/749142017/Using+Distro+Boot+With+Xilinx+U-Boot#UsingDistroBootWithXilinxU-Boot-BootTargets

It looks like uboot has some default list and put depending on boot mode on the automatically as first boot medium, in case of Zynqmberry I would expect QSPI is at first.
When you open boot.sr with text editior than you see a loop where he checked all tarkets and if he get a hit he try to boot. You can also remove not used tarkets from boot.scr file

I've only tested U+ Device with SD boot until know, I will start with 7 series at next, but I caN#t tell you any timeline
br
John

kampi

  • Active Member
  • *
  • Posts: 22
Re: Building u-boot with PetaLinux for ZynqBerry
« Reply #30 on: February 03, 2021, 02:04:20 PM »

I've only tested U+ Device with SD boot until know, I will start with 7 series at next, but I caN#t tell you any timeline


Don´t hurry :). I have a working solution which is okay for the moment.