Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package
@ 2024-06-18  7:49 Neal Frager via buildroot
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source Neal Frager via buildroot
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Neal Frager via buildroot @ 2024-06-18  7:49 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, brandon.maier,
	thomas.petazzoni, Neal Frager, michal.simek, yann.morin.1998

This patch adds a new boot package for building boot firmware for Xilinx
versal, zynqmp and kria targets.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V2:
- add make dependency to be sure bare-metal toolchain is built before trying
  to use the toolchain for building the xilinx-source firmware
V2->V3:
- fix copy paste error that causes build failure
---
 DEVELOPERS                            |  1 +
 boot/Config.in                        |  1 +
 boot/xilinx-source/Config.in          | 45 +++++++++++++++++
 boot/xilinx-source/xilinx-source.hash |  2 +
 boot/xilinx-source/xilinx-source.mk   | 70 +++++++++++++++++++++++++++
 5 files changed, 119 insertions(+)
 create mode 100644 boot/xilinx-source/Config.in
 create mode 100644 boot/xilinx-source/xilinx-source.hash
 create mode 100644 boot/xilinx-source/xilinx-source.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 8bfd36f1d8..adfd9520ea 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2340,6 +2340,7 @@ F:	board/xilinx/
 F:	board/zynq/
 F:	board/zynqmp/
 F:	boot/xilinx-prebuilt/
+F:	boot/xilinx-source/
 F:	configs/versal_vck190_defconfig
 F:	configs/zynq_zc702_defconfig
 F:	configs/zynq_zc706_defconfig
diff --git a/boot/Config.in b/boot/Config.in
index 25a50265d2..da22f15e8a 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -22,5 +22,6 @@ source "boot/ti-k3-r5-loader/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
 source "boot/xilinx-prebuilt/Config.in"
+source "boot/xilinx-source/Config.in"
 
 endmenu
diff --git a/boot/xilinx-source/Config.in b/boot/xilinx-source/Config.in
new file mode 100644
index 0000000000..bf87ff4178
--- /dev/null
+++ b/boot/xilinx-source/Config.in
@@ -0,0 +1,45 @@
+config BR2_TARGET_XILINX_SOURCE
+	bool "xilinx-source"
+	depends on BR2_aarch64
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  Build boot firmware from source for Xilinx boards.
+
+	  https://github.com/Xilinx/embeddedsw
+
+comment "xilinx-source needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"
+
+if BR2_TARGET_XILINX_SOURCE
+
+config BR2_TARGET_XILINX_SOURCE_VERSION
+	string "source version"
+	default "xilinx_v2024.1"
+	help
+	  Release version of Xilinx firmware.
+	  Must be xilinx_v2023.1 or newer.
+
+choice
+	bool "family variant"
+	default BR2_TARGET_XILINX_SOURCE_ZYNQMP
+
+config BR2_TARGET_XILINX_SOURCE_ZYNQMP
+	bool "zynqmp"
+	depends on !BR2_TARGET_XILINX_PREBUILT
+
+config BR2_TARGET_XILINX_SOURCE_KRIA
+	bool "kria"
+	depends on !BR2_TARGET_XILINX_PREBUILT
+
+config BR2_TARGET_XILINX_SOURCE_VERSAL
+	bool "versal"
+	depends on BR2_TARGET_XILINX_PREBUILT
+
+endchoice
+
+config BR2_TARGET_XILINX_SOURCE_USER_CFLAGS
+	string "optional user cflags"
+	help
+	  Add optional config flags when building xilinx boot firmware.
+
+endif # BR2_TARGET_XILINX_SOURCE
diff --git a/boot/xilinx-source/xilinx-source.hash b/boot/xilinx-source/xilinx-source.hash
new file mode 100644
index 0000000000..ed6a165574
--- /dev/null
+++ b/boot/xilinx-source/xilinx-source.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  733fdb09b2525c1fa322242b97f015122aaf9e32530a824dec71d6328be83850  xilinx-source-xilinx_v2024.1.tar.gz
diff --git a/boot/xilinx-source/xilinx-source.mk b/boot/xilinx-source/xilinx-source.mk
new file mode 100644
index 0000000000..4352b07eed
--- /dev/null
+++ b/boot/xilinx-source/xilinx-source.mk
@@ -0,0 +1,70 @@
+################################################################################
+#
+# xilinx-source
+#
+################################################################################
+
+XILINX_SOURCE_VERSION = $(call qstrip,$(BR2_TARGET_XILINX_SOURCE_VERSION))
+XILINX_SOURCE_SITE = $(call github,Xilinx,embeddedsw,$(XILINX_SOURCE_VERSION))
+XILINX_SOURCE_LICENSE = MIT
+XILINX_SOURCE_LICENSE_FILES = LICENSE
+XILINX_SOURCE_INSTALL_TARGET = NO
+XILINX_SOURCE_INSTALL_IMAGES = YES
+XILINX_SOURCE_DEPENDENCIES = toolchain-bare-metal-buildroot
+
+XILINX_SOURCE_USER_CFLAGS = $(call qstrip,$(BR2_TARGET_XILINX_SOURCE_USER_CFLAGS))
+ifeq ($(BR2_TARGET_XILINX_SOURCE_KRIA),y)
+XILINX_SOURCE_CFLAGS = "-Os -flto -ffat-lto-objects -DK26_SOM $(XILINX_SOURCE_USER_CFLAGS)"
+else
+XILINX_SOURCE_CFLAGS = "-Os -flto -ffat-lto-objects $(XILINX_SOURCE_USER_CFLAGS)"
+endif
+
+ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
+define XILINX_SOURCE_BUILD_VERSAL
+	$(MAKE) -C $(@D)/lib/sw_apps/versal_plm/src/versal \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(XILINX_SOURCE_CFLAGS)
+		
+	$(MAKE) -C $(@D)/lib/sw_apps/versal_psmfw/src/versal \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(XILINX_SOURCE_CFLAGS)
+endef
+else # BR2_TARGET_XILINX_SOURCE_VERSAL
+define XILINX_SOURCE_BUILD_OTHERS
+	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(XILINX_SOURCE_CFLAGS)
+endef
+endif # BR2_TARGET_XILINX_SOURCE_VERSAL
+
+define XILINX_SOURCE_BUILD_CMDS
+	$(XILINX_SOURCE_BUILD_VERSAL)
+	$(XILINX_SOURCE_BUILD_OTHERS)
+endef
+
+ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
+define XILINX_SOURCE_INSTALL_VERSAL
+	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/versal_plm/src/versal/plm.elf \
+		$(BINARIES_DIR)/plm.elf
+	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/versal_psmfw/src/versal/psmfw.elf \
+		$(BINARIES_DIR)/psmfw.elf
+endef
+else # BR2_TARGET_XILINX_SOURCE_VERSAL
+define XILINX_SOURCE_INSTALL_OTHERS
+	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf \
+		$(BINARIES_DIR)/pmufw.elf
+endef
+endif # BR2_TARGET_XILINX_SOURCE_VERSAL
+
+define XILINX_SOURCE_INSTALL_IMAGES_CMDS
+	$(XILINX_SOURCE_INSTALL_VERSAL)
+	$(XILINX_SOURCE_INSTALL_OTHERS)
+endef
+
+$(eval $(generic-package))
-- 
2.25.1

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

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

