DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: distrokit@pengutronix.de
Cc: Lars Schmidt <l.schmidt@pengutronix.de>
Subject: [DistroKit] [PATCH v2 3/4] platform: v8a: firmware-imx: Break out barebox injects to separate packages
Date: Fri, 23 May 2025 15:58:14 +0200	[thread overview]
Message-ID: <20250523135815.2998753-4-ada@thorsis.com> (raw)
In-Reply-To: <20250523135815.2998753-1-ada@thorsis.com>

The firmware-imx package is independent from TF-A.  barebox uses both,
but that does not mean firmware-imx should inject the tf-a binary for
barebox.

This is what 'barebox_firmware' was invented for.  Done to avoid
cluttering the firmware-imx package even more.

Before duplicating the firmware-imx package files in an upper layer and
adding more such stuff for a different bootloader, we rather move this
stuff to multiple barebox_firmware packages (which can also sit in other
layers) and inject files from there.

The same approach can then be followed by other bootloaders depending on
firmware-imx package.  This way we can depend on firmware-imx from one,
the other, or both bootloaders, respectively their firmware packages,
without the need to touch the firmware-imx package itself.

Approach inspired by the patch series which introduced that
infrastructure in ptxdist.

Link: https://lore.ptxdist.org/ptxdist/20220129070330.2601433-6-michael.riesch@wolfvision.net/
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---

Notes:
    v2:
    - reordered, now patch 3/4
    - extend to not only breakout firmware-imx but also tf-a to separate new
      package fixups
    
    v1:
    - Link: https://lore.distrokit.org/distrokit/20240425080303.171897-7-ada@thorsis.com/

 configs/platform-v8a/platformconfig           |  2 ++
 configs/platform-v8a/platforms/barebox.imx.in | 12 ++++++++++
 .../platform-v8a/platforms/barebox.tf-a.in    | 11 ++++++++++
 .../platform-v8a/platforms/firmware-imx.in    |  6 -----
 configs/platform-v8a/rules/barebox.imx.make   | 22 +++++++++++++++++++
 configs/platform-v8a/rules/barebox.tf-a.make  | 19 ++++++++++++++++
 configs/platform-v8a/rules/firmware-imx.make  | 21 ------------------
 7 files changed, 66 insertions(+), 27 deletions(-)
 create mode 100644 configs/platform-v8a/platforms/barebox.imx.in
 create mode 100644 configs/platform-v8a/platforms/barebox.tf-a.in
 create mode 100644 configs/platform-v8a/rules/barebox.imx.make
 create mode 100644 configs/platform-v8a/rules/barebox.tf-a.make

diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
index 83c3615..cf8ba0c 100644
--- a/configs/platform-v8a/platformconfig
+++ b/configs/platform-v8a/platformconfig
@@ -185,7 +185,9 @@ PTXCONF_BAREBOX_BUILDSYSTEM_VERSION="${PTXDIST_VCS_VERSION}"
 PTXCONF_BAREBOX_MD5="2b84bcf8644373db021c86864f2e5761"
 PTXCONF_BAREBOX_CONFIG="barebox.config"
 PTXCONF_BAREBOX_FIRMWARE=y
+PTXCONF_BAREBOX_NEEDS_FIRMWARE_IMX=y
 PTXCONF_BAREBOX_NEEDS_FIRMWARE_ROCKCHIP=y
+PTXCONF_BAREBOX_NEEDS_TF_A=y
 PTXCONF_BAREBOX_EXTRA_ENV=y
 PTXCONF_BAREBOX_EXTRA_ENV_PATH="barebox-common-defaultenv"
 # PTXCONF_BAREBOX_BAREBOXENV is not set
diff --git a/configs/platform-v8a/platforms/barebox.imx.in b/configs/platform-v8a/platforms/barebox.imx.in
new file mode 100644
index 0000000..971fc9b
--- /dev/null
+++ b/configs/platform-v8a/platforms/barebox.imx.in
@@ -0,0 +1,12 @@
+## SECTION=barebox_firmware
+
+config BAREBOX_NEEDS_FIRMWARE_IMX
+	bool
+	prompt "barebox needs firmware-imx"
+	help
+	  Select this if barebox needs the non-free IMX firmware blobs.
+
+config BAREBOX_DEPENDENCIES
+	tristate
+	select FIRMWARE_IMX if BAREBOX_NEEDS_FIRMWARE_IMX
+	select FIRMWARE_IMX_BOOTIMAGE_IMX8 if BAREBOX_NEEDS_FIRMWARE_IMX
diff --git a/configs/platform-v8a/platforms/barebox.tf-a.in b/configs/platform-v8a/platforms/barebox.tf-a.in
new file mode 100644
index 0000000..20c4bc4
--- /dev/null
+++ b/configs/platform-v8a/platforms/barebox.tf-a.in
@@ -0,0 +1,11 @@
+## SECTION=barebox_firmware
+
+config BAREBOX_NEEDS_TF_A
+	bool
+	prompt "barebox needs tf-a"
+	help
+	  Select this if barebox needs the TF-A firmware blobs.
+
+config BAREBOX_DEPENDENCIES
+	tristate
+	select TF_A if BAREBOX_NEEDS_TF_A
diff --git a/configs/platform-v8a/platforms/firmware-imx.in b/configs/platform-v8a/platforms/firmware-imx.in
index c93e9f8..965db38 100644
--- a/configs/platform-v8a/platforms/firmware-imx.in
+++ b/configs/platform-v8a/platforms/firmware-imx.in
@@ -53,9 +53,3 @@ config FIRMWARE_IMX_BOOTIMAGE_IMX9
 	  a boot image.
 
 endif
