Xilinx / meta-xilinx-tools

Yocto Project layer enables AMD Xilinx tools related metadata for MicroBlaze, Zynq, ZynqMP and Versal devices.
MIT License
53 stars 51 forks source link

generated boot.bin will not boot correctly after moving the bootbin recipe to meta-xilinx #37

Closed ghost closed 2 years ago

ghost commented 2 years ago

In the new scheme in rel-v2021.2 the main botbin recipe was moved to meta-xilinx. On the way several changes were made. The important one in our case is the removal of this line from the main recipe:

BIF_PARTITION_ATTR_zynqmp = "${@bb.utils.contains('MACHINE_FEATURES', 'fpga-overlay', 'fsbl pmu atf dtb u-boot', 'fsbl bitstream pmu atf dtb u-boot', d)}"

And replacing it in the bbappend with this line:

BIF_PARTITION_ATTR_append_zynqmp = "${@bb.utils.contains('MACHINE_FEATURES', 'fpga-overlay', '', ' bitstream', d)}"

Due to this change the system will not load past the PMU because a known bug listed here 68732 - 2017.1 Zynq UltraScale+ MPSoC, Boot Image fails to boot if bitstream is placed after ATF

As can be seen the old version places the bitstream correctly after the fsbl and before the pmu while the new version places it at the end causing boot to fail

Replacing the new line in the bbappend with the code below fixes the issue (It can probably be done more elegantly):

def add_bitstream_string (d):
    bifPartition = d.getVar("BIF_PARTITION_ATTR")
    if bifPartition is not None:
        fsblString = bb.utils.contains("MACHINE_FEATURES", "fpga-overlay", "fsbl", "fsbl bitstream", d)
        bifPartition = bifPartition.replace("fsbl", fsblString)
    return bifPartition

TEMP_zynqmp := "${@add_bitstream_string(d)}"
BIF_PARTITION_ATTR_zynqmp = "${TEMP_zynqmp}"
mhatle commented 2 years ago

Just wanted to update, we're currently investigating this and how best to resolve it. Thank you for the report. Until then, my recommendation is to hardcode the BIF_PARTITION_ATTR_forcevariable = "" in your project's local.conf file to the specific order you know works.

Livius90 commented 2 years ago

I tried the new Yocto 2021.2 release on ZCU104 board, but the FSBL boot is hanged on at PMU Firmware for infinity time. Is this issue is the same, what you discussing here?

mhatle commented 2 years ago

The order of the generated boot.bin components has the bitstream in the wrong place. We are currently working on a fix for the issue. Until then you'll need to just hard code the values for your configuration in your local.conf file. Such as:

BIF_PARTITION_ATTR_forcevariable = "fsbl pmu bitstream atf dtb u-boot"

The published rules indicate the FSBL & PMUFW should be first. Bitstream if included must be BEFORE the Arm Trusted Firmware, and the DTB needs to be before u-boot, with u-boot being after ATF.

ghost commented 2 years ago

@Livius90 I believe this is the same issue. You can either use the suggestion from @mhatle or you can try my resolution above (which works for me). I recommend using @mhatle 's suggestion as it doesn't involve changing the files provided by Xilinx

Livius90 commented 2 years ago

@mhatle Yocto is saying that nothing provides pmu, atf, u-boot and dtb in rel-v2021.2.

ghost commented 2 years ago

@Livius90 I didn't read @mhatle 's comment thoroughly enough. He has the name of the packages wrong for 2021.2 (They are correct for 2021.1) The configuration I am using is: fsbl bitstream pmufw arm-trusted-firmware device-tree u-boot-xlnx

As you can see the names changed for those packages. I am using the bitstream after the fsbl and before the pmufw because that is the way it was done in 2021.1. @mhatle suggests putting it after the pmufw. I guess you can try both ways.

Livius90 commented 2 years ago

I tested the following in local.conf: BIF_PARTITION_ATTR_forcevariable = "fsbl pmufw bitstream arm-trusted-firmware device-tree u-boot-xlnx"

Unfortunately my ZCU104 still can not booting with rel-v2021.2 Yocto. It is hanged on for infinity time after PMU_ROM version printing.

Xilinx Zynq MP First Stage Boot Loader
Release 2021.2   Oct 13 2021  -  07:15:53
PMU Firmware 2021.2     Oct 13 2021   07:15:53
PMU_ROM Version: xpbr-v8.1.0-0
ghost commented 2 years ago

@Livius90 Why don't you try the order I presented above? Put the bitstream after the fsbl and before the pmufw. If this doesn't work you can try and use the code I placed in the issue description (which does this automatically). I am using the ZCU106 but it should be the same. One other point which I assumed throughout is that you have a bit file embedded in the XSA file.

mhatle commented 2 years ago

Fix for this has been pushed to both meta-xilinx and meta-xilinx-tools (rel-v2021.2 branch). You MUST have both sides of the fix.

Livius90 commented 2 years ago

@mhatle Thanks the fix, i tried it and now my ZCU104 is not freezing on at PMU FW loading, nicely can start booting u-boot then Linux kernel.

But i have an other issue in release 2021.2, what was also present in 2021.1 and 2020.2, too. Can you take a look at to my other SD card booting issue? #38

Is it a good and relevant repo layer place to report it? Probably it can be an XSA problem from hdf-examples repo, where can i request to fix it in official way?

ghost commented 2 years ago

Tested the new commit and it works well. Thanks