DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: distrokit@pengutronix.de
Subject: [DistroKit] [PATCH 2/9] platform: v8a: firmware-imx: Rework extract, install, and targetinstall
Date: Thu, 25 Apr 2024 10:02:55 +0200	[thread overview]
Message-ID: <20240425080303.171897-3-ada@thorsis.com> (raw)
In-Reply-To: <20240425080303.171897-1-ada@thorsis.com>

Usually in ptxdist stages work like this: in extract stage files are put
into BUILDDIR.  From there `make install` or something similar in
install stage copies build artifacts to PKGDIR.  The install.post stage
copies everything from PKDIR to SYSROOT_TARGET.  Finally targetinstall
stage uses the files from PKGDIR to populate root.

Here everything was extracted to PKGDIR.  Some files where manually
copied from PKGDIR to $(SYSROOT_TARGET)/usr/lib/firmware, before
install.post copied those files again to $(SYSROOT_TARGET)/firmware …

Now the usual cycle as described above is followed, hopefully leading to
much less confusion, and avoiding duplicate files in sysroot-target.

This gives us predictable paths in SYSROOT_TARGET and allows to use
files in $(SYSROOT_TARGET) to be used by other packages like U-Boot by
directly pointing at them, or pointing to the folder they are in (most
likely '$(SYSROOT_TARGET)/usr/lib/firmware').

(barebox does not point at those files, but copies them to its own
sourcedir through the inject mechanism.)

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 configs/platform-v8a/rules/firmware-imx.make | 81 +++++++++++++-------
 1 file changed, 52 insertions(+), 29 deletions(-)

diff --git a/configs/platform-v8a/rules/firmware-imx.make b/configs/platform-v8a/rules/firmware-imx.make
index b640db6..57a10c3 100644
--- a/configs/platform-v8a/rules/firmware-imx.make
+++ b/configs/platform-v8a/rules/firmware-imx.make
@@ -20,10 +20,11 @@ FIRMWARE_IMX_SKIP	:= 38918
 FIRMWARE_IMX		:= firmware-imx-$(FIRMWARE_IMX_VERSION)
 FIRMWARE_IMX_SUFFIX	:= bin
 FIRMWARE_IMX_URL	:= http://www.nxp.com/lgfiles/NMG/MAD/YOCTO/$(FIRMWARE_IMX).$(FIRMWARE_IMX_SUFFIX)
+FIRMWARE_IMX_SOURCE	:= $(SRCDIR)/$(FIRMWARE_IMX).$(FIRMWARE_IMX_SUFFIX)
+FIRMWARE_IMX_DIR	:= $(BUILDDIR)/$(FIRMWARE_IMX)
 FIRMWARE_IMX_LICENSE	:= NXP-Software-License-Agreement
 FIRMWARE_IMX_LICENSE_FILES := \
-	file://$(FIRMWARE_IMX_PKGDIR)/COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9
-FIRMWARE_IMX_SOURCE	:= $(SRCDIR)/$(FIRMWARE_IMX).$(FIRMWARE_IMX_SUFFIX)
+	file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9
 
 #
 # Firmware blobs for barebox
@@ -51,38 +52,31 @@ endif
 
 $(STATEDIR)/firmware-imx.extract:
 	@$(call targetinfo)
-	@mkdir -p "$(PKGDIR)"
-	@dd if=$(FIRMWARE_IMX_SOURCE) bs=$(FIRMWARE_IMX_SKIP) skip=1 | tar xj -C $(PKGDIR)
+	@$(call clean, $(FIRMWARE_IMX_DIR))
+	@mkdir -p "$(FIRMWARE_IMX_DIR)"
+	@dd if="$(FIRMWARE_IMX_SOURCE)" bs=$(FIRMWARE_IMX_SKIP) skip=1 \
+		| tar -xj --strip-components=2 -C "$(FIRMWARE_IMX_DIR)"
+	@$(call patchin, FIRMWARE_IMX)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+FIRMWARE_IMX_CONF_TOOL	:= NO
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/firmware-imx.compile:
+	@$(call targetinfo)
 	@$(call touch)
 
 # ----------------------------------------------------------------------------
 # Install
 # ----------------------------------------------------------------------------
 
