Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/2] boot/uboot: add support for custom zynq ps7_init_gpl.c
@ 2025-08-13 17:30 Neal Frager via buildroot
  2025-08-13 17:30 ` [Buildroot] [PATCH v3 2/2] boot/uboot: add cpu dependency to BR2_TARGET_UBOOT_ZYNQ Neal Frager via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Frager via buildroot @ 2025-08-13 17:30 UTC (permalink / raw)
  To: buildroot
  Cc: martin.chabot, michal.simek, Neal Frager, brandon.maier, ju.o,
	juju, thomas.petazzoni, luca.ceresoli

On Zynq, the booloader is responsible for some basic initializations, such as
enabling peripherals, DDR and configuring pinmuxes. The ps7_init_gpl.c file
(and optionally, ps7_init_gpl.h) contains the code for such initializations.

Although U-Boot contains ps7_init_gpl.c files for some boards, each of them
describes only one specific configuration. Users of a different board, or
needing a different configuration, can generate custom files using the Xilinx
Vivado development tools.

This patch adds Buildroot support for custom zynq ps7_init_gpl.c files in the
same way that is already done for zynqmp when working with custom hardware
that is not already supported by u-boot.

To test this feature, the following configs can be added to any zynq_defconfig:

BR2_TARGET_UBOOT_ZYNQ=y
BR2_TARGET_UBOOT_ZYNQ_PS7_INIT_FILE=<path to custom board ps7_init_gpl.c>

Signed-off-by: Neal Frager <neal.frager@amd.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Brandon Maier <brandon.maier@collins.com>
---
V1->V2:
- added step for enabling BR2_TARGET_UBOOT_ZYNQ in readme instructions
V2->V3:
- no changes so reviewers could be kept
---
 board/zynq/readme.txt | 21 +++++++++++----------
 boot/uboot/Config.in  | 34 ++++++++++++++++++++++++++++++++++
 boot/uboot/uboot.mk   | 12 ++++++++++++
 3 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/board/zynq/readme.txt b/board/zynq/readme.txt
index 87df7236f0..085f47b09b 100644
--- a/board/zynq/readme.txt
+++ b/board/zynq/readme.txt
@@ -71,17 +71,18 @@ you need to add them by yourself.
 1) Start with a defconfig supported by Buildroot (e.g. Zedboard)
     make zynq_zed_defconfig
 
-2) make uboot-menuconfig
-    Visit the following menu and enable CONFIG_XILINX_PS_INIT_FILE
+2) make menuconfig
+    Visit the following menu to enable BR2_TARGET_UBOOT_ZYNQ
 
-    ARM architecture  --->
-       [*] Zynq/ZynqMP PS init file(s) location
+    Bootloaders  --->
+       U-Boot  --->
+           [*]   Boot on the Xilinx Zynq SoCs
 
-3) Copy ps7_init_gpl.c/h generated by the Xilinx Vivado tools into
-   output/build/uboot-custom/board/xilinx/zynq/custom_hw_platform/
+3) make menuconfig
+    In the same menu, configure BR2_TARGET_UBOOT_ZYNQ_PS7_INIT_FILE
 
-4) make
+    Bootloaders  --->
+       U-Boot  --->
+          (<Path to ps7_init_gpl.c>) Custom ps7_init_gpl file
 
-Note: The files in step 3 will need to be re-copied after cleaning the
-output directory and at this time, there is no way to save them as
-part of the buildroot configuration, except as a U-Boot patch.
+4) make
diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index a2301b7747..adbe8d142d 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -701,6 +701,40 @@ config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE
 
 endif
 
+config BR2_TARGET_UBOOT_ZYNQ
+	bool "Boot on the Xilinx Zynq SoCs"
+	depends on BR2_arm
+	help
+	  Enable options specific to the Xilinx Zynq family of SoCs.
+
+config BR2_TARGET_UBOOT_ZYNQ_PS7_INIT_FILE
+	string "Custom ps7_init_gpl file"
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	depends on BR2_TARGET_UBOOT_ZYNQ
+	help
+	  On Zynq the booloader is responsible for some basic
+	  initializations, such as enabling peripherals and
+	  configuring pinmuxes. The ps7_init_gpl.c file (and,
+	  optionally, ps7_init_gpl.h) contains the code for such
+	  initializations.
+
+	  Although U-Boot contains ps7_init_gpl.c files for some
+	  boards, each of them describes only one specific
+	  configuration. Users of a different board, or needing a
+	  different configuration, can generate custom files using
+	  the Xilinx Vivado development tools.
+
+	  Set this variable to the path to your ps7_init_gpl.c file
+	  (e.g. "board/myboard/ps7_init_gpl.c"). ps7_init_gpl.h, if
+	  needed, should be in the same directory. U-Boot will build
+	  and link the user-provided file instead of the built-in.
+
+	  Leave empty to use the files provided by U-Boot.
+
+	  This feature requires commit
+	  6da4f67ad09cd8b311d77b2b04e557b7ef65b56c from upstream
+	  U-Boot, available from versions after 2018.07.
+
 config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC
 	bool "CRC image for Altera SoC FPGA (mkpimage)"
 	depends on BR2_arm
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 2796b0a310..c92568a559 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -520,6 +520,17 @@ endif
 
 endif # BR2_TARGET_UBOOT_ZYNQMP
 
+ifeq ($(BR2_TARGET_UBOOT_ZYNQ),y)
+UBOOT_ZYNQ_PS7_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQ_PS7_INIT_FILE))
+UBOOT_ZYNQ_PS7_INIT_PATH = $(shell readlink -f $(UBOOT_ZYNQ_PS7_INIT))
+
+ifneq ($(UBOOT_ZYNQ_PS7_INIT),)
+define UBOOT_ZYNQ_KCONFIG_PS7_INIT
+	$(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(UBOOT_ZYNQ_PS7_INIT_PATH)")
+endef
+endif
+endif # BR2_TARGET_UBOOT_ZYNQ
+
 define UBOOT_INSTALL_OMAP_IFT_IMAGE
 	cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/
 endef
@@ -562,6 +573,7 @@ define UBOOT_KCONFIG_FIXUP_CMDS
 	$(UBOOT_ZYNQMP_KCONFIG_PMUFW)
 	$(UBOOT_ZYNQMP_KCONFIG_PM_CFG)
 	$(UBOOT_ZYNQMP_KCONFIG_PSU_INIT)
+	$(UBOOT_ZYNQ_KCONFIG_PS7_INIT)
 	$(UBOOT_KCONFIG_DEFAULT_ENV_FILE)
 endef
 
-- 
2.25.1

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

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

* [Buildroot] [PATCH v3 2/2] boot/uboot: add cpu dependency to BR2_TARGET_UBOOT_ZYNQ
  2025-08-13 17:30 [Buildroot] [PATCH v3 1/2] boot/uboot: add support for custom zynq ps7_init_gpl.c Neal Frager via buildroot
@ 2025-08-13 17:30 ` Neal Frager via buildroot
  2025-08-29  8:09   ` Luca Ceresoli via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Frager via buildroot @ 2025-08-13 17:30 UTC (permalink / raw)
  To: buildroot
  Cc: martin.chabot, michal.simek, Neal Frager, brandon.maier, ju.o,
	juju, thomas.petazzoni, luca.ceresoli

This patch adds a BR2_cortex_a9 cpu dependency to BR2_TARGET_UBOOT_ZYNQ.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V3:
- New patch added to series
---
 boot/uboot/Config.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index adbe8d142d..756eb2b2fc 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -704,6 +704,7 @@ endif
 config BR2_TARGET_UBOOT_ZYNQ
 	bool "Boot on the Xilinx Zynq SoCs"
 	depends on BR2_arm
+	depends on BR2_cortex_a9
 	help
 	  Enable options specific to the Xilinx Zynq family of SoCs.
 
-- 
2.25.1

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

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

* Re: [Buildroot] [PATCH v3 2/2] boot/uboot: add cpu dependency to BR2_TARGET_UBOOT_ZYNQ
  2025-08-13 17:30 ` [Buildroot] [PATCH v3 2/2] boot/uboot: add cpu dependency to BR2_TARGET_UBOOT_ZYNQ Neal Frager via buildroot
