boot/xilinx-prebuilt: support custom boards using XSA

The xilinx-prebuilt package only supports development boards that Xilinx
has published firmware for. Custom designs based on the Xilinx platform
must generate their own firmware using the AMD Vivado Design Suite.

Vivado produces an XSA file, which is a Zip file containing all the
firmware needed by xilinx-prebuilt. We extend xilinx-prebuilt to
download custom XSA files and extract their contents.

Reviewed-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Brandon Maier <brandon.maier@collins.com>
[Romain: add a comment about the custom PSMFW file name.]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
This commit is contained in:
Brandon Maier
2024-07-01 16:48:43 +00:00
committed by Romain Naour
parent 1fb08cdc85
commit 1dcb311afe
2 changed files with 50 additions and 3 deletions

View File

@@ -31,6 +31,30 @@ config BR2_TARGET_XILINX_PREBUILT_VERSAL
endchoice
config BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
bool "download a prebuilt Versal XSA"
depends on BR2_TARGET_XILINX_PREBUILT_VERSAL
help
The Xilinx Support Archive (XSA) provides custom Xilinx
firmware files generated by the AMD Vivado Design Suite.
https://docs.amd.com/r/en-US/ug1400-vitis-embedded/Creating-a-Hardware-Design-XSA-File
if BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
config BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA_LOCATION
string "URL of custom XSA"
help
This option allows to specify a URL pointing to an XSA source
file. This URL can use any protocol recognized by Buildroot,
like http://, ftp://, file:// or scp://.
When pointing to a local XSA using file://, you may want to
use a make variable like $(TOPDIR) to reference the root of
the Buildroot tree.
endif # BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
config BR2_TARGET_XILINX_PREBUILT_FAMILY
string
default "zynqmp" if BR2_TARGET_XILINX_PREBUILT_ZYNQMP

View File

@@ -5,9 +5,20 @@
################################################################################
XILINX_PREBUILT_VERSION = $(call qstrip,$(BR2_TARGET_XILINX_PREBUILT_VERSION))
ifeq ($(BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA),y)
XILINX_PREBUILT_FILE = $(call qstrip,$(BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA_LOCATION))
XILINX_PREBUILT_SITE = $(patsubst %/,%,$(dir $(XILINX_PREBUILT_FILE)))
XILINX_PREBUILT_SOURCE = $(notdir $(XILINX_PREBUILT_FILE))
define XILINX_PREBUILT_EXTRACT_CMDS
$(UNZIP) $(XILINX_PREBUILT_DL_DIR)/$(XILINX_PREBUILT_SOURCE) -d $(@D)
endef
else # BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
XILINX_PREBUILT_SITE = $(call github,Xilinx,soc-prebuilt-firmware,$(XILINX_PREBUILT_VERSION))
XILINX_PREBUILT_LICENSE = MIT
XILINX_PREBUILT_LICENSE_FILES = LICENSE
endif # BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
XILINX_PREBUILT_INSTALL_TARGET = NO
XILINX_PREBUILT_INSTALL_IMAGES = YES
@@ -20,12 +31,24 @@ ifeq ($(BR2_TARGET_XILINX_PREBUILT_VERSAL),y)
# We need the *.pdi glob, because the file has different names for the
# different boards, but there is only one, and it has to be named
# vpl_gen_fixed.pdi when installed.
ifeq ($(BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA),y)
XILINX_PREBUILT_PLM = $(@D)/pdi_files/gen_files/plm.elf
# Unlike the psmfw.elf file for Xilinx development boards,
# AMD Vivado Design Suite generates a file named psm_fw.elf.
XILINX_PREBUILT_PSMFW = $(@D)/pdi_files/static_files/psm_fw.elf
XILINX_PREBUILT_PDI = $(@D)/*.pdi
else # BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
XILINX_PREBUILT_PLM = $(XILINX_PREBUILT_BOARD_DIR)/plm.elf
XILINX_PREBUILT_PSMFW = $(XILINX_PREBUILT_BOARD_DIR)/psmfw.elf
XILINX_PREBUILT_PDI = $(XILINX_PREBUILT_BOARD_DIR)/*.pdi
endif # BR2_TARGET_XILINX_PREBUILT_VERSAL_XSA
define XILINX_PREBUILT_INSTALL
$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/plm.elf \
$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_PLM) \
$(BINARIES_DIR)/plm.elf
$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/psmfw.elf \
$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_PSMFW) \
$(BINARIES_DIR)/psmfw.elf
$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_PDI) \
$(BINARIES_DIR)/vpl_gen_fixed.pdi
endef
else # BR2_TARGET_XILINX_PREBUILT_VERSAL