diff mbox series

[1/1] package/dvb-firmware: new package

Message ID 20221226180353.1897840-1-bernd.kuhls@t-online.de
State Handled Elsewhere
Headers show
Series [1/1] package/dvb-firmware: new package | expand

Commit Message

Bernd Kuhls Dec. 26, 2022, 6:03 p.m. UTC
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 DEVELOPERS                             |  1 +
 package/Config.in                      |  1 +
 package/dvb-firmware/Config.in         | 16 +++++++++++++
 package/dvb-firmware/dvb-firmware.hash |  2 ++
 package/dvb-firmware/dvb-firmware.mk   | 32 ++++++++++++++++++++++++++
 5 files changed, 52 insertions(+)
 create mode 100644 package/dvb-firmware/Config.in
 create mode 100644 package/dvb-firmware/dvb-firmware.hash
 create mode 100644 package/dvb-firmware/dvb-firmware.mk

Comments

Thomas Petazzoni Dec. 27, 2022, 9:43 p.m. UTC | #1
Hello,

On Mon, 26 Dec 2022 19:03:53 +0100
Bernd Kuhls <bernd.kuhls@t-online.de> wrote:

> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>

Do we know why these firmware files are not part of the linux-firmware
project? They are needed in conjunction with which kernel drivers?

> +DVB_FIRMWARE_VERSION = 1.4.2
> +DVB_FIRMWARE_SITE = $(call github,LibreELEC,dvb-firmware,$(DVB_FIRMWARE_VERSION))
> +DVB_FIRMWARE_LICENSE = PROPRIETARY
> +DVB_FIRMWARE_REDISTRIBUTE = NO

This DVB_FIRMWARE_REDISTRIBUTE = NO is not good, as it would actually
encourage people to violate the license of those firmware files. Indeed
what DVB_FIRMWARE_REDISTRIBUTE = NO says is "to not mention this
package in the manifest" and "do not copy the license files". However,
several license files in dvb-firmware explicitly *require* that the
license file should be distributed.

Quoting from LICENCE.go7007:

=====
The firmware files included in the firmware/ directory may be freely
redistributed only in conjunction with this document; but modification,
tampering and reverse engineering are prohibited.
=====

Quoting from LICENCE.xc5000

=====
// Permission to use, copy, modify, and/or distribute this software, only
// for use with Xceive ICs, for any purpose with or without fee is hereby
// granted, provided that the above copyright notice and this permission
// notice appear in all source code copies.
=====

Quoting from LICENCE.siano

=====
* Redistributions must reproduce the above copyright notice and the
following disclaimer in the documentation and/or other materials
provided with the distribution.
=====

If we want to create a package for this properly, we need to have a
mapping between the firmware files and the specific license file that
applies to them, so that we know which conditions apply to which
firmware file. As it is done today in this Github repo, it looks like
some firmware files are random binaries from the Internet, with no
clear licensing... which makes their redistribution not legal.

Thomas
Yann E. MORIN Dec. 27, 2022, 9:58 p.m. UTC | #2
Bernd, Thomas, All,

On 2022-12-27 22:43 +0100, Thomas Petazzoni spake thusly:
> On Mon, 26 Dec 2022 19:03:53 +0100
> Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
> > Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> Do we know why these firmware files are not part of the linux-firmware
> project? They are needed in conjunction with which kernel drivers?

And there is some overlap. For example, dvb-usb-dib0700-1.20.fw is
present in both packages.

> > +DVB_FIRMWARE_VERSION = 1.4.2
> > +DVB_FIRMWARE_SITE = $(call github,LibreELEC,dvb-firmware,$(DVB_FIRMWARE_VERSION))
> > +DVB_FIRMWARE_LICENSE = PROPRIETARY
> > +DVB_FIRMWARE_REDISTRIBUTE = NO
> 
> This DVB_FIRMWARE_REDISTRIBUTE = NO is not good, as it would actually
> encourage people to violate the license of those firmware files. Indeed
> what DVB_FIRMWARE_REDISTRIBUTE = NO says is "to not mention this
> package in the manifest" and "do not copy the license files".

Wrong. _REDISTRIBUTE = NO does not exclude the package from the manifest
or from copying the license files; it only restricts copying the source
tarball and the applied patches. The entry in the manifest is still
added, and the license files are still copied.