@ 2025-08-29  8:09   ` Luca Ceresoli via buildroot
  2025-08-31 13:28     ` Frager, Neal via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Luca Ceresoli via buildroot @ 2025-08-29  8:09 UTC (permalink / raw)
  To: Neal Frager
  Cc: martin.chabot, buildroot, brandon.maier, ju.o, juju,
	thomas.petazzoni, michal.simek

Hello Neal,

On Wed, 13 Aug 2025 18:30:37 +0100
Neal Frager <neal.frager@amd.com> wrote:

> This patch adds a BR2_cortex_a9 cpu dependency to BR2_TARGET_UBOOT_ZYNQ.

The commit message should describe why, not what. What the patch does
is clearly visible in the diff. Why it does it need to to be clarified
in the commit message, e.g.:

  Zynq SoCs are all based on Cortex-A9, thus showing this option for
  other cores is useless.

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] 4+ messages in thread

* Re: [Buildroot] [PATCH v3 2/2] boot/uboot: add cpu dependency to BR2_TARGET_UBOOT_ZYNQ
  2025-08-29  8:09   ` Luca Ceresoli via buildroot
@ 2025-08-31 13:28     ` Frager, Neal via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Frager, Neal via buildroot @ 2025-08-31 13:28 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: martin.chabot@gmail.com, buildroot@buildroot.org,
	brandon.maier@collins.com, ju.o@free.fr, juju@cotds.org,
	thomas.petazzoni@bootlin.com, Simek, Michal

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Luca,

> This patch adds a BR2_cortex_a9 cpu dependency to BR2_TARGET_UBOOT_ZYNQ.

> The commit message should describe why, not what. What the patch does
> is clearly visible in the diff. Why it does it need to to be clarified
> in the commit message, e.g.:

>  Zynq SoCs are all based on Cortex-A9, thus showing this option for
>  other cores is useless.

Thank you for your feedback.  I will make a better commit message for v4.

I will also be more careful to use the imperative tense in my commit messages
from now on.

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

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

end of thread, other threads:[~2025-08-31 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 17:30 [Buildroot] [PATCH v3 1/2] boot/uboot: add support for custom zynq ps7_init_gpl.c Neal Frager via buildroot
2025-08-13 17:30 ` [Buildroot] [PATCH v3 2/2] boot/uboot: add cpu dependency to BR2_TARGET_UBOOT_ZYNQ Neal Frager via buildroot
2025-08-29  8:09   ` Luca Ceresoli via buildroot
2025-08-31 13:28     ` 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