Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1 1/1] boot/xilinx-prebuilt: simplify family logic
@ 2025-09-29  7:00 Neal Frager via buildroot
  2025-09-30 11:07 ` Luca Ceresoli via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Frager via buildroot @ 2025-09-29  7:00 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, yann.morin, brandon.maier,
	ju.o, Neal Frager, thomas.petazzoni, romain.naour, michal.simek,
	romain.naour

Currently, the xilinx-prebuilt package uses an if-then-else statement for
deciding which files need to be installed from the xilinx-prebuilt repo. This
works fine for now because there are really only two options, either versal or
zynqmp/kria.

Starting with the xilinx_v2025.2 release, the versal2 family along with the
vek385 board will be added to Buildroot and thus the xilinx-prebuilt package
as well. In the future, additional families will also probably be added to
this package.

To avoid creating a long if-then-else-then-else statement which will only grow
in complexity over time, simplify the logic of the xilinx-prebuilt package by
giving each xilinx family its own if statement. In the long term, this will
make the xilinx-prebuilt package easier to understand and maintain.

For this reason, this patch moves the zynqmp/kria families from the "else"
statement to having their own if statement.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 boot/xilinx-prebuilt/xilinx-prebuilt.mk | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/boot/xilinx-prebuilt/xilinx-prebuilt.mk b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
index 5d984c4f82..54f31f7ddb 100644
--- a/boot/xilinx-prebuilt/xilinx-prebuilt.mk
+++ b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
@@ -103,21 +103,32 @@ define XILINX_PREBUILT_INSTALL_VERSAL_PSMFW
 		$(BINARIES_DIR)/psmfw.elf
 endef
 endif # !BR2_TARGET_XILINX_EMBEDDEDSW_VERSAL_PSMFW
+endif # BR2_TARGET_XILINX_PREBUILT_VERSAL
+
+ifeq ($(BR2_TARGET_XILINX_PREBUILT_KRIA),y)
+ifneq ($(BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW),y)
+define XILINX_PREBUILT_INSTALL_KRIA_PMUFW
+	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
+		$(BINARIES_DIR)/pmufw.elf
+endef
+endif # !BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW
+endif # BR2_TARGET_XILINX_PREBUILT_KRIA
 
-else # BR2_TARGET_XILINX_PREBUILT_VERSAL
+ifeq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP),y)
 ifneq ($(BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW),y)
 define XILINX_PREBUILT_INSTALL_ZYNQMP_PMUFW
 	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
 		$(BINARIES_DIR)/pmufw.elf
 endef
 endif # !BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW
-endif # BR2_TARGET_XILINX_PREBUILT_VERSAL
+endif # BR2_TARGET_XILINX_PREBUILT_ZYNQMP
 
 define XILINX_PREBUILT_INSTALL_IMAGES_CMDS
 	$(XILINX_PREBUILT_INSTALL_VERSAL_PLM)
 	$(XILINX_PREBUILT_INSTALL_VERSAL_PSMFW)
 	$(XILINX_PREBUILT_INSTALL_VERSAL_BOOT_PDI)
 	$(XILINX_PREBUILT_INSTALL_VERSAL_XSA_BOOT_PDI)
+	$(XILINX_PREBUILT_INSTALL_KRIA_PMUFW)
 	$(XILINX_PREBUILT_INSTALL_ZYNQMP_PMUFW)
 endef
 
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH v1 1/1] boot/xilinx-prebuilt: simplify family logic
  2025-09-29  7:00 [Buildroot] [PATCH v1 1/1] boot/xilinx-prebuilt: simplify family logic Neal Frager via buildroot
@ 2025-09-30 11:07 ` Luca Ceresoli via buildroot
  2025-09-30 12:33   ` Frager, Neal via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Ceresoli via buildroot @ 2025-09-30 11:07 UTC (permalink / raw)
  To: Neal Frager
  Cc: yann.morin, ibai.erkiaga-elorza, buildroot, brandon.maier, ju.o,
	thomas.petazzoni, romain.naour, michal.simek, romain.naour

Hello Neal,

On Mon, 29 Sep 2025 08:00:52 +0100
Neal Frager <neal.frager@amd.com> wrote:

> Currently, the xilinx-prebuilt package uses an if-then-else statement for
> deciding which files need to be installed from the xilinx-prebuilt repo. This
> works fine for now because there are really only two options, either versal or
> zynqmp/kria.
> 
> Starting with the xilinx_v2025.2 release, the versal2 family along with the
> vek385 board will be added to Buildroot and thus the xilinx-prebuilt package
> as well. In the future, additional families will also probably be added to
> this package.
> 
> To avoid creating a long if-then-else-then-else statement which will only grow
> in complexity over time, simplify the logic of the xilinx-prebuilt package by
> giving each xilinx family its own if statement. In the long term, this will
> make the xilinx-prebuilt package easier to understand and maintain.

OK for splitting the if/then construct which is not very readable as of
now.

> For this reason, this patch moves the zynqmp/kria families from the "else"
> statement to having their own if statement.

Not sure about this, see below.

> --- a/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> +++ b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> @@ -103,21 +103,32 @@ define XILINX_PREBUILT_INSTALL_VERSAL_PSMFW
>  		$(BINARIES_DIR)/psmfw.elf
>  endef
>  endif # !BR2_TARGET_XILINX_EMBEDDEDSW_VERSAL_PSMFW
> +endif # BR2_TARGET_XILINX_PREBUILT_VERSAL
> +
> +ifeq ($(BR2_TARGET_XILINX_PREBUILT_KRIA),y)
> +ifneq ($(BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW),y)
> +define XILINX_PREBUILT_INSTALL_KRIA_PMUFW
> +	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
> +		$(BINARIES_DIR)/pmufw.elf
> +endef
> +endif # !BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW
> +endif # BR2_TARGET_XILINX_PREBUILT_KRIA
>  
> -else # BR2_TARGET_XILINX_PREBUILT_VERSAL
> +ifeq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP),y)
>  ifneq ($(BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW),y)
>  define XILINX_PREBUILT_INSTALL_ZYNQMP_PMUFW
>  	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
>  		$(BINARIES_DIR)/pmufw.elf
>  endef
>  endif # !BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW
> -endif # BR2_TARGET_XILINX_PREBUILT_VERSAL
> +endif # BR2_TARGET_XILINX_PREBUILT_ZYNQMP

zynqmp and kria are doing the same thing (normal, as kria is a zynqmp),
so those are duplicated function. Unless you expect them to become
different, then I'd leave them as a single function. One of these
should work:

ifeq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP)$(BR2_TARGET_XILINX_PREBUILT_KRIA),y)
...
endif

ifneq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP)$(BR2_TARGET_XILINX_PREBUILT_KRIA),)
...
endif

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH v1 1/1] boot/xilinx-prebuilt: simplify family logic
  2025-09-30 11:07 ` Luca Ceresoli via buildroot
