[kernel-snaps-uc2*/main|master][PATCH] trim-firmware: correctly support firmware wildcard patterns

Juerg Haefliger juerg.haefliger at canonical.com
Thu May 12 11:17:03 UTC 2022


On Mon,  9 May 2022 17:38:51 +0100
Dimitri John Ledkov <dimitri.ledkov at canonical.com> wrote:

> firmware stanzas in kernel modules can contain wildcard
> expansions. Thus explicitely do not quote fw_file such that wildcard
> expansion finds all of:
> 
>  brcm/brcmfmac*-sdio.*.bin
>  brcm/brcmfmac*-pcie.*.txt
>  brcm/brcmfmac*-sdio.*.txt
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
> ---
>  trim-firmware | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/trim-firmware b/trim-firmware
> index cc7c9fff6c..cc8b61c42d 100755
> --- a/trim-firmware
> +++ b/trim-firmware
> @@ -23,7 +23,8 @@ DESTDIR=${1}
>  
>  # Copy required firmware files to a new directory
>  while IFS= read -r fw_file ; do
> -	for src_file in "${DESTDIR}"/firmware/${fw_file} ; do
> +	# Note path expansion required, as fw_file can be a wildcard
> +	for src_file in $DESTDIR/firmware/$fw_file ; do

What does that do? fw_file wasn't quoted before, for that very reason.

...Juerg

>  		if ! [ -e "${src_file}" ] ; then
>  			continue  # Skip non-existing source files
>  		fi
> @@ -38,12 +39,6 @@ while IFS= read -r fw_file ; do
>  	done
>  done < <(list_firmware "${DESTDIR}"/modules | sort -u)
>  
> -# Copy all brcm files, since there might be config files that the kernel
> -# doesn't expose via modinfo
> -if [ -d "${DESTDIR}"/firmware.new/brcm ] ; then
> -	cp "${DESTDIR}"/firmware/brcm/* "${DESTDIR}"/firmware.new/brcm
> -fi
> -
>  # Copy the wifi regulatory database
>  if [ -e "${DESTDIR}"/firmware/regulatory.db ] ; then
>  	cp "${DESTDIR}"/firmware/regulatory.* "${DESTDIR}"/firmware.new

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20220512/2f8c183b/attachment.sig>


More information about the kernel-team mailing list