All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-firmware] Install only listed firmware files
@ 2019-07-31 16:17 Takashi Iwai
  2019-08-15 12:22 ` Josh Boyer
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2019-07-31 16:17 UTC (permalink / raw)
  To: linux-firmware; +Cc: linux-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-firmware] Install only listed firmware files
  2019-07-31 16:17 [PATCH linux-firmware] Install only listed firmware files Takashi Iwai
@ 2019-08-15 12:22 ` Josh Boyer
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2019-08-15 12:22 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Linux Firmware, Linux-Kernel@Vger. Kernel. Org

On Wed, Jul 31, 2019 at 12:17 PM Takashi Iwai <tiwai@suse.de> wrote:
>
> 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>

Thanks!  Applied and pushed out.

josh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-15 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 16:17 [PATCH linux-firmware] Install only listed firmware files Takashi Iwai
2019-08-15 12:22 ` Josh Boyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.