@ 2025-09-30 12:33   ` Frager, Neal via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Frager, Neal via buildroot @ 2025-09-30 12:33 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: yann.morin@orange.com, Erkiaga Elorza, Ibai,
	buildroot@buildroot.org, brandon.maier@collins.com, ju.o@free.fr,
	thomas.petazzoni@bootlin.com, romain.naour@smile.fr,
	Simek, Michal, romain.naour@gmail.com

[AMD Official Use Only - AMD Internal Distribution Only]

Hello Luca,

> Currently, the xilinx-prebuilt package uses an if-then-else statement for
> deciding which files need to be installed from the xilinx-prebuilt repo. This
> works fine for now because there are really only two options, either versal or
> zynqmp/kria.
>
> Starting with the xilinx_v2025.2 release, the versal2 family along with the
> vek385 board will be added to Buildroot and thus the xilinx-prebuilt package
> as well. In the future, additional families will also probably be added to
> this package.
>
> To avoid creating a long if-then-else-then-else statement which will only grow
> in complexity over time, simplify the logic of the xilinx-prebuilt package by
> giving each xilinx family its own if statement. In the long term, this will
> make the xilinx-prebuilt package easier to understand and maintain.

> OK for splitting the if/then construct which is not very readable as of
> now.

Agreed.

> For this reason, this patch moves the zynqmp/kria families from the "else"
> statement to having their own if statement.

> Not sure about this, see below.

Yes, you are right.

> --- a/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> +++ b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> @@ -103,21 +103,32 @@ define XILINX_PREBUILT_INSTALL_VERSAL_PSMFW
>               $(BINARIES_DIR)/psmfw.elf
>  endef
>  endif # !BR2_TARGET_XILINX_EMBEDDEDSW_VERSAL_PSMFW
> +endif # BR2_TARGET_XILINX_PREBUILT_VERSAL
> +
> +ifeq ($(BR2_TARGET_XILINX_PREBUILT_KRIA),y)
> +ifneq ($(BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW),y)
> +define XILINX_PREBUILT_INSTALL_KRIA_PMUFW
> +     $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
> +             $(BINARIES_DIR)/pmufw.elf
> +endef
> +endif # !BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW
> +endif # BR2_TARGET_XILINX_PREBUILT_KRIA
>
> -else # BR2_TARGET_XILINX_PREBUILT_VERSAL
> +ifeq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP),y)
>  ifneq ($(BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW),y)
>  define XILINX_PREBUILT_INSTALL_ZYNQMP_PMUFW
>       $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
>               $(BINARIES_DIR)/pmufw.elf
>  endef
>  endif # !BR2_TARGET_XILINX_EMBEDDEDSW_ZYNQMP_PMUFW
> -endif # BR2_TARGET_XILINX_PREBUILT_VERSAL
> +endif # BR2_TARGET_XILINX_PREBUILT_ZYNQMP

> zynqmp and kria are doing the same thing (normal, as kria is a zynqmp),
> so those are duplicated function. Unless you expect them to become
> different, then I'd leave them as a single function. One of these
> should work:

zynqmp and kria will always be the same.

> ifeq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP)$(BR2_TARGET_XILINX_PREBUILT_KRIA),y)
> ...
> endif

I will give this one a try.

> ifneq ($(BR2_TARGET_XILINX_PREBUILT_ZYNQMP)$(BR2_TARGET_XILINX_PREBUILT_KRIA),)
>...
> endif

Thanks for your help!

Best regards,
Neal Frager
AMD
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-30 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29  7:00 [Buildroot] [PATCH v1 1/1] boot/xilinx-prebuilt: simplify family logic Neal Frager via buildroot
2025-09-30 11:07 ` Luca Ceresoli via buildroot
2025-09-30 12:33   ` Frager, Neal via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox