[Buildroot] [PATCH v1 1/1] configs/zynqmp_kria_kv260_defconfig: use CONFIG_MULTI_DTB_FIT work around

Frager, Neal neal.frager at amd.com
Tue Dec 20 07:54:04 UTC 2022


Hi Luca,


> Le 20 déc. 2022 à 08:47, Luca Ceresoli <luca.ceresoli at bootlin.com> a écrit :
> 
> Hello Neal,
> 
>> On Fri, 16 Dec 2022 10:00:44 +0000
>> Neal Frager <neal.frager at amd.com> wrote:
>> 
>> Change work around for kv260 u-boot.itb. Uses CONFIG_MULTI_DTB_FIT for fit-dtb.blob generation.
>> Adds a delay between fit-dtb.blob generation and building the u-boot.itb due to a build issue
>> when using the buildroot compiler.
>> 
>> This work around will eventually be replaced when Xilinx u-boot migrates to binman.
>> 
>> Signed-off-by: Neal Frager <neal.frager at amd.com>
>> ---
>> board/zynqmp/kria/kv260/kv260.sh              |  2 +-
>> ...ile-add-delay-for-buildroot-compiler.patch | 33 +++++++++++++++++++
>> board/zynqmp/kria/uboot.fragment              |  1 +
>> configs/zynqmp_kria_kv260_defconfig           |  1 +
>> 4 files changed, 36 insertions(+), 1 deletion(-)
>> create mode 100644 board/zynqmp/kria/patches/uboot/v1-0001-Makefile-add-delay-for-buildroot-compiler.patch
>> 
>> diff --git a/board/zynqmp/kria/kv260/kv260.sh b/board/zynqmp/kria/kv260/kv260.sh
>> index e891852009..e3467f3068 100755
>> --- a/board/zynqmp/kria/kv260/kv260.sh
>> +++ b/board/zynqmp/kria/kv260/kv260.sh
>> @@ -8,5 +8,5 @@
>> 
>> UBOOT_DIR=$4
>> 
>> -fdtoverlay -o ${UBOOT_DIR}/arch/arm/dts/zynqmp-smk-k26-revA.dtb -i ${UBOOT_DIR}/arch/arm/dts/zynqmp-smk-k26-revA.dtb ${UBOOT_DIR}/arch/arm/dts/zynqmp-sck-kv-g-revB.dtbo
>> +fdtoverlay -o ${UBOOT_DIR}/fit-dtb.blob -i ${UBOOT_DIR}/arch/arm/dts/zynqmp-smk-k26-revA.dtb ${UBOOT_DIR}/arch/arm/dts/zynqmp-sck-kv-g-revB.dtbo
>> ${UBOOT_DIR}/tools/mkimage -E -f ${UBOOT_DIR}/u-boot.its -B 0x8 ${BINARIES_DIR}/u-boot.itb
>> diff --git a/board/zynqmp/kria/patches/uboot/v1-0001-Makefile-add-delay-for-buildroot-compiler.patch b/board/zynqmp/kria/patches/uboot/v1-0001-Makefile-add-delay-for-buildroot-compiler.patch
>> new file mode 100644
>> index 0000000000..391fa861bd
>> --- /dev/null
>> +++ b/board/zynqmp/kria/patches/uboot/v1-0001-Makefile-add-delay-for-buildroot-compiler.patch
>> @@ -0,0 +1,33 @@
>> +From 582b52bef69219df678ed04771eb643117cd094a Mon Sep 17 00:00:00 2001
>> +From: Neal Frager <neal.frager at amd.com>
>> +Date: Fri, 16 Dec 2022 08:35:41 +0000
>> +Subject: [PATCH v1 1/1] Makefile: add delay for buildroot compiler
>> +
>> +When using the buildroot compiler, it builds the u-boot.itb immediately
>> +after building the fit-dtb.blob.  This causes a build failure when using
>> +the CONFIG_MULTI_DTB_FIT build configuration.  This patch forces a minimal
>> +delay before building the u-boot.itb which works around the problem.
>> +
>> +This patch has not been submitted to u-boot mainline as it is a work around
>> +and not a proper solution.
>> +
>> +Signed-off-by: Neal Frager <neal.frager at amd.com>
>> +---
>> + Makefile | 1 +
>> + 1 file changed, 1 insertion(+)
>> +
>> +diff --git a/Makefile b/Makefile
>> +index b96e2ffa15..0d3e33704d 100644
>> +--- a/Makefile
>> ++++ b/Makefile
>> +@@ -1426,6 +1426,7 @@ ifdef U_BOOT_ITS
>> + u-boot.itb: u-boot-nodtb.bin \
>> +        $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \
>> +        $(U_BOOT_ITS) FORCE
>> ++    sleep 1
>> +    $(call if_changed,mkfitimage)
>> +    $(BOARD_SIZE_CHECK)
>> + endif
> 
> I didn't study the current source code to understand the issue, however
> the 'sleep 1' here seems a pretty bad hack and not necessarily solving
> the problem in all cases.
> 
> As Michal wrote, dependencies must be enforced via makefile rules. Any
> reason this cannot be done in this situation?
> 

Using the Xilinx compiler, the build order of u-boot is not the same as with the buildroot compiler and I do not understand why.

With the Xilinx compiler, the fit-dtb.blob is built, then the spl gets built and the u-boot.itb does not get generated until the very end.  Thanks to this order, everything is fine with the Xilinx compiler.

When using the buildroot compiler, it attempts to build the u-boot.itb immediately after building the fit-dtb.blob.  This problem started when buildroot updated to compiler 11.3 as it was building fine before.

Even though the fit-dtb.blob is still built before the u-boot.itb, the buildroot compiler complains that the fit-dtb.blob does not exist yet and errors out.  Subsequent builds work just fine because the fit-dtb.blob already exists.

By adding the “sleep 1”, it is indeed a hack, but it forces there to be time between the fit-dtb.blob build and the u-boot.itb build when using the buildroot compiler.  It is not a good solution, but it solves the problem.

I am happy to take any ideas for a better solution!

> -- 
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Best regards,
Neal Frager
AMD


More information about the buildroot mailing list