commit 6ed00cc2bf7e82788effb151798a4f6e1c1371498c010b354510d7436498657e Author: Michal Suchanek Date: Thu Jan 26 09:38:15 2023 +0000 Accepting request 1061124 from home:jirislaby An utility to dump iwl firmware states on errors. OBS-URL: https://build.opensuse.org/request/show/1061124 OBS-URL: https://build.opensuse.org/package/show/hardware/iwlfwdump?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/50-iwlfwdump.rules b/50-iwlfwdump.rules new file mode 100644 index 0000000..1c42a84 --- /dev/null +++ b/50-iwlfwdump.rules @@ -0,0 +1 @@ +SUBSYSTEM=="devcoredump", ACTION=="add", RUN+="/sbin/iwlfwdump" diff --git a/iwlfwdump b/iwlfwdump new file mode 100644 index 0000000..ba4fa46 --- /dev/null +++ b/iwlfwdump @@ -0,0 +1,12 @@ +#!/bin/bash + +FAILDRV=$(readlink "/sys/${DEVPATH}/failing_device/driver") +FAILDRV=$(basename "$FAILDRV") + +test "$FAILDRV" = 'iwlwifi' || exit 0 + +TIMESTAMP=$(date +%Y%m%d-%H%M%S) +OUT="/var/log/iwl-fw-error-${TIMESTAMP}.dump" +umask 0077 +cat "/sys/${DEVPATH}/data" > "${OUT}" +echo 1 > "/sys/${DEVPATH}/data" diff --git a/iwlfwdump.changes b/iwlfwdump.changes new file mode 100644 index 0000000..3d02c10 --- /dev/null +++ b/iwlfwdump.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Thu Jan 26 06:39:14 UTC 2023 - Jiri Slaby + +- initial package diff --git a/iwlfwdump.spec b/iwlfwdump.spec new file mode 100644 index 0000000..dadf487 --- /dev/null +++ b/iwlfwdump.spec @@ -0,0 +1,52 @@ +# +# spec file for package iwlfwdump +# +# Copyright (c) 2023 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + +%if ! %{defined _distconfdir} +%define _distconfdir %{_sysconfdir} +%endif + +Name: iwlfwdump +Version: 1 +Release: 0 +Summary: Firmware dump utility +License: GPL-2.0-only +URL: https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi/debugging +Source0: 50-iwlfwdump.rules +Source1: iwlfwdump +Source2: logrotate +Recommends: logrotate +Buildarch: noarch + +%description +An utility to automatically dump firmware dumps to /var/log/. + +%prep + +%build + +%install +install -d %{buildroot}%{_sbindir}/ %{buildroot}%_udevrulesdir/ %{buildroot}%{_distconfdir}/logrotate.d/ +install -m 644 %SOURCE0 %{buildroot}/%{_udevrulesdir}/ +install -m 755 %SOURCE1 %{buildroot}/%{_sbindir}/ +install -m 644 %SOURCE2 %{buildroot}/%{_distconfdir}/logrotate.d/%{name} + +%files +%_udevrulesdir/50-iwlfwdump.rules +%{_sbindir}/iwlfwdump +%{_distconfdir}/logrotate.d/%{name} + +%changelog diff --git a/logrotate b/logrotate new file mode 100644 index 0000000..373145a --- /dev/null +++ b/logrotate @@ -0,0 +1,7 @@ +/var/log/iwl-fw-error-*.dump { + compress + missingok + nocreate + weekly + maxage 30 +}