-$(STATEDIR)/firmware-imx.install:
-	@$(call targetinfo)
-
-ifdef PTXCONF_FIRMWARE_IMX_BOOTIMAGE_IMX8
-	@$(foreach f, lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_imem.bin \
-	              lpddr4_pmu_train_2d_dmem.bin lpddr4_pmu_train_2d_imem.bin, \
-		install -v -D -m644 $(FIRMWARE_IMX_PKGDIR)/firmware/ddr/synopsys/$(f) \
-		$(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/ddr/synopsys/$(f)$(ptx/nl))
-
-	@$(foreach f, ddr4_dmem_1d.bin ddr4_dmem_2d.bin \
-	              ddr4_imem_1d.bin ddr4_imem_2d.bin, \
-		install -v -D -m644 $(FIRMWARE_IMX_PKGDIR)/firmware/ddr/synopsys/$(f) \
-		$(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/ddr/synopsys/$(f)$(ptx/nl))
-
-	@$(foreach f, signed_dp_imx8m.bin signed_hdmi_imx8m.bin, \
-		install -v -D -m644 $(FIRMWARE_IMX_PKGDIR)/firmware/hdmi/cadence/$(f) \
-		$(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/hdmi/cadence/$(f)$(ptx/nl))
-endif
-
-	@$(call touch)
-# ----------------------------------------------------------------------------
-# Target-Install
-# ----------------------------------------------------------------------------
-
 FIRMWARE_IMX_INSTALL-y					:=
 FIRMWARE_IMX_INSTALL-$(PTXCONF_FIRMWARE_IMX_VPU_IMX27)	+= vpu_fw_imx27_TO2.bin
 FIRMWARE_IMX_INSTALL-$(PTXCONF_FIRMWARE_IMX_VPU_IMX6Q)	+= vpu_fw_imx6q.bin
@@ -90,6 +84,35 @@ FIRMWARE_IMX_INSTALL-$(PTXCONF_FIRMWARE_IMX_VPU_IMX6DL)	+= vpu_fw_imx6d.bin
 FIRMWARE_IMX_INSTALL-$(PTXCONF_FIRMWARE_IMX_VPU_IMX53)	+= vpu_fw_imx53.bin
 FIRMWARE_IMX_INSTALL-$(PTXCONF_FIRMWARE_IMX_VPU_IMX51)	+= vpu_fw_imx51.bin
 
+$(STATEDIR)/firmware-imx.install:
+	@$(call targetinfo)
+
+	@$(foreach f,$(FIRMWARE_IMX_INSTALL-y), \
+		install -v -D -m644 $(FIRMWARE_IMX_DIR)/firmware/vpu/$(f) \
+		$(FIRMWARE_IMX_PKGDIR)/usr/lib/firmware/vpu/$(f)$(ptx/nl))
+
+ifdef PTXCONF_FIRMWARE_IMX_BOOTIMAGE_IMX8
+	@$(foreach f, lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_imem.bin \
+	              lpddr4_pmu_train_2d_dmem.bin lpddr4_pmu_train_2d_imem.bin, \
+		install -v -D -m644 $(FIRMWARE_IMX_DIR)/firmware/ddr/synopsys/$(f) \
+		$(FIRMWARE_IMX_PKGDIR)/usr/lib/firmware/ddr/synopsys/$(f)$(ptx/nl))
+
+	@$(foreach f, ddr4_dmem_1d.bin ddr4_dmem_2d.bin \
+	              ddr4_imem_1d.bin ddr4_imem_2d.bin, \
+		install -v -D -m644 $(FIRMWARE_IMX_DIR)/firmware/ddr/synopsys/$(f) \
+		$(FIRMWARE_IMX_PKGDIR)/usr/lib/firmware/ddr/synopsys/$(f)$(ptx/nl))
+
+	@$(foreach f, signed_dp_imx8m.bin signed_hdmi_imx8m.bin, \
+		install -v -D -m644 $(FIRMWARE_IMX_DIR)/firmware/hdmi/cadence/$(f) \
+		$(FIRMWARE_IMX_PKGDIR)/usr/lib/firmware/hdmi/cadence/$(f)$(ptx/nl))
+endif
+
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
 $(STATEDIR)/firmware-imx.targetinstall:
 	@$(call targetinfo)
 
@@ -100,7 +123,7 @@ $(STATEDIR)/firmware-imx.targetinstall:
 	@$(call install_fixup, firmware-imx,DESCRIPTION,missing)
 	@$(foreach f,$(FIRMWARE_IMX_INSTALL-y), \
 		$(call install_copy, firmware-imx, 0, 0, 0644, \
-			$(FIRMWARE_IMX_PKGDIR)/firmware/vpu/$(f), \
+			$(FIRMWARE_IMX_PKGDIR)/usr/lib/firmware/vpu/$(f), \
 			/usr/lib/firmware/$(f))$(ptx/nl))
 	@$(call install_finish, firmware-imx)
 
-- 
2.39.2




  parent reply	other threads:[~2024-04-25  8:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25  8:02 [DistroKit] [PATCH 0/9] platform: v8a: firmware: Rework for upper layers with different boards Alexander Dahl
2024-04-25  8:02 ` [DistroKit] [PATCH 1/9] platform: v8a: firmware-imx: Fix dependencies Alexander Dahl
2024-05-27 16:13   ` Robert Schwebel
2024-04-25  8:02 ` Alexander Dahl [this message]
2024-05-27 16:13   ` [DistroKit] [PATCH 2/9] platform: v8a: firmware-imx: Rework extract, install, and targetinstall Robert Schwebel
2024-04-25  8:02 ` [DistroKit] [PATCH 3/9] platform: v8a: firmware-imx: Version bump 8.8 -> 8.23 Alexander Dahl
2024-05-27 16:13   ` Robert Schwebel
2024-04-25  8:02 ` [DistroKit] [PATCH 4/9] platform: v8a: firmware-imx: Install more files for U-Boot Alexander Dahl
2024-05-27 16:14   ` Robert Schwebel
2024-04-25  8:02 ` [DistroKit] [PATCH 5/9] platform: v8a: firmware-imx: Install more files for i.MX93 Alexander Dahl
2024-05-27 16:15   ` Robert Schwebel
2024-04-25  8:02 ` [DistroKit] [PATCH 6/9] platform: v8a: firmware-imx: Move barebox injects to separate package Alexander Dahl
2024-04-25 12:33   ` Alexander Dahl
2024-05-27 16:15     ` Robert Schwebel
2024-05-28  6:32       ` Alexander Dahl
2024-04-25  8:03 ` [DistroKit] [PATCH 7/9] platform: v8a: firmware-rockchip: " Alexander Dahl
2024-05-27 16:16   ` Robert Schwebel
2024-04-25  8:03 ` [DistroKit] [PATCH 8/9] platform: v8a: barebox: Remove extra host prog Alexander Dahl
2024-05-27 16:16   ` Robert Schwebel
2024-05-28  6:14     ` Alexander Dahl
2024-05-28  8:23       ` Robert Schwebel
2024-04-25  8:03 ` [DistroKit] [PATCH 8/8] platform: v8a: firmware-sentinel: Add new package Alexander Dahl
2024-04-25  8:03 ` [DistroKit] [PATCH 9/9] " Alexander Dahl
2024-05-27 16:17   ` Robert Schwebel

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=20240425080303.171897-3-ada@thorsis.com \
    --to=ada@thorsis.com \
    --cc=distrokit@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