* [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source
  2024-06-18  7:49 [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Neal Frager via buildroot
@ 2024-06-18  7:49 ` Neal Frager via buildroot
  2024-06-28  9:32   ` Luca Ceresoli via buildroot
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 3/4] boot/uboot.mk: new zynqmp pmufw source option Neal Frager via buildroot
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Neal Frager via buildroot @ 2024-06-18  7:49 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, brandon.maier,
	thomas.petazzoni, Neal Frager, michal.simek, yann.morin.1998

This patch wires up the xilinx-prebuilt with xilinx-source.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V3:
- no changes
---
 boot/xilinx-prebuilt/Config.in          |  3 +++
 boot/xilinx-prebuilt/xilinx-prebuilt.mk | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/boot/xilinx-prebuilt/Config.in b/boot/xilinx-prebuilt/Config.in
index d3df1c06e7..34b89337fa 100644
--- a/boot/xilinx-prebuilt/Config.in
+++ b/boot/xilinx-prebuilt/Config.in
@@ -22,12 +22,15 @@ choice
 
 config BR2_TARGET_XILINX_PREBUILT_ZYNQMP
 	bool "zynqmp"
+	depends on !BR2_TARGET_XILINX_SOURCE
 
 config BR2_TARGET_XILINX_PREBUILT_KRIA
 	bool "kria"
+	depends on !BR2_TARGET_XILINX_SOURCE
 
 config BR2_TARGET_XILINX_PREBUILT_VERSAL
 	bool "versal"
+	depends on BR2_PACKAGE_HOST_BOOTGEN
 
 endchoice
 
diff --git a/boot/xilinx-prebuilt/xilinx-prebuilt.mk b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
index eb78ed10cd..4cb3e2a33e 100644
--- a/boot/xilinx-prebuilt/xilinx-prebuilt.mk
+++ b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
@@ -18,8 +18,17 @@ XILINX_PREBUILT_BOARD_DIR = $(@D)/$(XILINX_PREBUILT_BOARD)-$(XILINX_PREBUILT_FAM
 
 ifeq ($(BR2_TARGET_XILINX_PREBUILT_VERSAL),y)
 # We need the *.pdi glob, because the file has different names for the
-# different boards, but htere is only one, and it has to be named
+# different boards, but there is only one, and it has to be named
 # vpl_gen_fixed.pdi when installed.
+
+ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
+# The plm.elf and psmfw.elf images will come from xilinx-source, so only
+# the *.pdi needs to be installed.
+define XILINX_PREBUILT_INSTALL_VERSAL
+	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
+		$(BINARIES_DIR)/vpl_gen_fixed.pdi
+endef
+else # BR2_TARGET_XILINX_SOURCE_VERSAL
 define XILINX_PREBUILT_INSTALL_VERSAL
 	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/plm.elf \
 		$(BINARIES_DIR)/plm.elf
@@ -28,6 +37,8 @@ define XILINX_PREBUILT_INSTALL_VERSAL
 	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
 		$(BINARIES_DIR)/vpl_gen_fixed.pdi
 endef
+endif # BR2_TARGET_XILINX_SOURCE_VERSAL
+
 else # BR2_TARGET_XILINX_PREBUILT_VERSAL
 define XILINX_PREBUILT_INSTALL_OTHERS
 	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/pmufw.elf \
-- 
2.25.1

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

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

* [Buildroot] [PATCH v3 3/4] boot/uboot.mk: new zynqmp pmufw source option
  2024-06-18  7:49 [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Neal Frager via buildroot
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source Neal Frager via buildroot
@ 2024-06-18  7:49 ` Neal Frager via buildroot
  2024-06-28  9:32   ` Luca Ceresoli via buildroot
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 4/4] configs/zynqmp|versal: migrate to xilinx-source Neal Frager via buildroot
  2024-06-28  9:32 ` [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Luca Ceresoli via buildroot
  3 siblings, 1 reply; 9+ messages in thread
From: Neal Frager via buildroot @ 2024-06-18  7:49 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, brandon.maier,
	thomas.petazzoni, Neal Frager, michal.simek, yann.morin.1998

The new BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option will enable u-boot to
use the xilinx-source package for building a pmufw.elf that gets included
in the generated boot.bin.

If the BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option is enabled, then the
BR2_TARGET_UBOOT_ZYNQMP_PMUFW config for downloading a prebuilt pmufw will
be ignored.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V3:
- no changes
---
 boot/uboot/Config.in | 20 +++++++++++++++++++-
 boot/uboot/uboot.mk  |  3 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index f37040a28a..3aef222772 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -512,9 +512,12 @@ config BR2_TARGET_UBOOT_ZYNQMP
 
 if BR2_TARGET_UBOOT_ZYNQMP
 
+choice
+	bool "pmufw.elf prebuilt or source"
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+
 config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
 	bool "xilinx-prebuilt pmufw.elf"
-	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
 	depends on BR2_TARGET_XILINX_PREBUILT_ZYNQMP || BR2_TARGET_XILINX_PREBUILT_KRIA
 	help
 	  Use xilinx-prebuilt boot package for downloading prebuilt
@@ -525,10 +528,25 @@ config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
 	  by the ZynqMP boot ROM) containing both the U-Boot SPL and the
 	  PMU firmware in the Xilinx-specific boot format.
 
+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
+	bool "xilinx-source pmufw.elf"
+	depends on BR2_TARGET_XILINX_SOURCE_ZYNQMP || BR2_TARGET_XILINX_SOURCE_KRIA
+	help
+	  Use xilinx-source boot package for building
+	  zynqmp pmufw.elf from
+	    https://github.com/Xilinx/embeddedsw repo.
+
+	  U-Boot build process will generate a boot.bin (to be loaded by
+	  by the ZynqMP boot ROM) containing both the U-Boot SPL and the
+	  PMU firmware in the Xilinx-specific boot format.	  
+
+endchoice
+
 config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
 	string "Custom PMU firmware location"
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
 	depends on !BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
+	depends on !BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
 	help
 	  Location of a PMU firmware binary.
 
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 19f4cdb557..837cb01f68 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -439,6 +439,9 @@ ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)
 ifeq ($(BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT),y)
 UBOOT_DEPENDENCIES += xilinx-prebuilt
 UBOOT_ZYNQMP_PMUFW_PATH = $(BINARIES_DIR)/pmufw.elf
+else ifeq ($(BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE),y)
+UBOOT_DEPENDENCIES += xilinx-source
+UBOOT_ZYNQMP_PMUFW_PATH = $(BINARIES_DIR)/pmufw.elf
 else
 UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW))
 
-- 
2.25.1

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

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

* [Buildroot] [PATCH v3 4/4] configs/zynqmp|versal: migrate to xilinx-source
  2024-06-18  7:49 [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Neal Frager via buildroot
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source Neal Frager via buildroot
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 3/4] boot/uboot.mk: new zynqmp pmufw source option Neal Frager via buildroot
@ 2024-06-18  7:49 ` Neal Frager via buildroot
  2024-06-28  9:32 ` [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Luca Ceresoli via buildroot
  3 siblings, 0 replies; 9+ messages in thread
From: Neal Frager via buildroot @ 2024-06-18  7:49 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, brandon.maier,
	thomas.petazzoni, Neal Frager, michal.simek, yann.morin.1998

Migrate one defconfig from kria, zynqmp and versal to xilinx-source.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
Comment: This can be used just for testing the xilinx-source patch set or we
can commit this patch.  My preference would be to move all zynqmp, kria and
versal defconfigs to xilinx-source, but I know this comes at a significant
build time penalty, so I am ok with leaving the example defconfigs on
xilinx-prebuilt.  Up to the buildroot maintainers to decide.
---
 configs/versal_vck190_defconfig     |  5 +++++
 configs/zynqmp_kria_kv260_defconfig | 11 ++++++-----
 configs/zynqmp_zcu106_defconfig     | 10 ++++++----
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/configs/versal_vck190_defconfig b/configs/versal_vck190_defconfig
index 21dfe2577a..3a1a8be688 100644
--- a/configs/versal_vck190_defconfig
+++ b/configs/versal_vck190_defconfig
@@ -35,9 +35,14 @@ BR2_TARGET_UBOOT_FORMAT_DTB=y
 BR2_TARGET_XILINX_PREBUILT=y
 BR2_TARGET_XILINX_PREBUILT_VERSION="xilinx_v2024.1"
 BR2_TARGET_XILINX_PREBUILT_VERSAL=y
+BR2_TARGET_XILINX_SOURCE=y
+BR2_TARGET_XILINX_SOURCE_VERSION="xilinx_v2024.1"
+BR2_TARGET_XILINX_SOURCE_VERSAL=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
 BR2_PACKAGE_HOST_BOOTGEN=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
 BR2_GLOBAL_PATCH_DIR="board/xilinx/patches"
diff --git a/configs/zynqmp_kria_kv260_defconfig b/configs/zynqmp_kria_kv260_defconfig
index a16da66e38..82ebf2e247 100644
--- a/configs/zynqmp_kria_kv260_defconfig
+++ b/configs/zynqmp_kria_kv260_defconfig
@@ -31,16 +31,17 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/kria/kv260/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
-BR2_TARGET_XILINX_PREBUILT=y
-BR2_TARGET_XILINX_PREBUILT_VERSION="xilinx_v2024.1"
-BR2_TARGET_XILINX_PREBUILT_BOARD="kv260"
-BR2_TARGET_XILINX_PREBUILT_KRIA=y
+BR2_TARGET_XILINX_SOURCE=y
+BR2_TARGET_XILINX_SOURCE_VERSION="xilinx_v2024.1"
+BR2_TARGET_XILINX_SOURCE_KRIA=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
 BR2_GLOBAL_PATCH_DIR="board/xilinx/patches"
diff --git a/configs/zynqmp_zcu106_defconfig b/configs/zynqmp_zcu106_defconfig
index c10ec70ed8..89269dfb5b 100644
--- a/configs/zynqmp_zcu106_defconfig
+++ b/configs/zynqmp_zcu106_defconfig
@@ -30,15 +30,17 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu106/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
-BR2_TARGET_XILINX_PREBUILT=y
-BR2_TARGET_XILINX_PREBUILT_VERSION="xilinx_v2024.1"
-BR2_TARGET_XILINX_PREBUILT_BOARD="zcu106"
+BR2_TARGET_XILINX_SOURCE=y
+BR2_TARGET_XILINX_SOURCE_VERSION="xilinx_v2024.1"
+BR2_TARGET_XILINX_SOURCE_ZYNQMP=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
 BR2_GLOBAL_PATCH_DIR="board/xilinx/patches"
-- 
2.25.1

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

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

* Re: [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package
  2024-06-18  7:49 [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Neal Frager via buildroot
                   ` (2 preceding siblings ...)
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 4/4] configs/zynqmp|versal: migrate to xilinx-source Neal Frager via buildroot
@ 2024-06-28  9:32 ` Luca Ceresoli via buildroot
  2024-06-28 12:40   ` Frager, Neal via buildroot
  3 siblings, 1 reply; 9+ messages in thread
From: Luca Ceresoli via buildroot @ 2024-06-28  9:32 UTC (permalink / raw)
  To: Neal Frager
  Cc: ibai.erkiaga-elorza, brandon.maier, thomas.petazzoni, buildroot,
	michal.simek, yann.morin.1998

Hello Neal,

On Tue, 18 Jun 2024 08:49:19 +0100
Neal Frager <neal.frager@amd.com> wrote:

> This patch adds a new boot package for building boot firmware for Xilinx
> versal, zynqmp and kria targets.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> V1->V2:
> - add make dependency to be sure bare-metal toolchain is built before trying
>   to use the toolchain for building the xilinx-source firmware
> V2->V3:
> - fix copy paste error that causes build failure
> ---
>  DEVELOPERS                            |  1 +
>  boot/Config.in                        |  1 +
>  boot/xilinx-source/Config.in          | 45 +++++++++++++++++
>  boot/xilinx-source/xilinx-source.hash |  2 +
>  boot/xilinx-source/xilinx-source.mk   | 70 +++++++++++++++++++++++++++
>  5 files changed, 119 insertions(+)
>  create mode 100644 boot/xilinx-source/Config.in
>  create mode 100644 boot/xilinx-source/xilinx-source.hash
>  create mode 100644 boot/xilinx-source/xilinx-source.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 8bfd36f1d8..adfd9520ea 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2340,6 +2340,7 @@ F:	board/xilinx/
>  F:	board/zynq/
>  F:	board/zynqmp/
>  F:	boot/xilinx-prebuilt/
> +F:	boot/xilinx-source/
>  F:	configs/versal_vck190_defconfig
>  F:	configs/zynq_zc702_defconfig
>  F:	configs/zynq_zc706_defconfig
> diff --git a/boot/Config.in b/boot/Config.in
> index 25a50265d2..da22f15e8a 100644
> --- a/boot/Config.in
> +++ b/boot/Config.in
> @@ -22,5 +22,6 @@ source "boot/ti-k3-r5-loader/Config.in"
>  source "boot/uboot/Config.in"
>  source "boot/vexpress-firmware/Config.in"
>  source "boot/xilinx-prebuilt/Config.in"
> +source "boot/xilinx-source/Config.in"
>  
>  endmenu
> diff --git a/boot/xilinx-source/Config.in b/boot/xilinx-source/Config.in
> new file mode 100644
> index 0000000000..bf87ff4178
> --- /dev/null
> +++ b/boot/xilinx-source/Config.in
> @@ -0,0 +1,45 @@
> +config BR2_TARGET_XILINX_SOURCE
> +	bool "xilinx-source"
> +	depends on BR2_aarch64
> +	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
> +	help
> +	  Build boot firmware from source for Xilinx boards.
> +
> +	  https://github.com/Xilinx/embeddedsw

It would be useful to add here a few words about what gets built and why
versal requires BR2_TARGET_XILINX_PREBUILT while zynqmp and kria require
!BR2_TARGET_XILINX_PREBUILT.

> +comment "xilinx-source needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
> +	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"
> +
> +if BR2_TARGET_XILINX_SOURCE
> +
> +config BR2_TARGET_XILINX_SOURCE_VERSION
> +	string "source version"
> +	default "xilinx_v2024.1"
> +	help
> +	  Release version of Xilinx firmware.
> +	  Must be xilinx_v2023.1 or newer.
> +
> +choice
> +	bool "family variant"
> +	default BR2_TARGET_XILINX_SOURCE_ZYNQMP
> +
> +config BR2_TARGET_XILINX_SOURCE_ZYNQMP
> +	bool "zynqmp"
> +	depends on !BR2_TARGET_XILINX_PREBUILT
> +
> +config BR2_TARGET_XILINX_SOURCE_KRIA
> +	bool "kria"
> +	depends on !BR2_TARGET_XILINX_PREBUILT
> +
> +config BR2_TARGET_XILINX_SOURCE_VERSAL
> +	bool "versal"
> +	depends on BR2_TARGET_XILINX_PREBUILT
> +
> +endchoice
> +
> +config BR2_TARGET_XILINX_SOURCE_USER_CFLAGS
> +	string "optional user cflags"
> +	help
> +	  Add optional config flags when building xilinx boot firmware.
> +
> +endif # BR2_TARGET_XILINX_SOURCE
> diff --git a/boot/xilinx-source/xilinx-source.hash b/boot/xilinx-source/xilinx-source.hash
> new file mode 100644
> index 0000000000..ed6a165574
> --- /dev/null
> +++ b/boot/xilinx-source/xilinx-source.hash
> @@ -0,0 +1,2 @@
> +# Locally calculated
> +sha256  733fdb09b2525c1fa322242b97f015122aaf9e32530a824dec71d6328be83850  xilinx-source-xilinx_v2024.1.tar.gz
> diff --git a/boot/xilinx-source/xilinx-source.mk b/boot/xilinx-source/xilinx-source.mk
> new file mode 100644
> index 0000000000..4352b07eed
> --- /dev/null
> +++ b/boot/xilinx-source/xilinx-source.mk
> @@ -0,0 +1,70 @@
> +################################################################################
> +#
> +# xilinx-source
> +#
> +################################################################################
> +
> +XILINX_SOURCE_VERSION = $(call qstrip,$(BR2_TARGET_XILINX_SOURCE_VERSION))
> +XILINX_SOURCE_SITE = $(call github,Xilinx,embeddedsw,$(XILINX_SOURCE_VERSION))
> +XILINX_SOURCE_LICENSE = MIT
> +XILINX_SOURCE_LICENSE_FILES = LICENSE
> +XILINX_SOURCE_INSTALL_TARGET = NO
> +XILINX_SOURCE_INSTALL_IMAGES = YES
> +XILINX_SOURCE_DEPENDENCIES = toolchain-bare-metal-buildroot
> +
> +XILINX_SOURCE_USER_CFLAGS = $(call qstrip,$(BR2_TARGET_XILINX_SOURCE_USER_CFLAGS))
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_KRIA),y)
> +XILINX_SOURCE_CFLAGS = "-Os -flto -ffat-lto-objects -DK26_SOM $(XILINX_SOURCE_USER_CFLAGS)"
> +else
> +XILINX_SOURCE_CFLAGS = "-Os -flto -ffat-lto-objects $(XILINX_SOURCE_USER_CFLAGS)"
> +endif
> +
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
> +define XILINX_SOURCE_BUILD_VERSAL
> +	$(MAKE) -C $(@D)/lib/sw_apps/versal_plm/src/versal \
> +		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
> +		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		CFLAGS=$(XILINX_SOURCE_CFLAGS)
> +		
> +	$(MAKE) -C $(@D)/lib/sw_apps/versal_psmfw/src/versal \
> +		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
> +		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		CFLAGS=$(XILINX_SOURCE_CFLAGS)
> +endef
> +else # BR2_TARGET_XILINX_SOURCE_VERSAL
> +define XILINX_SOURCE_BUILD_OTHERS
> +	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
> +		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
> +		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		CFLAGS=$(XILINX_SOURCE_CFLAGS)
> +endef
> +endif # BR2_TARGET_XILINX_SOURCE_VERSAL
> +
> +define XILINX_SOURCE_BUILD_CMDS
> +	$(XILINX_SOURCE_BUILD_VERSAL)
> +	$(XILINX_SOURCE_BUILD_OTHERS)