See the comment in package/pkg-generic@1137:

  1137 # We save the license files for any kind of package: normal, local,
  1138 # overridden, or non-redistributable alike.
  1139 # The reason to save license files even for no-redistribute packages
  1140 # is that the license still applies to the files distributed as part
  1141 # of the rootfs, even if the sources are not themselves redistributed.

> However,
> several license files in dvb-firmware explicitly *require* that the
> license file should be distributed.
> 
> Quoting from LICENCE.go7007:
> 
> =====
> The firmware files included in the firmware/ directory may be freely
> redistributed only in conjunction with this document; but modification,
> tampering and reverse engineering are prohibited.
> =====
> 
> Quoting from LICENCE.xc5000
> 
> =====
> // Permission to use, copy, modify, and/or distribute this software, only
> // for use with Xceive ICs, for any purpose with or without fee is hereby
> // granted, provided that the above copyright notice and this permission
> // notice appear in all source code copies.
> =====

"all source code copies" would not apply to binary files, I would say.

> Quoting from LICENCE.siano
> 
> =====
> * Redistributions must reproduce the above copyright notice and the
> following disclaimer in the documentation and/or other materials
> provided with the distribution.
> =====
> 
> If we want to create a package for this properly, we need to have a
> mapping between the firmware files and the specific license file that
> applies to them, so that we know which conditions apply to which
> firmware file. As it is done today in this Github repo, it looks like
> some firmware files are random binaries from the Internet, with no
> clear licensing... which makes their redistribution not legal.

I had a first look at that package a while back too, and it is a bit of
a mess license-wise.

At the very least, indeed, we should restrict the way the files are
installed, a bit like we do for linux-firmware.

Regards,
Yann E. MORIN.
Bernd Kuhls Dec. 27, 2022, 10:30 p.m. UTC | #3
Hi Thomas,

Am Tue, 27 Dec 2022 22:43:54 +0100 schrieb Thomas Petazzoni via buildroot:

> Hello,
> 
> On Mon, 26 Dec 2022 19:03:53 +0100 Bernd Kuhls
> <bernd.kuhls@t-online.de> wrote:
> 
>> Signed-off-by: Bernd Kuhls
>> <bernd.kuhls@t-online.de>
> 
> Do we know why these firmware files are not part of the linux-firmware
> project? They are needed in conjunction with which kernel drivers?

The history of this repo is unknown to me, it is used by the LibreELEC 
project in their images. Personally I need only these firmware files:

BR2_PACKAGE_DVB_FIRMWARE_FILES="dvb-demod-m88rs6000.fw dvb-demod-si2168-
d60-01.fw v4l-cx23885-avcore-01.fw"

for the cx23885/m88ds3103/si2168 kernel modules needed by this card:

05:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887/8 
PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 04)

(aka Hauppauge WinTV-HVR-5525HD)

These firmware files are not present in the linux-firmware package.

To pick up Yann's proposal: How about adding a device-specific Config.in 
option for these firmware files like

config BR2_PACKAGE_DVB_FIRMWARE_WINTV_5525HD
    bool "firmware for Hauppauge WinTV-HVR-5525HD"

When other users need specific firmware from this package they can add 
new options when needed, like I did with https://patchwork.ozlabs.org/
project/buildroot/patch/20221218220318.563479-1-bernd.kuhls@t-online.de/

Or, if the license mess gets too complicated, I am happy to keep the 
package in my private repo ;)

Regards, Bernd
Thomas Petazzoni Dec. 28, 2022, 8:37 a.m. UTC | #4
Hello,

On Tue, 27 Dec 2022 22:58:02 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> > > +DVB_FIRMWARE_VERSION = 1.4.2
> > > +DVB_FIRMWARE_SITE = $(call github,LibreELEC,dvb-firmware,$(DVB_FIRMWARE_VERSION))
> > > +DVB_FIRMWARE_LICENSE = PROPRIETARY
> > > +DVB_FIRMWARE_REDISTRIBUTE = NO  
> > 
> > This DVB_FIRMWARE_REDISTRIBUTE = NO is not good, as it would actually
> > encourage people to violate the license of those firmware files. Indeed
> > what DVB_FIRMWARE_REDISTRIBUTE = NO says is "to not mention this
> > package in the manifest" and "do not copy the license files".  
> 
> Wrong. _REDISTRIBUTE = NO does not exclude the package from the manifest
> or from copying the license files; it only restricts copying the source
> tarball and the applied patches. The entry in the manifest is still
> added, and the license files are still copied.