-
-config BAREBOX_DEPENDENCIES
-	tristate
-	select FIRMWARE_IMX
-	select FIRMWARE_IMX_BOOTIMAGE_IMX8
-	select TF_A
diff --git a/configs/platform-v8a/rules/barebox.imx.make b/configs/platform-v8a/rules/barebox.imx.make
new file mode 100644
index 0000000..2137c67
--- /dev/null
+++ b/configs/platform-v8a/rules/barebox.imx.make
@@ -0,0 +1,22 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2024 by Alexander Dahl <ada@thorsis.com>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ifdef PTXCONF_FIRMWARE_IMX_BOOTIMAGE_IMX8
+
+BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_1d_dmem.bin:firmware/lpddr4_pmu_train_1d_dmem.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_1d_imem.bin:firmware/lpddr4_pmu_train_1d_imem.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_2d_dmem.bin:firmware/lpddr4_pmu_train_2d_dmem.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_2d_imem.bin:firmware/lpddr4_pmu_train_2d_imem.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_dmem_1d.bin:firmware/ddr4_dmem_1d.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_dmem_2d.bin:firmware/ddr4_dmem_2d.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_imem_1d.bin:firmware/ddr4_imem_1d.bin
+BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_imem_2d.bin:firmware/ddr4_imem_2d.bin
+
+endif
+
+# vim: syntax=make
diff --git a/configs/platform-v8a/rules/barebox.tf-a.make b/configs/platform-v8a/rules/barebox.tf-a.make
new file mode 100644
index 0000000..47d8032
--- /dev/null
+++ b/configs/platform-v8a/rules/barebox.tf-a.make
@@ -0,0 +1,19 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2025 by Alexander Dahl <ada@thorsis.com>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ifdef PTXCONF_TF_A
+
+BAREBOX_INJECT_FILES	+= imx8mm-bl31.bin:firmware/imx8mm-bl31.bin
+BAREBOX_INJECT_FILES	+= imx8mn-bl31.bin:firmware/imx8mn-bl31.bin
+BAREBOX_INJECT_FILES	+= imx8mp-bl31.bin:firmware/imx8mp-bl31.bin
+BAREBOX_INJECT_FILES	+= imx8mq-bl31.bin:firmware/imx8mq-bl31.bin
+BAREBOX_INJECT_FILES	+= imx93-bl31.bin:firmware/imx93-bl31.bin
+
+endif
+
+# vim: syntax=make
diff --git a/configs/platform-v8a/rules/firmware-imx.make b/configs/platform-v8a/rules/firmware-imx.make
index 6b01af3..906691c 100644
--- a/configs/platform-v8a/rules/firmware-imx.make
+++ b/configs/platform-v8a/rules/firmware-imx.make
@@ -26,27 +26,6 @@ FIRMWARE_IMX_LICENSE	:= NXP-Software-License-Agreement
 FIRMWARE_IMX_LICENSE_FILES := \
 	file://COPYING;md5=44a8052c384584ba09077e85a3d1654f
 
-#
-# Firmware blobs for barebox
-#
-ifdef PTXCONF_FIRMWARE_IMX
-BAREBOX_INJECT_FILES	+= imx8mm-bl31.bin:firmware/imx8mm-bl31.bin
-BAREBOX_INJECT_FILES	+= imx8mn-bl31.bin:firmware/imx8mn-bl31.bin
-BAREBOX_INJECT_FILES	+= imx8mp-bl31.bin:firmware/imx8mp-bl31.bin
-BAREBOX_INJECT_FILES	+= imx8mq-bl31.bin:firmware/imx8mq-bl31.bin
-BAREBOX_INJECT_FILES	+= imx93-bl31.bin:firmware/imx93-bl31.bin
-ifdef PTXCONF_FIRMWARE_IMX_BOOTIMAGE_IMX8
-BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_1d_dmem.bin:firmware/lpddr4_pmu_train_1d_dmem.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_1d_imem.bin:firmware/lpddr4_pmu_train_1d_imem.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_2d_dmem.bin:firmware/lpddr4_pmu_train_2d_dmem.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/lpddr4_pmu_train_2d_imem.bin:firmware/lpddr4_pmu_train_2d_imem.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_dmem_1d.bin:firmware/ddr4_dmem_1d.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_dmem_2d.bin:firmware/ddr4_dmem_2d.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_imem_1d.bin:firmware/ddr4_imem_1d.bin
-BAREBOX_INJECT_FILES	+= ddr/synopsys/ddr4_imem_2d.bin:firmware/ddr4_imem_2d.bin
-endif
-endif
-
 # ----------------------------------------------------------------------------
 # Extract
 # ----------------------------------------------------------------------------
-- 
2.39.5




  parent reply	other threads:[~2025-05-23 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 13:58 [DistroKit] [PATCH v2 0/4] platform: v8a: barebox: Untangle firmware inject files Alexander Dahl
2025-05-23 13:58 ` [DistroKit] [PATCH v2 1/4] platform: v8a: firmware-rockchip: Move barebox injects to separate package Alexander Dahl
2025-05-23 13:58 ` [DistroKit] [PATCH v2 2/4] platform: v8a: barebox: Remove extra host prog Alexander Dahl
2025-05-23 13:58 ` Alexander Dahl [this message]
2025-05-23 13:58 ` [DistroKit] [PATCH v2 4/4] platform: v8a: barebox: Inject tf-a binaries conditionally Alexander Dahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250523135815.2998753-4-ada@thorsis.com \
    --to=ada@thorsis.com \
    --cc=distrokit@pengutronix.de \
    --cc=l.schmidt@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox