All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] boot/uboot/uboot.mk: support binary pm_cfg_obj
@ 2022-12-09 19:40 Brandon Maier via buildroot
  2022-12-10  9:55 ` Frager, Neal via buildroot
  2022-12-12  9:31 ` Luca Ceresoli via buildroot
  0 siblings, 2 replies; 11+ messages in thread
From: Brandon Maier via buildroot @ 2022-12-09 19:40 UTC (permalink / raw)
  To: buildroot; +Cc: Luca Ceresoli, Brandon Maier, Neal Frager

BR2_TARGET_UBOOT_ZYNQMP_PM_CFG only works with C files, as it always
tries to process them through tools/zynqmp_pm_cfg_obj_convert.py. Rework
the logic so if the pm_cfg_obj isn't a C file, it is provided directly
to U-Boot.

This mimics changes done to the ZYNQMP_PMUFW which had a similar issue.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
 boot/uboot/Config.in | 10 ++++++----
 boot/uboot/uboot.mk  | 17 +++++++----------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index a729280060..75bfaef2a8 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -496,10 +496,8 @@ config BR2_TARGET_UBOOT_ZYNQMP_PM_CFG
 	help
 	  Location of a PMU configuration file.
 
-	  If not empty, Buildroot will convert the PMU configuration
-	  file into a loadable blob and pass it to U-Boot. The blob gets
-	  embedded into the U-Boot SPL and is used to configure the PMU
-	  during board initialization.
+	  If not empty, the blob gets embedded into the U-Boot SPL and
+	  is used to configure the PMU during board initialization.
 
 	  Unlike the PMU firmware, the PMU configuration file is unique
 	  to each board configuration. A PMU configuration file can be
@@ -507,6 +505,10 @@ config BR2_TARGET_UBOOT_ZYNQMP_PM_CFG
 	  the BSP source, for example at
 	    ./psu_cortexa53_0/libsrc/xilpm_v2_4/src/pm_cfg_obj.c
 
+	  If the file is a C source file, Buildroot will convert the PMU
+	  configuration file into a loadable blob before handing off to
+	  U-Boot.
+
 	  Leave this option empty if your PMU firmware has a hard-coded
 	  configuration object or you are loading it by any other means.
 
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 99e80ea5a1..31093992f6 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -406,18 +406,15 @@ endef
 
 UBOOT_ZYNQMP_PM_CFG = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PM_CFG))
 ifneq ($(UBOOT_ZYNQMP_PM_CFG),)
-UBOOT_ZYNQMP_PM_CFG_BIN = $(UBOOT_DIR)/pm_cfg_obj.bin
-define UBOOT_ZYNQMP_KCONFIG_PM_CFG
-	$(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_BIN)", \
-		$(@D)/.config)
-endef
+UBOOT_ZYNQMP_PM_CFG_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PM_CFG))
+UBOOT_ZYNQMP_PM_CFG_BASENAME = $(basename $(UBOOT_ZYNQMP_PM_CFG_PATH))
 
-define UBOOT_ZYNQMP_PM_CFG_CONVERT
-	$(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py \
-		"$(UBOOT_ZYNQMP_PM_CFG)" \
-		"$(UBOOT_ZYNQMP_PM_CFG_BIN)"
+define UBOOT_ZYNQMP_KCONFIG_PM_CFG
+	$(if $(filter %.c,$(UBOOT_ZYNQMP_PM_CFG_PATH)),
+		$(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py $(UBOOT_ZYNQMP_PM_CFG_BASENAME).c $(UBOOT_ZYNQMP_PM_CFG_BASENAME).bin
+		$(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_BASENAME).bin"),
+		$(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_PATH)"))
 endef
-UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PM_CFG_CONVERT
 endif
 
 UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))
-- 
2.38.1

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

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

end of thread, other threads:[~2022-12-29 22:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-09 19:40 [Buildroot] [PATCH 1/1] boot/uboot/uboot.mk: support binary pm_cfg_obj Brandon Maier via buildroot
2022-12-10  9:55 ` Frager, Neal via buildroot
2022-12-12  9:35   ` Luca Ceresoli via buildroot
2022-12-12  9:43     ` Frager, Neal via buildroot
2022-12-12  9:31 ` Luca Ceresoli via buildroot
2022-12-12 12:52   ` Frager, Neal via buildroot
2022-12-13  8:23     ` Luca Ceresoli via buildroot
2022-12-12 15:41   ` [Buildroot] [External] " Maier, Brandon L Collins via buildroot
2022-12-13  8:21     ` Luca Ceresoli via buildroot
2022-12-22 14:37     ` Frager, Neal via buildroot
2022-12-29 22:42       ` Luca Ceresoli via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.