diff mbox series

[v2,2/2] boot/uboot.mk: new zynqmp pmufw build option

Message ID 20230327170604.22854-2-neal.frager@amd.com
State Changes Requested
Headers show
Series [v2,1/2] package/zynqmp-firmware: new package | expand

Commit Message

Neal Frager March 27, 2023, 5:06 p.m. UTC
The new BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option will enable u-boot to
use the zynqmp-firmware package for building a pmufw.elf that gets included in
the generated boot.bin.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V2:
  - Improved naming to be clear about choice between building from source or
    using prebuilt image
  - Updated zynqmp_xxx_defconfig files to use new naming convention
---
 boot/uboot/Config.in                | 22 +++++++++++++++++++---
 boot/uboot/uboot.mk                 |  7 ++++++-
 configs/zynqmp_kria_kv260_defconfig |  2 +-
 configs/zynqmp_zcu102_defconfig     |  2 +-
 configs/zynqmp_zcu106_defconfig     |  2 +-
 5 files changed, 28 insertions(+), 7 deletions(-)

Comments

Thomas Petazzoni Aug. 22, 2023, 10:02 p.m. UTC | #1
On Mon, 27 Mar 2023 18:06:04 +0100
Neal Frager via buildroot <buildroot@buildroot.org> wrote:

> -config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
> -	string "PMU firmware location"

The removal of this option will require Config.in.legacy handling.

> +choice
> +	prompt "zynqmp firmware source or prebuilt"
> +	default BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
>  	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
> +
> +config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
> +	bool "Build zynqmp PMU firmware from source"
> +	depends on BR2_PACKAGE_ZYNQMP_FIRMWARE
> +	help
> +	  This option instructs u-boot to build the zynqmp pmufw using
> +	  the zynqmp-firmware package.  u-boot will then include this
> +	  pmufw.elf in the generated boot.bin.
> +
> +	  This feature requires U-Boot >= 2018.07.
> +
> +config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
> +	string "Pre-built zynqmp PMU firmware location"

We can have choice between a boolean option and a string option? Does
that work?

Thomas
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index f5c20f5168..cf9da88749 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -476,11 +476,25 @@  config BR2_TARGET_UBOOT_ZYNQMP
 
 if BR2_TARGET_UBOOT_ZYNQMP
 
-config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
-	string "PMU firmware location"
+choice
+	prompt "zynqmp firmware source or prebuilt"
+	default BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+
+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
+	bool "Build zynqmp PMU firmware from source"
+	depends on BR2_PACKAGE_ZYNQMP_FIRMWARE
+	help
+	  This option instructs u-boot to build the zynqmp pmufw using
+	  the zynqmp-firmware package.  u-boot will then include this
+	  pmufw.elf in the generated boot.bin.
+
+	  This feature requires U-Boot >= 2018.07.
+
+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
+	string "Pre-built zynqmp PMU firmware location"
 	help
-	  Location of a PMU firmware binary.
+	  Location of a pre-built PMU firmware binary.
 
 	  If not empty, instructs the U-Boot build process to generate
 	  a boot.bin (to be loaded by the ZynqMP boot ROM) containing
@@ -497,6 +511,8 @@  config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
 
 	  This feature requires U-Boot >= 2018.07.
 
+endchoice
+
 config BR2_TARGET_UBOOT_ZYNQMP_PM_CFG
 	string "PMU configuration location"
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 4eae8e95c3..5493c9fe75 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -390,7 +390,12 @@  endef
 
 ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)
 
-UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW))
+ifeq ($(BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE),y)
+UBOOT_DEPENDENCIES += zynqmp-firmware
+UBOOT_ZYNQMP_PMUFW = $(BINARIES_DIR)/pmufw.elf
+else
+UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT))
+endif
 
 ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),)
 UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW)
diff --git a/configs/zynqmp_kria_kv260_defconfig b/configs/zynqmp_kria_kv260_defconfig
index e180d5e7e7..36cac86282 100644
--- a/configs/zynqmp_kria_kv260_defconfig
+++ b/configs/zynqmp_kria_kv260_defconfig
@@ -31,7 +31,7 @@  BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/ubuntu-firmware/raw/2022.2_br_1/kv260/kv260_pmufw.elf"
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT="https://github.com/Xilinx/ubuntu-firmware/raw/2022.2_br_1/kv260/kv260_pmufw.elf"
 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
diff --git a/configs/zynqmp_zcu102_defconfig b/configs/zynqmp_zcu102_defconfig
index 00b33261b6..0b76f76c70 100644
--- a/configs/zynqmp_zcu102_defconfig
+++ b/configs/zynqmp_zcu102_defconfig
@@ -29,7 +29,7 @@  BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/ubuntu-firmware/raw/2022.2_br_1/zcu102/zcu102_pmufw.elf"
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT="https://github.com/Xilinx/ubuntu-firmware/raw/2022.2_br_1/zcu102/zcu102_pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu102/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
diff --git a/configs/zynqmp_zcu106_defconfig b/configs/zynqmp_zcu106_defconfig
index 88295571af..04beeba0fe 100644
--- a/configs/zynqmp_zcu106_defconfig
+++ b/configs/zynqmp_zcu106_defconfig
@@ -29,7 +29,7 @@  BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/ubuntu-firmware/raw/2022.2_br_1/zcu106/zcu106_pmufw.elf"
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT="https://github.com/Xilinx/ubuntu-firmware/raw/2022.2_br_1/zcu106/zcu106_pmufw.elf"
 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