mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Cc: m.olbrich@pengutronix.de
Subject: Re: [ptxdist] [PATCH] linux-firmware: Add new package. Version 20210818
Date: Tue, 18 Jan 2022 09:46:06 +0100	[thread overview]
Message-ID: <c4474a23-41c9-f0da-c36f-d6cdafbe7735@t2data.com> (raw)
In-Reply-To: <YYUQEVN0MEu4TDmZ@pengutronix.de>

On 11/5/21 12:05 PM, Michael Olbrich wrote:
> On Thu, Nov 04, 2021 at 11:08:02AM +0100, Christian Melki wrote:
>> Bump.
>>
>> No more opinions? Go? No go? Changes?
>>
>> On 10/16/21 9:21 AM, Christian Melki wrote:
>>> On 10/15/21 21:40, Alexander Dahl wrote:
>>>> Hei hei,
>>>>
>>>> On Fri, Oct 15, 2021 at 04:11:11PM +0200, Michael Olbrich wrote:
>>>>> On Wed, Oct 13, 2021 at 08:36:31PM +0200, Christian Melki wrote:
>>>>>> Firmware is needed by a lot of modern devices.
>>>>>> Includes various radio interfaces, GPU and CPU stuff.
>>>>>>
>>>>>> Due to the large space required by some firmwares as a whole,
>>>>>> compression can optionally be enabled.
>>>>>
>>>>> Hmmm, I'm not sure about this. I've always dumped selected firmware files
>>>>> and their license into projectroot/ and created a local package. Mostly for
>>>>> two reasons:
>>>>>
>>>>> 1. I wanted the fine control to explicitly update individual firmware
>>>>> files.
>>>>>
>>>>> 2. I never found a good way to split the package options. For example,
>>>>> installing all iwlwifi* files seems excessive but so does adding an option
>>>>> for each on.
>>>>>
>>>>> Any other opinions on this?
>>>>
>>>> I can share some experience from the fli4l [1] project, but from a
>>>> different viewing angle.  Most firmware is not free in a FOSS licensed
>>>> way, so it's hard to find a generic solution, especially when getting
>>>> the license stuff right.  That's why we opted for free (as in under
>>>> FOSS license) firmware only, which means: user is responsible for
>>>> handling non-free firmware.
>>>>
>>>> Same thing basically applies for proprietary firmware you develop yourself.
>>>>
>>>> So I think the approach Michael suggested in this case is a useful
>>>> one: just put the few blobs and license stuff you need into your BSP.
>>>>
>>>> This obviously would not work if the user can plug arbitrary hardware
>>>> like WiFi cards, but if hardware is restricted, and most embededded
>>>> projects are (?), then this is no problem.
>>>>
>>>> However if you don't have control which additional hardware your users
>>>> plug, and you still want to support it, you would need a more generic
>>>> approach.
>>>>
>>>> Greets
>>>> Alex
>>>>
>>>> [1] https://www.fli4l.de/
>>>>
>>>
>>> Hi.
>>>
>>> I think I can clarify my raison d'être a bit.
>>> The kernel isn't overly informative on what it is loading or has loaded
>>> (history) as a default. I patch the firmware class or use dyndbg to get
>>> all the loaded firmware files from this standard package. From time to
>>> time things can be a little bit non-obvious, such as the Raven Ridge APU
>>> requiring a blob named Raven2-something.
>>> So I usually end up providing all the blobs (names do change) with the
>>> latest firmware package, get all the files when I'm happy with the
>>> configuration and filter it down. Because the whole package is rather huge.
>>>
>>> So for my part, I still have to provide linux-firmware bits and that I
>>> partly go through the same thing anyway.
>>>
>>> I agree that the *.in is rather non-optimal, but I'm open to
>>> suggestions. Maybe an *all* and a *filter list* once you're done is better?
> 
> All and a filter makes sense. How about this:
> 
> Install with install_glob and use * as default glob. Allow custom globs
> from the config.
> 
> List all licenses in LINUX_FIRMWARE_LICENSE_FILES. Use a config option to
> allow listing just the file names, and then:
> 
> LINUX_FIRMWARE_SELECTED_LICENCES := $(call remove_quotes, PTXCONF_LINUX_FIRMWARE_LICENCES)
> ifneq ($(LINUX_FIRMWARE_SELECTED_LICENCES),)
> LINUX_FIRMWARE_LICENSE_FILES := $(filter $(addsuffix %,$(addprefix file://,$(LINUX_FIRMWARE_SELECTED_LICENCES))),$(LINUX_FIRMWARE_LICENSE_FILES))
> endif
> 
> Michael
> 

Hi Michael,

I need to get back to this and get it sorted.
Trying to figure out what you are suggesting here.
Sorry, being a bit slow now. :)

There is no strict relation between firmware file names and licence file 
names beside some random name resemblance.

I don't understand how you suggest I pick the license files
from the firmware file names?
Or do you mean that one should choose licenses from a long list of tick 
options for ptxdist to filter into the used ones?

That plus manually selecting the actual firmware files.

Regards,
Christian

> 
>>> Regards,
>>> Christian
>>>
>>>>>
>>>>> Michael
>>>>>
>>>>>> Signed-off-by: Christian Melki <christian.melki@t2data.com>
>>>>>> ---
>>>>>>    rules/linux-firmware.in   | 55 ++++++++++++++++++++++
>>>>>>    rules/linux-firmware.make | 99 +++++++++++++++++++++++++++++++++++++++
>>>>>>    2 files changed, 154 insertions(+)
>>>>>>    create mode 100644 rules/linux-firmware.in
>>>>>>    create mode 100644 rules/linux-firmware.make
>>>>>>
>>>>>> diff --git a/rules/linux-firmware.in b/rules/linux-firmware.in
>>>>>> new file mode 100644
>>>>>> index 000000000..1abbec6bd
>>>>>> --- /dev/null
>>>>>> +++ b/rules/linux-firmware.in
>>>>>> @@ -0,0 +1,55 @@
>>>>>> +## SECTION=system_libraries
>>>>>> +
>>>>>> +menuconfig LINUX_FIRMWARE
>>>>>> +	tristate
>>>>>> +	prompt "linux-firmware                "
>>>>>> +	help
>>>>>> +	  Linux firmware is a collection of firmwares that are used for various hardwares.
>>>>>> +
>>>>>> +if LINUX_FIRMWARE
>>>>>> +
>>>>>> +config LINUX_FIRMWARE_COMPRESSION
>>>>>> +	tristate
>>>>>> +	prompt "xz compression support"
>>>>>> +	select HOST_XZ
>>>>>> +	help
>>>>>> +	  Linux firmware files can be compressed with xz. Needs a linux kernel >= 5.3
>>>>>> +
>>>>>> +menu "CPU Microcode"
>>>>>> +
>>>>>> +config LINUX_FIRMWARE_AMDCPU
>>>>>> +	bool "AMD CPU u-code"
>>>>>> +	help
>>>>>> +	  Firmware files for AMD CPUs.
>>>>>> +
>>>>>> +endmenu
>>>>>> +
>>>>>> +menu "Video firmware"
>>>>>> +
>>>>>> +config LINUX_FIRMWARE_AMDGPU
>>>>>> +	bool "AMD GPU video card firmware"
>>>>>> +	help
>>>>>> +	  Firmware files for AMD GPU video cards.
>>>>>> +	  Indexed according to https://wiki.gentoo.org/wiki/AMDGPU
>>>>>> +
>>>>>> +if LINUX_FIRMWARE_AMDGPU
>>>>>> +
>>>>>> +menu "AMDGPU video firmware"
>>>>>> +
>>>>>> +config LINUX_FIRMWARE_AMDGPU_RAVEN_RIDGE_APU
>>>>>> +	bool "RAVEN RIDGE APU AMD GPU video card firmware"
>>>>>> +	help
>>>>>> +	  Firmware files for RAVEN RIDGE APU AMD GPU video cards.
>>>>>> +
>>>>>> +config LINUX_FIRMWARE_AMDGPU_RAVEN2_VEGA_MOBILE
>>>>>> +	bool "RAVEN2 VEGA MOBILE AMD GPU video card firmware"
>>>>>> +	help
>>>>>> +	  Firmware files for RAVEN2 VEGA MOBILE AMD GPU video cards.
>>>>>> +
>>>>>> +endmenu
>>>>>> +
>>>>>> +endif
>>>>>> +
>>>>>> +endmenu
>>>>>> +
>>>>>> +endif
>>>>>> diff --git a/rules/linux-firmware.make b/rules/linux-firmware.make
>>>>>> new file mode 100644
>>>>>> index 000000000..3a3a300e6
>>>>>> --- /dev/null
>>>>>> +++ b/rules/linux-firmware.make
>>>>>> @@ -0,0 +1,99 @@
>>>>>> +# -*-makefile-*-
>>>>>> +#
>>>>>> +# Copyright (C) 2021 by Christian Melki <christian.melki@t2data.com>
>>>>>> +#
>>>>>> +# For further information about the PTXdist project and license conditions
>>>>>> +# see the README file.
>>>>>> +#
>>>>>> +
>>>>>> +#
>>>>>> +# We provide this package
>>>>>> +#
>>>>>> +PACKAGES-$(PTXCONF_LINUX_FIRMWARE) += linux-firmware
>>>>>> +
>>>>>> +#
>>>>>> +# Paths and names
>>>>>> +#
>>>>>> +LINUX_FIRMWARE_VERSION	:= 20210818
>>>>>> +LINUX_FIRMWARE_MD5	:= 736a3bbba3391d962d3c321ae04572d7
>>>>>> +LINUX_FIRMWARE		:= linux-firmware-$(LINUX_FIRMWARE_VERSION)
>>>>>> +LINUX_FIRMWARE_SUFFIX	:= tar.gz
>>>>>> +LINUX_FIRMWARE_URL	:= $(call ptx/mirror, KERNEL, kernel/firmware/$(LINUX_FIRMWARE).$(LINUX_FIRMWARE_SUFFIX))
>>>>>> +LINUX_FIRMWARE_SOURCE	:= $(SRCDIR)/$(LINUX_FIRMWARE).$(LINUX_FIRMWARE_SUFFIX)
>>>>>> +LINUX_FIRMWARE_DIR	:= $(BUILDDIR)/$(LINUX_FIRMWARE)
>>>>>> +LINUX_FIRMWARE_LICENSE	:= proprietary
>>>>>> +LINUX_FIRMWARE_LICENSE_FILES := \
>>>>>> +	file://LICENSE.amdgpu;md5=d357524f5099e2a3db3c1838921c593f \
>>>>>> +	file://LICENSE.amd-ucode;md5=3c5399dc9148d7f0e1f41e34b69cf14f
>>>>>> +
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +# Extract
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +
>>>>>> +$(STATEDIR)/linux-firmware.extract:
>>>>>> +	@$(call targetinfo)
>>>>>> +	@$(call clean, $(LINUX_FIRMWARE_DIR))
>>>>>> +	@$(call extract, LINUX_FIRMWARE)
>>>>>> +	@$(call patchin, LINUX_FIRMWARE)
>>>>>> +	@$(call touch)
>>>>>> +
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +# Prepare
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +
>>>>>> +LINUX_FIRMWARE_CONF_TOOL	:= NO
>>>>>> +
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +# Compile
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +
>>>>>> +$(STATEDIR)/linux-firmware.compile:
>>>>>> +	@$(call targetinfo)
>>>>>> +	@$(call touch)
>>>>>> +
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +# Install
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +
>>>>>> +$(STATEDIR)/linux-firmware.install:
>>>>>> +	@$(call targetinfo)
>>>>>> +	@$(call world/install, LINUX_FIRMWARE)
>>>>>> +ifdef PTXCONF_LINUX_FIRMWARE_COMPRESSION
>>>>>> +	@find $(LINUX_FIRMWARE_PKGDIR) -type f \
>>>>>> +	-not -name "*.xz" \
>>>>>> +	-not -name "*.ucode" \
>>>>>> +	-exec echo "Compressing " "{}" "..." \; \
>>>>>> +	-exec xz -C crc32 "{}" \;
>>>>>> +endif
>>>>>> +	@$(call touch)
>>>>>> +
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +# Target-Install
>>>>>> +# ----------------------------------------------------------------------------
>>>>>> +
>>>>>> +$(STATEDIR)/linux-firmware.targetinstall:
>>>>>> +	@$(call targetinfo)
>>>>>> +
>>>>>> +	@$(call install_init, linux-firmware)
>>>>>> +	@$(call install_fixup, linux-firmware,PRIORITY,optional)
>>>>>> +	@$(call install_fixup, linux-firmware,SECTION,base)
>>>>>> +	@$(call install_fixup, linux-firmware,AUTHOR,"Christian Melki <christian.melki@t2data.com>")
>>>>>> +	@$(call install_fixup, linux-firmware,DESCRIPTION,missing)
>>>>>> +ifdef PTXCONF_LINUX_FIRMWARE_AMDCPU
>>>>>> +	@$(call install_copy, linux-firmware, 0, 0, 0755, /lib/firmware/amd-ucode)
>>>>>> +	@$(call install_glob, linux-firmware, 0, 0, -, /lib/firmware/amd-ucode, *)
>>>>>> +endif
>>>>>> +ifdef PTXCONF_LINUX_FIRMWARE_AMDGPU
>>>>>> +	@$(call install_copy, linux-firmware, 0, 0, 0755, /lib/firmware/amdgpu)
>>>>>> +ifdef PTXCONF_LINUX_FIRMWARE_AMDGPU_RAVEN_RIDGE_APU
>>>>>> +	@$(call install_glob, linux-firmware, 0, 0, -, /lib/firmware/amdgpu, *raven_*)
>>>>>> +endif
>>>>>> +ifdef PTXCONF_LINUX_FIRMWARE_AMDGPU_RAVEN2_VEGA_MOBILE
>>>>>> +	@$(call install_glob, linux-firmware, 0, 0, -, /lib/firmware/amdgpu, *raven2*)
>>>>>> +endif
>>>>>> +endif
>>>>>> +	@$(call install_finish, linux-firmware)
>>>>>> +
>>>>>> +	@$(call touch)
>>>>>> +
>>>>>> +# vim: syntax=make
>>>>>> -- 
>>>>>> 2.30.2
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> ptxdist mailing list
>>>>>> ptxdist@pengutronix.de
>>>>>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>>>>>
>>>>>
>>>>> -- 
>>>>> Pengutronix e.K.                           |                             |
>>>>> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
>>>>> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>>>>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>>>>>
>>>>> _______________________________________________
>>>>> ptxdist mailing list
>>>>> ptxdist@pengutronix.de
>>>>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>>>
>>>
>>>
>>> _______________________________________________
>>> ptxdist mailing list
>>> ptxdist@pengutronix.de
>>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>>
>>
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

      reply	other threads:[~2022-01-18  8:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 18:36 Christian Melki
2021-10-15 14:11 ` Michael Olbrich
2021-10-15 19:40   ` Alexander Dahl
2021-10-16  7:21     ` Christian Melki
2021-11-04 10:08       ` Christian Melki
2021-11-04 19:16         ` Bruno Thomsen
2021-11-05 11:05         ` Michael Olbrich
2022-01-18  8:46           ` Christian Melki [this message]

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=c4474a23-41c9-f0da-c36f-d6cdafbe7735@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /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