We are always building either for versal or for "others", so only one
of these two variables is ever defined. So you could use only one
variable name (XILINX_SOURCE_BUILD?), or even define directly
XILINX_SOURCE_BUILD_CMDS inside the ifeq/else/endif clause above.

> +endef
> +
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
> +define XILINX_SOURCE_INSTALL_VERSAL
> +	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/versal_plm/src/versal/plm.elf \
> +		$(BINARIES_DIR)/plm.elf
> +	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/versal_psmfw/src/versal/psmfw.elf \
> +		$(BINARIES_DIR)/psmfw.elf
> +endef
> +else # BR2_TARGET_XILINX_SOURCE_VERSAL
> +define XILINX_SOURCE_INSTALL_OTHERS
> +	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf \
> +		$(BINARIES_DIR)/pmufw.elf
> +endef
> +endif # BR2_TARGET_XILINX_SOURCE_VERSAL
> +
> +define XILINX_SOURCE_INSTALL_IMAGES_CMDS
> +	$(XILINX_SOURCE_INSTALL_VERSAL)
> +	$(XILINX_SOURCE_INSTALL_OTHERS)

As above.

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

* Re: [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source Neal Frager via buildroot
@ 2024-06-28  9:32   ` Luca Ceresoli via buildroot
  2024-06-28 12:50     ` Frager, Neal via buildroot
  0 siblings, 1 reply; 9+ messages in thread
From: Luca Ceresoli via buildroot @ 2024-06-28  9:32 UTC (permalink / raw)
  To: Neal Frager
  Cc: ibai.erkiaga-elorza, brandon.maier, thomas.petazzoni, buildroot,
	michal.simek, yann.morin.1998

On Tue, 18 Jun 2024 08:49:20 +0100
Neal Frager <neal.frager@amd.com> wrote:

> This patch wires up the xilinx-prebuilt with xilinx-source.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> V1->V3:
> - no changes
> ---
>  boot/xilinx-prebuilt/Config.in          |  3 +++
>  boot/xilinx-prebuilt/xilinx-prebuilt.mk | 13 ++++++++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/xilinx-prebuilt/Config.in b/boot/xilinx-prebuilt/Config.in
> index d3df1c06e7..34b89337fa 100644
> --- a/boot/xilinx-prebuilt/Config.in
> +++ b/boot/xilinx-prebuilt/Config.in
> @@ -22,12 +22,15 @@ choice
>  
>  config BR2_TARGET_XILINX_PREBUILT_ZYNQMP
>  	bool "zynqmp"
> +	depends on !BR2_TARGET_XILINX_SOURCE
>  
>  config BR2_TARGET_XILINX_PREBUILT_KRIA
>  	bool "kria"
> +	depends on !BR2_TARGET_XILINX_SOURCE
>  
>  config BR2_TARGET_XILINX_PREBUILT_VERSAL
>  	bool "versal"
> +	depends on BR2_PACKAGE_HOST_BOOTGEN

Is this bootgen line unrelated to this series? It appears as something
that was needed before and it is being fixed now. If it is the case,
then it should be a separate patch.

Also, I don't like very much how the "family variant" will look like if
we apply this patch. Now if enabling both xilinx-prebuilt and
xilinx-source we will have one "family variant" choice for each. And if
host-bootgen is enabled, the one for xilinx-prebuilt has no selectable
options, which looks very weird.

I'm not sure what is the best thing to do here, but it seems wrong to
have two selectable variants where having different values does not
make sense. What about moving the "family variant" choice before the
two packages and use it for both?

> diff --git a/boot/xilinx-prebuilt/xilinx-prebuilt.mk b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> index eb78ed10cd..4cb3e2a33e 100644
> --- a/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> +++ b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> @@ -18,8 +18,17 @@ XILINX_PREBUILT_BOARD_DIR = $(@D)/$(XILINX_PREBUILT_BOARD)-$(XILINX_PREBUILT_FAM
>  
>  ifeq ($(BR2_TARGET_XILINX_PREBUILT_VERSAL),y)
>  # We need the *.pdi glob, because the file has different names for the
> -# different boards, but htere is only one, and it has to be named
> +# different boards, but there is only one, and it has to be named
>  # vpl_gen_fixed.pdi when installed.
> +
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
> +# The plm.elf and psmfw.elf images will come from xilinx-source, so only
> +# the *.pdi needs to be installed.
> +define XILINX_PREBUILT_INSTALL_VERSAL
> +	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
> +		$(BINARIES_DIR)/vpl_gen_fixed.pdi

These two lines are a duplicate of...

> +endef
> +else # BR2_TARGET_XILINX_SOURCE_VERSAL
>  define XILINX_PREBUILT_INSTALL_VERSAL
>  	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/plm.elf \
>  		$(BINARIES_DIR)/plm.elf
> @@ -28,6 +37,8 @@ define XILINX_PREBUILT_INSTALL_VERSAL
>  	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
>  		$(BINARIES_DIR)/vpl_gen_fixed.pdi

...these two lines. It's not a big deal, but I'd consider defining once
the lines for the pdi and conditionally the other two lines:

# if BR2_TARGET_XILINX_SOURCE_VERSAL=y the plm.elf and psmfw.elf images
# will come from xilinx-source, so only the *.pdi needs to be installed.
ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),)
define XILINX_PREBUILT_INSTALL_VERSAL_PLM_PSMFW
        $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/plm.elf \
                $(BINARIES_DIR)/plm.elf
        $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/psmfw.elf \
                $(BINARIES_DIR)/psmfw.elf
