Fix PSR-SU issues with kernel 6.2 or later

Resolves: rhbz#2218668

Signed-off-by: Jan Stancek <jstancek@redhat.com>
This commit is contained in:
Jan Stancek 2023-07-03 07:55:19 +02:00
parent 5df0a5dfaf
commit c019edd513
5 changed files with 97 additions and 174 deletions

View File

@ -1,128 +0,0 @@
From bf432ba7d9d00c0848dfe7706b42b68f3dcd9012 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Fri, 22 Jan 2021 20:36:23 +0000
Subject: [PATCH v2] Add support for compressing firmware in copy-firmware.sh
As of kernel 5.3 there's initial support for loading compressed firmware.
At this stage the only supported compression methis is "xz -C crc32" but
this option brings significant benefits.
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
v2: quote filename for xz command
Conflicts:
- Replace 'mkdir -p' with 'install -d' to apply after upstream eaee2dacc2be.
Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
---
Makefile | 4 ++++
copy-firmware.sh | 47 +++++++++++++++++++++++++++++++----------------
2 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index 83a0ec6..1edf4a6 100644
--- a/Makefile
+++ b/Makefile
@@ -11,3 +11,7 @@ check:
install:
install -d $(DESTDIR)$(FIRMWAREDIR)
./copy-firmware.sh $(DESTDIR)$(FIRMWAREDIR)
+
+installcompress:
+ install -d $(DESTDIR)$(FIRMWAREDIR)
+ ./copy-firmware.sh -v -C $(DESTDIR)$(FIRMWAREDIR)
diff --git a/copy-firmware.sh b/copy-firmware.sh
index bbacb92..fc419a3 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -6,6 +6,7 @@
verbose=:
prune=no
+compress=no
while test $# -gt 0; do
case $1 in
@@ -19,6 +20,11 @@ while test $# -gt 0; do
shift
;;
+ -C | --compress)
+ compress=yes
+ shift
+ ;;
+
*)
if test "x$destdir" != "x"; then
echo "ERROR: unknown command-line options: $@"
@@ -31,40 +37,49 @@ while test $# -gt 0; do
esac
done
+if test "x$compress" = "xyes"; then
+ cmpxtn=.xz
+ grep '^File:' WHENCE | sed -e's/^File: *//g' -e's/"//g' | while read f; do
+ test -f "$f" || continue
+ $verbose "compressing $f"
+ xz -C crc32 "$f"
+ done
+fi
+
grep '^File:' WHENCE | sed -e's/^File: *//g' -e's/"//g' | while read f; do
- test -f "$f" || continue
- $verbose "copying file $f"
- install -d $destdir/$(dirname "$f")
- cp -d "$f" $destdir/"$f"
+ test -f "$f$cmpxtn" || continue
+ $verbose "copying file $f$cmpxtn"
+ install -d $destdir/$(dirname "$f$cmpxtn")
+ cp -d "$f$cmpxtn" $destdir/"$f$cmpxtn"
done
grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; do
- if test -L "$f"; then
- test -f "$destdir/$f" && continue
- $verbose "copying link $f"
- install -d $destdir/$(dirname "$f")
+ if test -L "$f$cmpxtn"; then
+ test -f "$destdir/$f$cmpxtn" && continue
+ $verbose "copying link $f$cmpxtn"
+ install -d $destdir/$(dirname "$f$cmpxtn")
cp -d "$f" $destdir/"$f"
if test "x$d" != "x"; then
- target=`readlink "$f"`
+ target=`readlink "$f$cmpxtn"`
if test "x$target" != "x$d"; then
$verbose "WARNING: inconsistent symlink target: $target != $d"
else
if test "x$prune" != "xyes"; then
- $verbose "WARNING: unneeded symlink detected: $f"
+ $verbose "WARNING: unneeded symlink detected: $f$cmpxtn"
else
- $verbose "WARNING: pruning unneeded symlink $f"
- rm -f "$f"
+ $verbose "WARNING: pruning unneeded symlink $f$cmpxtn"
+ rm -f "$f$cmpxtn"
fi
fi
else
- $verbose "WARNING: missing target for symlink $f"
+ $verbose "WARNING: missing target for symlink $f$cmpxtn"
fi
else
- $verbose "creating link $f -> $d"
- install -d $destdir/$(dirname "$f")
- ln -sf "$d" "$destdir/$f"
+ $verbose "creating link $f$cmpxtn -> $d$cmpxtn"
+ install -d $destdir/$(dirname "$f$cmpxtn")
+ ln -sf "$d$cmpxtn" "$destdir/$f$cmpxtn"
fi
done
--
2.38.1