Aaah, I didn't remember this. Thanks for the reminder! Then my point is
moot, I suppose (even though the fact that the package was missing
LICENSE_FILES in fact prevented the collection of license files into
legal-info).

Thomas
Thomas Petazzoni Dec. 28, 2022, 10 a.m. UTC | #5
Hello Bernd,

On Tue, 27 Dec 2022 23:30:45 +0100
Bernd Kuhls <bernd.kuhls@t-online.de> wrote:

> > Do we know why these firmware files are not part of the linux-firmware
> > project? They are needed in conjunction with which kernel drivers?  
> 
> The history of this repo is unknown to me, it is used by the LibreELEC 
> project in their images. Personally I need only these firmware files:
> 
> BR2_PACKAGE_DVB_FIRMWARE_FILES="dvb-demod-m88rs6000.fw dvb-demod-si2168-
> d60-01.fw v4l-cx23885-avcore-01.fw"
> 
> for the cx23885/m88ds3103/si2168 kernel modules needed by this card:
> 
> 05:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887/8 
> PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 04)
> 
> (aka Hauppauge WinTV-HVR-5525HD)
> 
> These firmware files are not present in the linux-firmware package.
> 
> To pick up Yann's proposal: How about adding a device-specific Config.in 
> option for these firmware files like
> 
> config BR2_PACKAGE_DVB_FIRMWARE_WINTV_5525HD
>     bool "firmware for Hauppauge WinTV-HVR-5525HD"

This would certainly be OK, *but* you would need to first clarify under
what license these particular firmware files are released.

Even though I'm not sure it's totally useful, I've noticed that the
kernel ships with a scripts/get_dvb_firmware script that allows to
download some DVB firmware from various locations. One of the locations
is https://linuxtv.org/downloads/firmware/. But it hasn't been updated
since 2014, and seems to have less firmware that the LibrELEC repo.

For me, the LibrELEC repo is fine, as long as there is licensing
information for the different firmware files.

Or we need to invent a special license mechanism in Buildroot that
clarifies that the build results cannot be redistributed (which would
of course be confusing with _REDISTRIBUTE = YES/NO, which means a
different thing).

Thomas
Bernd Kuhls Dec. 28, 2022, 10:22 p.m. UTC | #6
Hi Thomas,

Am Wed, 28 Dec 2022 11:00:17 +0100 schrieb Thomas Petazzoni via buildroot:

> This would certainly be OK, *but* you would need to first clarify under
> what license these particular firmware files are released.

after several hours of research I am abandoning this patch because I was 
unable to find any license infos for these files...

Although I found alternative sources besides the LibreELEC repo

- dvb-demod-m88rs6000.fw
http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz
http://palosaari.fi/linux/v4l-dvb/firmware/M88RS6000/4.1/

- dvb-demod-si2168-d60-01.fw
https://launchpad.net/~b-rad/+archive/ubuntu/kernel+mediatree+hauppauge/
+sourcefiles/linux-firmware-hauppauge/0.1.8+xenial/linux-firmware-
hauppauge_0.1.8+xenial.tar.gz

- v4l-cx23885-avcore-01.fw
https://linuxtv.org/downloads/firmware/dvb-firmwares.tar.bz2

- all of the three mentioned above
https://github.com/tbsdtv/media_build/releases/download/latest/dvb-
firmwares.tar.bz2

for the firmware needed here there is no license information available 
anywhere.

> Even though I'm not sure it's totally useful, I've noticed that the
> kernel ships with a scripts/get_dvb_firmware script that allows to
> download some DVB firmware from various locations. One of the locations
> is https://linuxtv.org/downloads/firmware/. But it hasn't been updated
> since 2014, and seems to have less firmware that the LibrELEC repo.

Thanks for investigating but you are right, that source is outdated.

> For me, the LibreELEC repo is fine, as long as there is licensing
> information for the different firmware files.

I can fully understand the need for license files but they seem out of 
reach.

The closest "license" text I could find was for the "linux-firmware-
hauppauge" launchpad.net repo mentioned by Hauppauge:
https://hauppauge.com/pages/support/support_linux.html
https://launchpad.net/~b-rad/+archive/ubuntu/kernel+mediatree+hauppauge/
+sourcepub/12873406/+listing-archive-extra

which includes this in debian/changelog:

"- Hauppauge Computer Works has redistribution rights for these firmwares"

But this repo only includes one of the three files needed.