endef
endif # !BR2_TARGET_XILINX_SOURCE_VERSAL

define XILINX_PREBUILT_INSTALL_VERSAL_PDI
        $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
                $(BINARIES_DIR)/vpl_gen_fixed.pdi
#endef

...

define XILINX_PREBUILT_INSTALL_IMAGES_CMDS
        $(XILINX_PREBUILT_INSTALL_VERSAL_PLM_PSMFW)
        $(XILINX_PREBUILT_INSTALL_VERSAL_PDI)
        $(XILINX_PREBUILT_INSTALL_OTHERS)
endef

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

* Re: [Buildroot] [PATCH v3 3/4] boot/uboot.mk: new zynqmp pmufw source option
  2024-06-18  7:49 ` [Buildroot] [PATCH v3 3/4] boot/uboot.mk: new zynqmp pmufw source option Neal Frager via buildroot
@ 2024-06-28  9:32   ` Luca Ceresoli via buildroot
  0 siblings, 0 replies; 9+ messages in thread
From: Luca Ceresoli via buildroot @ 2024-06-28  9:32 UTC (permalink / raw)
  To: Neal Frager
  Cc: ibai.erkiaga-elorza, brandon.maier, thomas.petazzoni, buildroot,
	michal.simek, yann.morin.1998

On Tue, 18 Jun 2024 08:49:21 +0100
Neal Frager <neal.frager@amd.com> wrote:

