boot/uboot: add support for custom zynq ps7_init_gpl.c

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>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Neal Frager
2025-08-31 14:35:25 +01:00
committed by Julien Olivain
parent 78d58820a5
commit 98b57fafdf
3 changed files with 57 additions and 10 deletions

View File

@@ -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
Bootloaders --->
U-Boot --->
(<Path to ps7_init_gpl.c>) Custom ps7_init_gpl file
4) make
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.

View File

@@ -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

View File

@@ -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