diff mbox series

[v2,1/5] linux: enable CONFIG_EXTRA_FIRMWARE_DIR

Message ID 20221014065900.3311604-2-angelo@amarulasolutions.com
State Rejected
Headers show
Series Lichee RV and Lichee RV dock support | expand

Commit Message

Angelo Compagnucci Oct. 14, 2022, 6:58 a.m. UTC
CONFIG_EXTRA_FIRMWARE_DIR must point to the directory where firmware
file from CONFIG_EXTRA_FIRMWARE will be taken to be embedded to the
kernel.
The option is removed if CONFIG_EXTRA_FIRMWARE is not used, but it
defaults to a sensible value when used.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 linux/linux.mk | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thomas Petazzoni Oct. 30, 2022, 8:43 p.m. UTC | #1
On Fri, 14 Oct 2022 08:58:56 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> +	# The kernel CONFIG_EXTRA_FIRMWARE feature requires to have the firmware full
> +	# path for locating firmware file.
> +	$(call KCONFIG_SET_OPT,CONFIG_EXTRA_FIRMWARE_DIR,"$(STAGING_DIR)/lib/firmware")

Unfortunately, this is really not a good idea, especially if it is
meant to be used with your rtl8723ds-bt package. Indeed, the
rtl8723ds-bt firmware is according to your package under a PROPRIETARY
license, so not compatible with the GPL.

Except that CONFIG_EXTRA_FIRMWARE_DIR can only be used for firmware
that is GPL-compatible, as they get linked into the kernel image. What
you're proposing to do makes it illegal to distribute the resulting
kernel image. You can do it on your machine, but you're not allowed to
distribute this kernel image, which for something like Buildroot is a
bit of a problem, as you can imagine.

See
https://elixir.bootlin.com/linux/latest/source/Documentation/driver-api/firmware/built-in-fw.rst#L21

The only options for such firmware is:

 (1) In the root filesystem, which means the driver needs to be a
     module... but that's anyway OK as it's going to be the case as it's an
     out of tree kernel driver, and therefore always compiled as a
     module.

 (2) In an initramfs loaded separately from the kernel.

Best regards,

Thomas
Angelo Compagnucci Oct. 30, 2022, 8:52 p.m. UTC | #2
On Sun, Oct 30, 2022 at 9:43 PM Thomas Petazzoni <
thomas.petazzoni@bootlin.com> wrote:

> On Fri, 14 Oct 2022 08:58:56 +0200
> Angelo Compagnucci <angelo@amarulasolutions.com> wrote:
>
> > +     # The kernel CONFIG_EXTRA_FIRMWARE feature requires to have the
> firmware full
> > +     # path for locating firmware file.
> > +     $(call
> KCONFIG_SET_OPT,CONFIG_EXTRA_FIRMWARE_DIR,"$(STAGING_DIR)/lib/firmware")
>
> Unfortunately, this is really not a good idea, especially if it is
> meant to be used with your rtl8723ds-bt package. Indeed, the
> rtl8723ds-bt firmware is according to your package under a PROPRIETARY
> license, so not compatible with the GPL.
>

Let's suppose the firware I was planning to load permits to be distributed
within the kernk, why it isn't a good idea?
I don't think technically there is some problems here, else let me
understand.


> Except that CONFIG_EXTRA_FIRMWARE_DIR can only be used for firmware
> that is GPL-compatible, as they get linked into the kernel image. What
> you're proposing to do makes it illegal to distribute the resulting
> kernel image. You can do it on your machine, but you're not allowed to
> distribute this kernel image, which for something like Buildroot is a
> bit of a problem, as you can imagine.
>
> See
>
> https://elixir.bootlin.com/linux/latest/source/Documentation/driver-api/firmware/built-in-fw.rst#L21


I don't really want to go down the rabbit hole of what is legal or not,
there are legal departments for that.
If you think the driver in question is not accptable, I'm ok with that, but
I think the mechanism should stay for all the people who need to do
something like that.


>
> The only options for such firmware is:
>
>  (1) In the root filesystem, which means the driver needs to be a
>      module... but that's anyway OK as it's going to be the case as it's an
>      out of tree kernel driver, and therefore always compiled as a
>      module.
>
>  (2) In an initramfs loaded separately from the kernel.
>

Let's discuss this in the driver, I'm more than welcome to change the way I
conceived it.


> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
>
Yann E. MORIN Oct. 30, 2022, 9:23 p.m. UTC | #3
Angelo, All,

On 2022-10-14 08:58 +0200, Angelo Compagnucci spake thusly:
> CONFIG_EXTRA_FIRMWARE_DIR must point to the directory where firmware
> file from CONFIG_EXTRA_FIRMWARE will be taken to be embedded to the
> kernel.
> The option is removed if CONFIG_EXTRA_FIRMWARE is not used, but it
> defaults to a sensible value when used.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
>  linux/linux.mk | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index efdc21eff2..9a909c7d7b 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -408,6 +408,9 @@ define LINUX_KCONFIG_FIXUP_CMDS
>  		$(call KCONFIG_ENABLE_OPT,CONFIG_LOGO)
>  		$(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224))
>  	$(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS)
> +	# The kernel CONFIG_EXTRA_FIRMWARE feature requires to have the firmware full
> +	# path for locating firmware file.
> +	$(call KCONFIG_SET_OPT,CONFIG_EXTRA_FIRMWARE_DIR,"$(STAGING_DIR)/lib/firmware")

Besides what Thomas already said: firmware files are not installed in
STAGING_DIR/lib/firmware, but they are in TARGET_DIR/lib/frmware.

Also, some people already point CONFIG_EXTRA_FIRMWARE_DIR=$(INAGES_DIR)
as there are some firmware fiels copied in there already, so we do not
want to force that for them.

Regards,
Yann E. MORIN.

>  	$(PACKAGES_LINUX_CONFIG_FIXUPS)
>  endef
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/linux/linux.mk b/linux/linux.mk
index efdc21eff2..9a909c7d7b 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -408,6 +408,9 @@  define LINUX_KCONFIG_FIXUP_CMDS
 		$(call KCONFIG_ENABLE_OPT,CONFIG_LOGO)
 		$(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224))
 	$(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS)
+	# The kernel CONFIG_EXTRA_FIRMWARE feature requires to have the firmware full
+	# path for locating firmware file.
+	$(call KCONFIG_SET_OPT,CONFIG_EXTRA_FIRMWARE_DIR,"$(STAGING_DIR)/lib/firmware")
 	$(PACKAGES_LINUX_CONFIG_FIXUPS)
 endef