> The new BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option will enable u-boot to
> use the xilinx-source package for building a pmufw.elf that gets included
> in the generated boot.bin.
> 
> If the BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option is enabled, then the
> BR2_TARGET_UBOOT_ZYNQMP_PMUFW config for downloading a prebuilt pmufw will
> be ignored.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> V1->V3:
> - no changes
> ---
>  boot/uboot/Config.in | 20 +++++++++++++++++++-
>  boot/uboot/uboot.mk  |  3 +++
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index f37040a28a..3aef222772 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -512,9 +512,12 @@ config BR2_TARGET_UBOOT_ZYNQMP
>  
>  if BR2_TARGET_UBOOT_ZYNQMP
>  
> +choice
> +	bool "pmufw.elf prebuilt or source"

I find this string not very clear. It should rather look more like
"PMUFW origin", or "Origin of pmufw.elf".

But what is more confusing is the available choice options. With some
combinations of BR2_TARGET_XILINX_PREBUILT, BR2_TARGET_XILINX_SOURCE
and the family variant, we get no selectable options for this choice,
which is very awkward.

If the choice has no selectable options, then it should just disappear.
In its place you might instead put something like:

  comment "both xilinx-source and xilinx-prebuilt disabled, you need to
    pass a valid pmufw"

just before BR2_TARGET_UBOOT_ZYNQMP_PMUFW.