On another support page Hauppauge ( http://www.hauppauge.de/site/support/
support_linux.html?n=FAQ.Linux#tv_tuner ) is linking firmware files to 
the OpenELEC repo: https://github.com/OpenELEC/dvb-firmware/, also no 
license infos available...

> Or we need to invent a special license mechanism in Buildroot that
> clarifies that the build results cannot be redistributed (which would of
> course be confusing with _REDISTRIBUTE = YES/NO, which means a different
> thing).

What about 

BR2_PACKAGE_DVB_FIRMWARE_INSTALL_TARGET = NO

to force users to pick the files needed by BR2_ROOTFS_POST_BUILD_SCRIPT?

Privately I added the files to a rootfs overlay now, closing this topic...

Regards, Bernd
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index cb9201bfb7..99118ee7be 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -335,6 +335,7 @@  F:	package/dht/
 F:	package/dovecot/
 F:	package/dovecot-pigeonhole/
 F:	package/dtv-scan-tables/
+F:	package/dvb-firmware/
 F:	package/eudev/
 F:	package/exim/
 F:	package/fetchmail/
diff --git a/package/Config.in b/package/Config.in
index bdbf8ee01a..1215f339d5 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -434,6 +434,7 @@  menu "Firmware"
 	source "package/armbian-firmware/Config.in"
 	source "package/b43-firmware/Config.in"
 	source "package/brcmfmac_sdio-firmware-rpi/Config.in"
+	source "package/dvb-firmware/Config.in"
 	source "package/linux-firmware/Config.in"
 	source "package/murata-cyw-fw/Config.in"
 	source "package/odroidc2-firmware/Config.in"
diff --git a/package/dvb-firmware/Config.in b/package/dvb-firmware/Config.in
new file mode 100644
index 0000000000..6a1c3cd6be
--- /dev/null
+++ b/package/dvb-firmware/Config.in
@@ -0,0 +1,16 @@ 
+config BR2_PACKAGE_DVB_FIRMWARE
+	bool "dvb-firmware"
+	help
+	  Firmware files for DVB devices.
+
+	  https://github.com/LibreELEC/dvb-firmware
+
+if BR2_PACKAGE_DVB_FIRMWARE
+
+config BR2_PACKAGE_DVB_FIRMWARE_FILES
+	string "dvb-firmware-files"
+	help
+	  Whitespace separated list of firmware files,
+	  leave empty for all.
+
+endif
diff --git a/package/dvb-firmware/dvb-firmware.hash b/package/dvb-firmware/dvb-firmware.hash
new file mode 100644
index 0000000000..b1cb4c69b7
--- /dev/null
+++ b/package/dvb-firmware/dvb-firmware.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256  f23b14cf75b45a381c5894b8057c66812a30506a9731f9ff64e9142a8f834cda  dvb-firmware-1.4.2.tar.gz
diff --git a/package/dvb-firmware/dvb-firmware.mk b/package/dvb-firmware/dvb-firmware.mk
new file mode 100644
index 0000000000..769c6ea716
--- /dev/null
+++ b/package/dvb-firmware/dvb-firmware.mk
@@ -0,0 +1,32 @@ 
+################################################################################
+#
+# dvb-firmware
+#
+################################################################################
+
+DVB_FIRMWARE_VERSION = 1.4.2
+DVB_FIRMWARE_SITE = $(call github,LibreELEC,dvb-firmware,$(DVB_FIRMWARE_VERSION))
+DVB_FIRMWARE_LICENSE = PROPRIETARY
+DVB_FIRMWARE_REDISTRIBUTE = NO
+
+ifeq ($(call qstrip,$(BR2_PACKAGE_DVB_FIRMWARE_FILES)),)
+
+define DVB_FIRMWARE_INSTALL_TARGET_CMDS
+	$(INSTALL) -d $(TARGET_DIR)/lib/firmware
+	cd $(@D)/firmware ; \
+	find . -type f -exec $(INSTALL) -D -m 0644 {} $(TARGET_DIR)/lib/firmware/{} \;
+endef
+
+else
+
+define DVB_FIRMWARE_INSTALL_TARGET_CMDS
+	$(INSTALL) -d $(TARGET_DIR)/lib/firmware
+	$(foreach t,$(call qstrip,$(BR2_PACKAGE_DVB_FIRMWARE_FILES)), \
+		$(INSTALL) -D -m 0644 $(@D)/firmware/$(t) \
+			$(TARGET_DIR)/lib/firmware/$(t)
+	)
+endef
+
+endif
+
+$(eval $(generic-package))