[RFC PATCH] tools: zynqmp: add build script and documentation for ZynqMP KV260

Jerome Forissier jerome.forissier at linaro.org
Fri Jun 13 15:07:11 CEST 2025



On 6/13/25 14:50, Michal Simek wrote:
> 
> 
> On 6/13/25 14:30, Jerome Forissier wrote:
>> Hi Michal,
>>
>> On 6/13/25 09:59, Michal Simek wrote:
>>>
>>>
>>> On 6/13/25 09:38, Jerome Forissier wrote:
>>>>
>>>>
>>>> On 6/12/25 18:49, Tom Rini wrote:
>>>>> On Thu, Jun 12, 2025 at 05:32:41PM +0200, Jerome Forissier wrote:
>>>>>
>>>>>> Add a script to help build a functional U-Boot binary for the ZynqMP
>>>>>> Kria KV260. Also add some documentation.
>>>>>>
>>>>>> Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
>>>>>> ---
>>>>>>
>>>>>>    doc/board/xilinx/index.rst        |  1 +
>>>>>>    doc/board/xilinx/zynqmp-kv260.rst | 27 +++++++++
>>>>>>    tools/zynqmp_kv260_build.sh       | 43 ++++++++++++++
>>>>>>    tools/zynqmp_pmufw_elf_convert.py | 96 +++++++++++++++++++++++++++++++
>>>>>>    4 files changed, 167 insertions(+)
>>>>>>    create mode 100644 doc/board/xilinx/zynqmp-kv260.rst
>>>>>>    create mode 100755 tools/zynqmp_kv260_build.sh
>>>>>>    create mode 100755 tools/zynqmp_pmufw_elf_convert.py
>>>>>
>>>>> Helper build scripts don't belong in the tools directory. If they're
>>>>> super helpful, I don't object to adding them to
>>>>> u-boot-extras/contrib/<you>/ directory.
>>>>
>>>> OK
>>>>
>>>>> But there's a number of
>>>>> documented examples already on checkout and build TF-A then do ... for
>>>>> your platform.
>>>>
>>>> There is doc/board/xilinx/zynqmp.rst which deals with quite few ZynqMP
>>>> boards but not the KV260. In addition, it has a number of shortcomings:
>>>> - It mentions pmu.bin but does not say where to get if from
>>>> - It doesn't say how to build TF-A (bl31.bin), some very specific build
>>>> options are needed.
>>>> - I consider that detailed build instructions belong in things called
>>>> scripts or Makefiles, that were invented long ago exactly for that
>>>> purpose :) IMO the documentation should tell the bare minimum and ideally
>>>> be unnecessary.
>>>>
>>>> I am not particularly proud of the fact that I spent more than a whole
>>>> day trying to get U-Boot master to boot on my KV260, and without the help
>>>> of Michal, no doubt I would still be trying... So, how about I submit the
>>>> zynqmp_kv260_build.sh script to the u-boot-extras/contrib/<me>/ directory
>>>> and just point to it in doc/board/xilinx/zynqmp.rst?
>>>
>>> no issue from my side.
>>
>> OK so here you go:
>>
>>  From a429f6563fc5f1433a2df8eabe6a42a98864701b Mon Sep 17 00:00:00 2001
>> From: Jerome Forissier <jerome.forissier at linaro.org>
>> Date: Fri, 13 Jun 2025 13:39:10 +0200
>> Subject: [PATCH] contrib/jforissier: add zynqmp_kv260_build.sh
>>
>> Add a build script for the AMD/Xilinx ZynqMP Kria KV260 board.
>>
>> Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
>> ---
>>   contrib/jforissier/zynqmp_kv260_build.sh | 42 ++++++++++++++++++++++++
>>   1 file changed, 42 insertions(+)
>>   create mode 100755 contrib/jforissier/zynqmp_kv260_build.sh
>>
>> diff --git a/contrib/jforissier/zynqmp_kv260_build.sh b/contrib/jforissier/zynqmp_kv260_build.sh
>> new file mode 100755
>> index 0000000..967c946
>> --- /dev/null
>> +++ b/contrib/jforissier/zynqmp_kv260_build.sh
>> @@ -0,0 +1,42 @@
>> +#!/bin/bash
>> +# SPDX-License-Identifier: GPL-2.0+
>> +#
>> +# Copyright (C) 2025 Linaro Ltd.
>> +
>> +set -ex
>> +
>> +if [ "$1" == "-c" ]; then
>> +  # Clean: remove downloaded/converted files
>> +  rm -f bl31.elf bl31.bin pmufw.elf pmufw.bin zynqmp_fsbl.elf pmu_obj.bin
>> +  exit 0
>> +fi
>> +[ -e bl31.bin ] || {
>> +  wget https://github.com/Xilinx/soc-prebuilt-firmware/raw/refs/heads/xlnx_rel_v2025.1/kv260-kria/bl31.elf
> 
> I would create one variable to keep xlnx_rel_v2025.1 string that you can change one location to get new versions.

OK

> 
>> +  aarch64-linux-gnu-objcopy -O binary bl31.elf bl31.bin
>> +  BL31_LOAD_ADDR=$(aarch64-linux-gnu-readelf -l bl31.elf | awk '/Entry point/ { print $3 }')
> 
> here you have bug. Your script works fine on the first run.
> 
> You can try this
> ./zynqmp_kv260_build.sh
> make mrproper
> ./zynqmp_kv260_build.sh
> 
> and look at
> CONFIG_BL31_LOAD_ADDR
> 
> you are all the time getting default Kconfig address which is wrong.

I've moved the BL31_LOAD_ADDR assignment to the block that appends to
the .config. I have also split things out a bit more. Here is the new
version:


>From d7b8c46f2b4d60080d33ea481bf23df5a4b510be Mon Sep 17 00:00:00 2001
From: Jerome Forissier <jerome.forissier at linaro.org>
Date: Fri, 13 Jun 2025 13:39:10 +0200
Subject: [PATCH] contrib/jforissier: add zynqmp_kv260_build.sh

Add a build script for the AMD/Xilinx ZynqMP Kria KV260 board.

Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
---
 contrib/jforissier/zynqmp_kv260_build.sh | 37 ++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100755 contrib/jforissier/zynqmp_kv260_build.sh

diff --git a/contrib/jforissier/zynqmp_kv260_build.sh b/contrib/jforissier/zynqmp_kv260_build.sh
new file mode 100755
index 0000000..83daf73
--- /dev/null
+++ b/contrib/jforissier/zynqmp_kv260_build.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2025 Linaro Ltd.
+
+set -ex
+
+if [ "$1" == "-c" ]; then
+  # Clean: remove downloaded/converted files
+  rm -f bl31.elf bl31.bin pmufw.elf pmufw.bin zynqmp_fsbl.elf pmu_obj.bin
+  exit 0
+fi
+XLNX_REL=xlnx_rel_v2025.1
+[ -e bl31.elf ] || wget https://github.com/Xilinx/soc-prebuilt-firmware/raw/refs/heads/${XLNX_REL}/kv260-kria/bl31.elf
+[ -e bl31.bin ] || aarch64-linux-gnu-objcopy -O binary bl31.elf bl31.bin
+[ -e pmufw.elf ] || wget https://github.com/Xilinx/soc-prebuilt-firmware/raw/refs/heads/${XLNX_REL}/kv260-kria/pmufw.elf
+[ -e pmufw.bin ] || llvm-objcopy -O binary pmufw.elf pmufw.bin
+[ -e zynqmp_fsbl.elf ] || wget https://github.com/Xilinx/soc-prebuilt-firmware/raw/refs/heads/${XLNX_REL}/kv260-kria/zynqmp_fsbl.elf
+[ -e pmu_obj.bin ] || aarch64-linux-gnu-objcopy --dump-section .sys_cfg_data=pmu_obj.bin zynqmp_fsbl.elf
+[ -e .config ] || {
+  BL31_LOAD_ADDR=$(aarch64-linux-gnu-readelf -l bl31.elf | awk '/Entry point/ { print $3 }')
+  make xilinx_zynqmp_kria_defconfig
+  cat << EOF >> .config
+CONFIG_PMUFW_INIT_FILE="pmufw.bin"
+CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE="pmu_obj.bin"
+CONFIG_BL31_LOAD_ADDR=${BL31_LOAD_ADDR}
+CONFIG_BL32_LOAD_ADDR=0
+EOF
+}
+export BL31=bl31.bin
+export BL32=
+export TEE=
+export CROSS_COMPILE=aarch64-linux-gnu-
+make -j$(nproc) BINMAN_ALLOW_MISSING=1
+set +x
+echo Build was successful:
+ls -l qspi.bin
-- 
2.43.0


Thanks,
-- 
Jerome


More information about the U-Boot mailing list