View File

@ -1,40 +0,0 @@
From 6208866dbef0b336e2b63695b27d61d95ace5721 Mon Sep 17 00:00:00 2001
Message-Id: <6208866dbef0b336e2b63695b27d61d95ace5721.1686643559.git.jstancek@redhat.com>
From: Jan Stancek <jstancek@redhat.com>
Date: Tue, 13 Jun 2023 09:26:08 +0200
Subject: [PATCH] copy-firmware.sh: don't add cmpxtn to directory links
Content-type: text/plain
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
copy-firmware.sh | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/copy-firmware.sh b/copy-firmware.sh
index fc419a340c48..acd095ac8952 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -77,9 +77,17 @@ grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; d
$verbose "WARNING: missing target for symlink $f$cmpxtn"
fi
else
- $verbose "creating link $f$cmpxtn -> $d$cmpxtn"
- install -d $destdir/$(dirname "$f$cmpxtn")
- ln -sf "$d$cmpxtn" "$destdir/$f$cmpxtn"
+ mkdir -p $(dirname "$f")
+ if test -d $(dirname "$f")/"$d"; then
+ # don't add compression extension to directory symlinks
+ $verbose "creating dir link $f -> $d"
+ install -d $destdir/$(dirname "$f")
+ ln -sf "$d" "$destdir/$f"
+ else
+ $verbose "creating link $f$cmpxtn -> $d$cmpxtn"
+ install -d $destdir/$(dirname "$f$cmpxtn")
+ ln -sf "$d$cmpxtn" "$destdir/$f$cmpxtn"
+ fi
fi
done
--
2.31.1

View File

@ -0,0 +1,54 @@
From d50d13a9d8c3863a847077e6357fdde2bf39a88f Mon Sep 17 00:00:00 2001
Message-Id: <d50d13a9d8c3863a847077e6357fdde2bf39a88f.1688365829.git.jstancek@redhat.com>
From: Jan Stancek <jstancek@redhat.com>
Date: Mon, 3 Jul 2023 08:30:14 +0200
Subject: [PATCH] copy-firmware.sh: don't add compext to directory links
Content-type: text/plain
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
Makefile | 2 +-
copy-firmware.sh | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 50a4c29be5b4..a5480eee0730 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ install:
install-xz:
install -d $(DESTDIR)$(FIRMWAREDIR)
- ./copy-firmware.sh --xz $(DESTDIR)$(FIRMWAREDIR)
+ ./copy-firmware.sh -v --xz $(DESTDIR)$(FIRMWAREDIR)
install-zst:
install -d $(DESTDIR)$(FIRMWAREDIR)
diff --git a/copy-firmware.sh b/copy-firmware.sh
index 58eb7e39ffb7..71f6be02d4cb 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -94,9 +94,17 @@ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
$verbose "WARNING: missing target for symlink $f"
fi
else
- install -d "$destdir/$(dirname "$f")"
- $verbose "creating link $f$compext -> $d$compext"
- ln -s "$d$compext" "$destdir/$f$compext"
+ mkdir -p $(dirname "$f")
+ if test -d $(dirname "$f")/"$d"; then
+ # don't add compression extension to directory symlinks
+ $verbose "creating dir link $f -> $d"
+ install -d $destdir/$(dirname "$f")
+ ln -sf "$d" "$destdir/$f"
+ else
+ $verbose "creating link $f$compext -> $d$compext"
+ install -d $destdir/$(dirname "$f$compext")
+ ln -sf "$d$compext" "$destdir/$f$compext"
+ fi
fi
done
--
2.31.1

View File

