APPLIED: [kernel-snaps-uc22/main][PATCH] trim-firmware: support multi-API versioned iwlwifi ucode

Dimitri John Ledkov dimitri.ledkov at canonical.com
Wed Jan 11 11:56:50 UTC 2023


Applied to uc22 repo main branch.

On Mon, 12 Dec 2022 at 13:45, Dimitri John Ledkov
<dimitri.ledkov at canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/1998841
>
> Add support for multi-API versioned iwlwifi ucode files. If a direct
> file is missing, check if a lower API version is available for
> use. Currently in jammy this results in three ucodes being picked up
> of a lower version number:
>
>  + /root/parts/kernel/src/trim-firmware /root/parts/kernel/install/lib
>  Overriding iwlwifi-so-a0-gf-a0-66.ucode with iwlwifi-so-a0-gf-a0-64.ucode
>  Overriding iwlwifi-so-a0-hr-b0-66.ucode with iwlwifi-so-a0-hr-b0-64.ucode
>  Overriding iwlwifi-so-a0-jf-b0-66.ucode with iwlwifi-so-a0-jf-b0-64.ucode
>
> Separately need investigation if v66 ucode should be SRUed into jammy.
>
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
> ---
>  trim-firmware | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/trim-firmware b/trim-firmware
> index 6d0b5829b6..c590aa2114 100755
> --- a/trim-firmware
> +++ b/trim-firmware
> @@ -23,6 +23,25 @@ DESTDIR=${1}
>
>  # Copy required firmware files to a new directory
>  while IFS= read -r fw_file ; do
> +
> +       # Most iwlwifi firwmare files are versioned, and lower
> +       # versions are often required, when max version is not shipped
> +       # by linux-firmware package
> +       case $fw_file in iwlwifi-*.ucode)
> +               if ! [ -e "${DESTDIR}"/firmware/${fw_file} ]; then
> +                       max_api=$(echo $fw_file | sed -n 's/iwlwifi-.*-\([0-9]*\).ucode/\1/p')
> +                       for api in `seq $max_api -1 39`; do
> +                               api_fw_file=${fw_file/%$max_api.ucode/$api.ucode}
> +                               if [ -e "${DESTDIR}"/firmware/$api_fw_file ]; then
> +                                       echo Overriding $fw_file with $api_fw_file
> +                                       fw_file=$api_fw_file
> +                                       break;
> +                               fi
> +                       done
> +               fi
> +               ;;
> +       esac
> +
>         for src_file in "${DESTDIR}"/firmware/${fw_file} ; do
>                 if ! [ -e "${src_file}" ] ; then
>                         continue  # Skip non-existing source files
> --
> 2.34.1
>


--
okurrr,

Dimitri



More information about the kernel-team mailing list