]> git.ipfire.org Git - thirdparty/linux-firmware.git/commitdiff
Install only listed firmware files 20190815
authorTakashi Iwai <tiwai@suse.de>
Wed, 31 Jul 2019 16:17:44 +0000 (18:17 +0200)
committerJosh Boyer <jwboyer@kernel.org>
Thu, 15 Aug 2019 11:46:53 +0000 (07:46 -0400)
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>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Makefile
copy-firmware.sh [new file with mode: 0755]

index d1163b8710965f249f414ac4db3ca212c1be9273..16b5b1a02a49f51ef59d5cf56897abb7dfea1c2e 100644 (file)
--- 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 (executable)
index 0000000..7b276e2
--- /dev/null
@@ -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