> +	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
> +
>  config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
>  	bool "xilinx-prebuilt pmufw.elf"
> -	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
>  	depends on BR2_TARGET_XILINX_PREBUILT_ZYNQMP || BR2_TARGET_XILINX_PREBUILT_KRIA
>  	help
>  	  Use xilinx-prebuilt boot package for downloading prebuilt
> @@ -525,10 +528,25 @@ config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
>  	  by the ZynqMP boot ROM) containing both the U-Boot SPL and the
>  	  PMU firmware in the Xilinx-specific boot format.
>  
> +config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
> +	bool "xilinx-source pmufw.elf"
> +	depends on BR2_TARGET_XILINX_SOURCE_ZYNQMP || BR2_TARGET_XILINX_SOURCE_KRIA
> +	help
> +	  Use xilinx-source boot package for building
> +	  zynqmp pmufw.elf from
> +	    https://github.com/Xilinx/embeddedsw repo.
> +
> +	  U-Boot build process will generate a boot.bin (to be loaded by
> +	  by the ZynqMP boot ROM) containing both the U-Boot SPL and the
> +	  PMU firmware in the Xilinx-specific boot format.	  
> +
> +endchoice
> +
>  config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
>  	string "Custom PMU firmware location"
>  	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
>  	depends on !BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
> +	depends on !BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE

Very strange: with this patch, when both
BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT and
BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE are =y,
BR2_TARGET_UBOOT_ZYNQMP_PMUFW becomes visible. This looks like a
kconfig/menuconfig bug and certainly not a bug in your patch, but maybe
you can have a deeper look?

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