@ -1,11 +1,11 @@
%global debug_package %{nil}
%global firmware_release 136
%global firmware_release 137
%global _firmwarepath /usr/lib/firmware
%define _binaries_in_noarch_packages_terminate_build 0
Name: linux-firmware
Version: 20230525
Version: 20230625
Release: %{firmware_release}%{?dist}
Summary: Firmware files used by the Linux kernel
License: GPL+ and GPLv2+ and MIT and Redistributable, no modification permitted
@ -13,8 +13,7 @@ URL: http://www.kernel.org/
BuildArch: noarch
Source0: https://www.kernel.org/pub/linux/kernel/firmware/%{name}-%{version}.tar.xz
Patch1: 0001-Add-support-for-compressing-firmware-in-copy-firmwar.patch
Patch2: 0001-copy-firmware.sh-don-t-add-cmpxtn-to-directory-links.patch
Patch1: 0001-copy-firmware.sh-don-t-add-compext-to-directory-link.patch
BuildRequires: git-core
BuildRequires: make
@ -272,7 +271,7 @@ mkdir -p %{buildroot}/%{_firmwarepath}
mkdir -p %{buildroot}/%{_firmwarepath}/updates
%if 0%{?fedora} >= 34 || 0%{?rhel} >= 9
make DESTDIR=%{buildroot}/ FIRMWAREDIR=%{_firmwarepath} installcompress
make DESTDIR=%{buildroot}/ FIRMWAREDIR=%{_firmwarepath} install-xz
%else
make DESTDIR=%{buildroot}/ FIRMWAREDIR=%{_firmwarepath} install
%endif
@ -442,6 +441,44 @@ sed -e 's/^/%%dir /' linux-firmware.dirs >> linux-firmware.files
%{_firmwarepath}/netronome/*
%changelog
* Mon Jul 3 2023 Jan Stancek <jstancek@redhat.com> - 20230625-137
- Fix PSR-SU issues with kernel 6.2 or later (rhbz 2218668)
- Update to upstream 20230625 release.
Changes since the last update are noted on items below, copied from
the git changelog of upstream linux-firmware repository.
- Makefile, copy-firmware: support xz/zstd compressed firmware
- copy-firmware: silence the last shellcheck warnings
- copy-firmware: drop obsolete backticks, quote
- copy-firmware: tweak sed invocation
- copy-firmware: quote deskdir and dirname
- check_whence: error if symlinks are in-tree
- check_whence: error if File: is actually a link
- check_whence: strip quotation marks
- linux-firmware: wilc1000: update WILC1000 firmware to v16.0
- ice: update ice DDP wireless_edge package to 1.3.10.0
- amdgpu: DMCUB updates for DCN 3.1.4 and 3.1.5
- amdgpu: update DMCUB to v0.0.172.0 for various AMDGPU ASICs
- fix broken cirrus firmware symlinks
- qcom: Update the microcode files for Adreno a630 GPUs.
- qcom: sdm845: rename the modem firmware
- qcom: sdm845: update remoteproc firmware
- rtl_bt: Update RTL8852A BT USB firmware to 0xDAC7_480D
- rtl_bt: Update RTL8852C BT USB firmware to 0x040D_7225
- amdgpu: DMCUB updates for various AMDGPU asics
- linux-firmware: update firmware for MT7922 WiFi device
- linux-firmware: update firmware for MT7921 WiFi device
- linux-firmware: update firmware for mediatek bluetooth chip (MT7922)
- linux-firmware: update firmware for mediatek bluetooth chip (MT7921)
- i915: Add HuC v8.5.0 for MTL
- mediatek: Update mt8195 SCP firmware to support hevc
- qcom: apq8016: add Dragonboard 410c WiFi and modem firmware
- cirrus: Add firmware for new Asus ROG Laptops
- brcm: Add symlinks from Pine64 devices to AW-CM256SM.txt
- amdgpu: Update GC 11.0.1 and 11.0.4
- rtw89: 8851b: add firmware v0.29.41.0
- ice: update ice DDP comms package to 1.3.40.0
- cxgb4: Update firmware to revision 1.27.3.0
* Wed Jun 28 2023 Jan Stancek <jstancek@redhat.com> - 20230525-136
- fix broken symlink /usr/lib/firmware/qcom/LENOVO/21BX.xz (rhbz 2214391)

View File

@ -1 +1 @@
SHA512 (linux-firmware-20230525.tar.xz) = e3b7b4b3e7ad0464d8c21b9e434975da7124c2a57bb715325393095134b8cdf5f329f9e6ac9432440933ba05206d03cff4f1c950ad6d346fd2ac0a81bc8b7655
SHA512 (linux-firmware-20230625.tar.xz) = 0b40334b7baaf7b24a849b97abb8aceaf042a514eaf519acd3b0e9a0c9db7a3a668312225c43c7427bcffa4c67bc0ec4e182cc2a9ffdd05227b183878088a288