From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 25 Apr 2024 10:03:18 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rzu4c-00GKDk-0s for lore@lore.pengutronix.de; Thu, 25 Apr 2024 10:03:18 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rzu4b-0001H2-61; Thu, 25 Apr 2024 10:03:17 +0200 Received: from mail.thorsis.com ([2003:a:e28:26e4::10]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rzu4U-00017y-H2 for distrokit@pengutronix.de; Thu, 25 Apr 2024 10:03:14 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B8245148DA05 for ; Thu, 25 Apr 2024 10:03:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thorsis.com; s=dkim; t=1714032189; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=QF9AkW3ZXywA49BUG/cqMG+V9pE6BPU1MGOi22pA5H8=; b=MDSBqOOT+45V942GzJLmoVAbfj8UjaADC7gO/IIPu3mcc5pLSvR/YHtQ4C4UCneVPbDUN4 WCWSNSw/KOXsC+vgmEn3yR3WMBTJx0/YMlJjvaAM0Q2oTfCod4LkUZ6tOs+85w3n0CFYfo wAoEKnvCXDO/WR6hx1iWLsRA7Sv4B6yeeUZmirafLxa+y3s3DTzPGwPOOCmkB5RliDh40Z /qwmB9wJkX0iW/YnHH1U1gM0GDIahGQxWj5RnPqWNYhgh572RIj7cK7Mj2aQFgcwEPVbr1 qL7rR/qTXlV1sz37Jjpe3+NpvT+IW7qoXTPDa9mXdu8THfIJmU2FFFMlvvVTdQ== From: Alexander Dahl To: distrokit@pengutronix.de Date: Thu, 25 Apr 2024 10:02:55 +0200 Message-Id: <20240425080303.171897-3-ada@thorsis.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240425080303.171897-1-ada@thorsis.com> References: <20240425080303.171897-1-ada@thorsis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-3.1 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: [DistroKit] [PATCH 2/9] platform: v8a: firmware-imx: Rework extract, install, and targetinstall X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false 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 --- 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