* Re: [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package
  2024-06-28  9:32 ` [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Luca Ceresoli via buildroot
@ 2024-06-28 12:40   ` Frager, Neal via buildroot
  0 siblings, 0 replies; 9+ messages in thread
From: Frager, Neal via buildroot @ 2024-06-28 12:40 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Erkiaga Elorza, Ibai, brandon.maier@collins.com,
	thomas.petazzoni@bootlin.com, buildroot@buildroot.org,
	Simek, Michal, yann.morin.1998@free.fr

Hi Luca,

Thank you for your thorough review.

> This patch adds a new boot package for building boot firmware for Xilinx
> versal, zynqmp and kria targets.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> V1->V2:
> - add make dependency to be sure bare-metal toolchain is built before trying
>   to use the toolchain for building the xilinx-source firmware
> V2->V3:
> - fix copy paste error that causes build failure
> ---
>  DEVELOPERS                            |  1 +
>  boot/Config.in                        |  1 +
>  boot/xilinx-source/Config.in          | 45 +++++++++++++++++
>  boot/xilinx-source/xilinx-source.hash |  2 +
>  boot/xilinx-source/xilinx-source.mk   | 70 +++++++++++++++++++++++++++
>  5 files changed, 119 insertions(+)
>  create mode 100644 boot/xilinx-source/Config.in
>  create mode 100644 boot/xilinx-source/xilinx-source.hash
>  create mode 100644 boot/xilinx-source/xilinx-source.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 8bfd36f1d8..adfd9520ea 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2340,6 +2340,7 @@ F:	board/xilinx/
>  F:	board/zynq/
>  F:	board/zynqmp/
>  F:	boot/xilinx-prebuilt/
> +F:	boot/xilinx-source/
>  F:	configs/versal_vck190_defconfig
>  F:	configs/zynq_zc702_defconfig
>  F:	configs/zynq_zc706_defconfig
> diff --git a/boot/Config.in b/boot/Config.in
> index 25a50265d2..da22f15e8a 100644
> --- a/boot/Config.in
> +++ b/boot/Config.in
> @@ -22,5 +22,6 @@ source "boot/ti-k3-r5-loader/Config.in"
>  source "boot/uboot/Config.in"
>  source "boot/vexpress-firmware/Config.in"
>  source "boot/xilinx-prebuilt/Config.in"
> +source "boot/xilinx-source/Config.in"
>  
>  endmenu
> diff --git a/boot/xilinx-source/Config.in b/boot/xilinx-source/Config.in
> new file mode 100644
> index 0000000000..bf87ff4178
> --- /dev/null
> +++ b/boot/xilinx-source/Config.in
> @@ -0,0 +1,45 @@
> +config BR2_TARGET_XILINX_SOURCE
> +	bool "xilinx-source"
> +	depends on BR2_aarch64
> +	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
> +	help
> +	  Build boot firmware from source for Xilinx boards.
> +
> +	  https://github.com/Xilinx/embeddedsw

> It would be useful to add here a few words about what gets built and why
> versal requires BR2_TARGET_XILINX_PREBUILT while zynqmp and kria require
> !BR2_TARGET_XILINX_PREBUILT.

Yes, no problem.  I see your point.

> +comment "xilinx-source needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
> +	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"
> +
> +if BR2_TARGET_XILINX_SOURCE
> +
> +config BR2_TARGET_XILINX_SOURCE_VERSION
> +	string "source version"
> +	default "xilinx_v2024.1"
> +	help
> +	  Release version of Xilinx firmware.
> +	  Must be xilinx_v2023.1 or newer.
> +
> +choice
> +	bool "family variant"
> +	default BR2_TARGET_XILINX_SOURCE_ZYNQMP
> +
> +config BR2_TARGET_XILINX_SOURCE_ZYNQMP
> +	bool "zynqmp"
> +	depends on !BR2_TARGET_XILINX_PREBUILT
> +
> +config BR2_TARGET_XILINX_SOURCE_KRIA
> +	bool "kria"
> +	depends on !BR2_TARGET_XILINX_PREBUILT
> +
> +config BR2_TARGET_XILINX_SOURCE_VERSAL
> +	bool "versal"
> +	depends on BR2_TARGET_XILINX_PREBUILT
> +
> +endchoice
> +
> +config BR2_TARGET_XILINX_SOURCE_USER_CFLAGS
> +	string "optional user cflags"
> +	help
> +	  Add optional config flags when building xilinx boot firmware.
> +
> +endif # BR2_TARGET_XILINX_SOURCE
> diff --git a/boot/xilinx-source/xilinx-source.hash b/boot/xilinx-source/xilinx-source.hash
> new file mode 100644
> index 0000000000..ed6a165574
> --- /dev/null
> +++ b/boot/xilinx-source/xilinx-source.hash
> @@ -0,0 +1,2 @@
> +# Locally calculated
> +sha256  733fdb09b2525c1fa322242b97f015122aaf9e32530a824dec71d6328be83850  xilinx-source-xilinx_v2024.1.tar.gz
> diff --git a/boot/xilinx-source/xilinx-source.mk b/boot/xilinx-source/xilinx-source.mk
> new file mode 100644
> index 0000000000..4352b07eed
> --- /dev/null
> +++ b/boot/xilinx-source/xilinx-source.mk
> @@ -0,0 +1,70 @@
> +################################################################################
> +#
> +# xilinx-source
> +#
> +################################################################################
> +
> +XILINX_SOURCE_VERSION = $(call qstrip,$(BR2_TARGET_XILINX_SOURCE_VERSION))
> +XILINX_SOURCE_SITE = $(call github,Xilinx,embeddedsw,$(XILINX_SOURCE_VERSION))
> +XILINX_SOURCE_LICENSE = MIT
> +XILINX_SOURCE_LICENSE_FILES = LICENSE
> +XILINX_SOURCE_INSTALL_TARGET = NO
> +XILINX_SOURCE_INSTALL_IMAGES = YES
> +XILINX_SOURCE_DEPENDENCIES = toolchain-bare-metal-buildroot
> +
> +XILINX_SOURCE_USER_CFLAGS = $(call qstrip,$(BR2_TARGET_XILINX_SOURCE_USER_CFLAGS))
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_KRIA),y)
> +XILINX_SOURCE_CFLAGS = "-Os -flto -ffat-lto-objects -DK26_SOM $(XILINX_SOURCE_USER_CFLAGS)"
> +else
> +XILINX_SOURCE_CFLAGS = "-Os -flto -ffat-lto-objects $(XILINX_SOURCE_USER_CFLAGS)"
> +endif
> +
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
> +define XILINX_SOURCE_BUILD_VERSAL
> +	$(MAKE) -C $(@D)/lib/sw_apps/versal_plm/src/versal \
> +		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
> +		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		CFLAGS=$(XILINX_SOURCE_CFLAGS)
> +		
> +	$(MAKE) -C $(@D)/lib/sw_apps/versal_psmfw/src/versal \
> +		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
> +		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		CFLAGS=$(XILINX_SOURCE_CFLAGS)
> +endef
> +else # BR2_TARGET_XILINX_SOURCE_VERSAL
> +define XILINX_SOURCE_BUILD_OTHERS
> +	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
> +		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
> +		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
> +		CFLAGS=$(XILINX_SOURCE_CFLAGS)
> +endef
> +endif # BR2_TARGET_XILINX_SOURCE_VERSAL
> +
> +define XILINX_SOURCE_BUILD_CMDS
> +	$(XILINX_SOURCE_BUILD_VERSAL)
> +	$(XILINX_SOURCE_BUILD_OTHERS)

> We are always building either for versal or for "others", so only one
> of these two variables is ever defined. So you could use only one
> variable name (XILINX_SOURCE_BUILD?), or even define directly
> XILINX_SOURCE_BUILD_CMDS inside the ifeq/else/endif clause above.

Good simplification.  I took this solution from Yann's xilinx-prebuilt
solution, so that they would look the same.  If we reduce to a single
XILINX_SOURCE_BUILD define, I would like to also reduce to a single
XILINX_PREBUILT_INSTALL define.

I will submit a patch for changing the xilinx-prebuilt package
accordingly.

> +endef
> +
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
> +define XILINX_SOURCE_INSTALL_VERSAL
> +	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/versal_plm/src/versal/plm.elf \
> +		$(BINARIES_DIR)/plm.elf
> +	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/versal_psmfw/src/versal/psmfw.elf \
> +		$(BINARIES_DIR)/psmfw.elf
> +endef
> +else # BR2_TARGET_XILINX_SOURCE_VERSAL
> +define XILINX_SOURCE_INSTALL_OTHERS
> +	$(INSTALL) -D -m 0755 $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf \
> +		$(BINARIES_DIR)/pmufw.elf
> +endef
> +endif # BR2_TARGET_XILINX_SOURCE_VERSAL
> +
> +define XILINX_SOURCE_INSTALL_IMAGES_CMDS
> +	$(XILINX_SOURCE_INSTALL_VERSAL)
> +	$(XILINX_SOURCE_INSTALL_OTHERS)

> As above.

Agreed.

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

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

