From: Takashi Iwai <tiwai@suse.de>
To: linux-firmware@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH linux-firmware] Install only listed firmware files
Date: Wed, 31 Jul 2019 18:17:44 +0200 [thread overview]
Message-ID: <20190731161744.3612-1-tiwai@suse.de> (raw)
The current make-install procedure leaves lots of garbage files that
aren't really firmware files in /lib/firmware.
Instead of copy-all-and-prune approach, copy only the listed files and
links in WHENCE by make-install for assuring only the proper firmware
files.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
Makefile | 5 +----
copy-firmware.sh | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 4 deletions(-)
create mode 100755 copy-firmware.sh
diff --git a/Makefile b/Makefile
index d1163b871096..16b5b1a02a49 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,4 @@ check:
install:
mkdir -p $(DESTDIR)$(FIRMWAREDIR)
- cp -r * $(DESTDIR)$(FIRMWAREDIR)
- rm -rf $(DESTDIR)$(FIRMWAREDIR)/usbdux
- find $(DESTDIR)$(FIRMWAREDIR) \( -name 'WHENCE' -or -name 'LICENSE.*' -or \
- -name 'LICENCE.*' \) -exec rm -- {} \;
+ ./copy-firmware.sh $(DESTDIR)$(FIRMWAREDIR)
diff --git a/copy-firmware.sh b/copy-firmware.sh
new file mode 100755
index 000000000000..7b276e271cfa
--- /dev/null
+++ b/copy-firmware.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copy firmware files based on WHENCE list
+#
+
+verbose=:
+if [ x"$1" = x"-v" ]; then
+ verbose=echo
+ shift
+fi
+
+destdir="$1"
+
+grep '^File:' WHENCE | sed -e's/^File: *//g' -e's/"//g' | while read f; do
+ test -f "$f" || continue
+ $verbose "copying file $f"
+ mkdir -p $destdir/$(dirname "$f")
+ cp -d "$f" $destdir/"$f"
+done
+
+grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; do
+ test -L "$f" || continue
+ test -f "$destdir/$f" && continue
+ $verbose "copying link $f"
+ mkdir -p $destdir/$(dirname "$f")
+ cp -d "$f" $destdir/"$f"
+done
+
+exit 0
--
2.16.4
next reply other threads:[~2019-07-31 16:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-31 16:17 Takashi Iwai [this message]
2019-08-15 12:22 ` Josh Boyer
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=20190731161744.3612-1-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-firmware@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®