public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Zoltán Böszörményi" <zboszor@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
	"Ryan Eatmon" <reatmon@ti.com>,
	"Ross Burton" <ross.burton@arm.com>,
	"Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>,
	"Zoltán Böszörményi" <zboszor@gmail.com>
Subject: [PATCH v2 1/2] linux-firmware: Fix removing unlicensed firmware if compression is used
Date: Fri, 17 Oct 2025 11:12:37 +0200	[thread overview]
Message-ID: <20251017091238.1459237-1-zboszor@gmail.com> (raw)

If FIRMWARE_COMPRESSION is set, the newly added code to remove
unlicensed firmware fails with:

| Remove unlicensed firmware: acenic/tg1.bin
| rm: cannot remove '.../work/all-oe-linux/linux-firmware/20250917/image/usr/lib/firmware/acenic/tg1.bin': No such file or directory

This is because the code does not consider that the file may be
compressed.

Fix it by factoring out the code to construct the compressed file
name suffix from do_install:append() into a python function and
also use it for the actual file names listed in REMOVE_UNLICENSED.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 .../linux-firmware/linux-firmware_20251011.bb    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-kernel/linux-firmware/linux-firmware_20251011.bb b/meta/recipes-kernel/linux-firmware/linux-firmware_20251011.bb
index a9e8935f93..bb40c68670 100644
--- a/meta/recipes-kernel/linux-firmware/linux-firmware_20251011.bb
+++ b/meta/recipes-kernel/linux-firmware/linux-firmware_20251011.bb
@@ -472,6 +472,14 @@ def fw_compr_suffix(d):
         compr = 'zst'
     return '-' + compr
 
+def fw_compr_file_suffix(d):
+    compr = d.getVar('FIRMWARE_COMPRESSION')
+    if compr == '':
+        return ''
+    if compr == 'zstd':
+        compr = 'zst'
+    return '.' + compr
+
 do_compile() {
 	:
 }
@@ -489,7 +497,7 @@ do_install() {
         # Remove all unlicensed firmware
         for file in ${REMOVE_UNLICENSED}; do
                 echo "Remove unlicensed firmware: $file"
-                rm ${D}${nonarch_base_libdir}/firmware/$file
+                rm ${D}${nonarch_base_libdir}/firmware/$file${@fw_compr_file_suffix(d)}
                 path_to_file=$(dirname $file)
                 while [ "${path_to_file}" != "." ]; do
                         num_files=$(ls -A1 ${D}${nonarch_base_libdir}/firmware/$path_to_file | wc -l)
@@ -1386,11 +1394,7 @@ FILES:${PN}-sd8897 = " \
 do_install:append() {
     # The kernel 5.6.x driver still uses the old name, provide a symlink for
     # older kernels
-    COMPR=$(echo ${@fw_compr_suffix(d)} | tr -d '-')
-    if [ -n "$COMPR" ]; then
-        COMPR=".$COMPR"
-    fi
-    ln -fs sdsd8997_combo_v4.bin$COMPR ${D}${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin$COMPR
+    ln -fs sdsd8997_combo_v4.bin${@fw_compr_file_suffix(d)} ${D}${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin${@fw_compr_file_suffix(d)}
 }
 FILES:${PN}-sd8997 = " \
   ${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin* \
-- 
2.51.0



             reply	other threads:[~2025-10-17  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  9:12 Zoltán Böszörményi [this message]
2025-10-17  9:12 ` [PATCH v2 2/2] linux-firmware: Add globbing to FILES where missing Zoltán Böszörményi

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=20251017091238.1459237-1-zboszor@gmail.com \
    --to=zboszor@gmail.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=reatmon@ti.com \
    --cc=ross.burton@arm.com \
    /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