* Re: [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source
  2024-06-28  9:32   ` Luca Ceresoli via buildroot
@ 2024-06-28 12:50     ` Frager, Neal via buildroot
  0 siblings, 0 replies; 9+ messages in thread
From: Frager, Neal via buildroot @ 2024-06-28 12:50 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Erkiaga Elorza, Ibai, brandon.maier@collins.com,
	thomas.petazzoni@bootlin.com, buildroot@buildroot.org,
	Simek, Michal, yann.morin.1998@free.fr

Hi Luca,

> This patch wires up the xilinx-prebuilt with xilinx-source.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> V1->V3:
> - no changes
> ---
>  boot/xilinx-prebuilt/Config.in          |  3 +++
>  boot/xilinx-prebuilt/xilinx-prebuilt.mk | 13 ++++++++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/xilinx-prebuilt/Config.in b/boot/xilinx-prebuilt/Config.in
> index d3df1c06e7..34b89337fa 100644
> --- a/boot/xilinx-prebuilt/Config.in
> +++ b/boot/xilinx-prebuilt/Config.in
> @@ -22,12 +22,15 @@ choice
>  
>  config BR2_TARGET_XILINX_PREBUILT_ZYNQMP
>  	bool "zynqmp"
> +	depends on !BR2_TARGET_XILINX_SOURCE
>  
>  config BR2_TARGET_XILINX_PREBUILT_KRIA
>  	bool "kria"
> +	depends on !BR2_TARGET_XILINX_SOURCE
>  
>  config BR2_TARGET_XILINX_PREBUILT_VERSAL
>  	bool "versal"
> +	depends on BR2_PACKAGE_HOST_BOOTGEN

> Is this bootgen line unrelated to this series? It appears as something
> that was needed before and it is being fixed now. If it is the case,
> then it should be a separate patch.

Yes, you are right about bootgen.  I have just submitted a patch for this
in order to separate it from everything else.

> Also, I don't like very much how the "family variant" will look like if
> we apply this patch. Now if enabling both xilinx-prebuilt and
> xilinx-source we will have one "family variant" choice for each. And if
> host-bootgen is enabled, the one for xilinx-prebuilt has no selectable
> options, which looks very weird.

> I'm not sure what is the best thing to do here, but it seems wrong to
> have two selectable variants where having different values does not
> make sense. What about moving the "family variant" choice before the
> two packages and use it for both?

I agree.  Perhaps the cleanest solution is to create a versal-pdi
package.  Then xilinx-source and xilinx-prebuilt would be mutually
exclusive all the time, and if xilinx-source is for versal, it
would depend on a versal-pdi package that downloads just the pdi
file.

While this adds a third package, I think it will probably make
everything easier to understand, so I think it is worth it.

> diff --git a/boot/xilinx-prebuilt/xilinx-prebuilt.mk b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> index eb78ed10cd..4cb3e2a33e 100644
> --- a/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> +++ b/boot/xilinx-prebuilt/xilinx-prebuilt.mk
> @@ -18,8 +18,17 @@ XILINX_PREBUILT_BOARD_DIR = $(@D)/$(XILINX_PREBUILT_BOARD)-$(XILINX_PREBUILT_FAM
>  
>  ifeq ($(BR2_TARGET_XILINX_PREBUILT_VERSAL),y)
>  # We need the *.pdi glob, because the file has different names for the
> -# different boards, but htere is only one, and it has to be named
> +# different boards, but there is only one, and it has to be named
>  # vpl_gen_fixed.pdi when installed.
> +
> +ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),y)
> +# The plm.elf and psmfw.elf images will come from xilinx-source, so only
> +# the *.pdi needs to be installed.
> +define XILINX_PREBUILT_INSTALL_VERSAL
> +	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
> +		$(BINARIES_DIR)/vpl_gen_fixed.pdi

> These two lines are a duplicate of...

> +endef
> +else # BR2_TARGET_XILINX_SOURCE_VERSAL
>  define XILINX_PREBUILT_INSTALL_VERSAL
>  	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/plm.elf \
>  		$(BINARIES_DIR)/plm.elf
> @@ -28,6 +37,8 @@ define XILINX_PREBUILT_INSTALL_VERSAL
>  	$(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
>  		$(BINARIES_DIR)/vpl_gen_fixed.pdi

> ...these two lines. It's not a big deal, but I'd consider defining once
> the lines for the pdi and conditionally the other two lines:

> # if BR2_TARGET_XILINX_SOURCE_VERSAL=y the plm.elf and psmfw.elf images
> # will come from xilinx-source, so only the *.pdi needs to be installed.
> ifeq ($(BR2_TARGET_XILINX_SOURCE_VERSAL),)
> define XILINX_PREBUILT_INSTALL_VERSAL_PLM_PSMFW
>        $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/plm.elf \
>                $(BINARIES_DIR)/plm.elf
>        $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/psmfw.elf \
>                $(BINARIES_DIR)/psmfw.elf
> endef
> endif # !BR2_TARGET_XILINX_SOURCE_VERSAL

> define XILINX_PREBUILT_INSTALL_VERSAL_PDI
>        $(INSTALL) -D -m 0755 $(XILINX_PREBUILT_BOARD_DIR)/*.pdi \
>                $(BINARIES_DIR)/vpl_gen_fixed.pdi
> #endef

> ...

> define XILINX_PREBUILT_INSTALL_IMAGES_CMDS
>        $(XILINX_PREBUILT_INSTALL_VERSAL_PLM_PSMFW)
>        $(XILINX_PREBUILT_INSTALL_VERSAL_PDI)
>        $(XILINX_PREBUILT_INSTALL_OTHERS)
> endef

> Luca

This problem goes away if we separate the pdi install to a versal-pdi
package.

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

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

end of thread, other threads:[~2024-06-28 12:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18  7:49 [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Neal Frager via buildroot
2024-06-18  7:49 ` [Buildroot] [PATCH v3 2/4] boot/xilinx-prebuilt: wire up xilinx-source Neal Frager via buildroot
2024-06-28  9:32   ` Luca Ceresoli via buildroot
2024-06-28 12:50     ` Frager, Neal via buildroot
2024-06-18  7:49 ` [Buildroot] [PATCH v3 3/4] boot/uboot.mk: new zynqmp pmufw source option Neal Frager via buildroot
2024-06-28  9:32   ` Luca Ceresoli via buildroot
2024-06-18  7:49 ` [Buildroot] [PATCH v3 4/4] configs/zynqmp|versal: migrate to xilinx-source Neal Frager via buildroot
2024-06-28  9:32 ` [Buildroot] [PATCH v3 1/4] boot/xilinx-source: new boot package Luca Ceresoli via buildroot
2024-06-28 12:40   ` 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