[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module



Package:  installation-report
Version:  2.25
Severity: important
Tags:     patch

In bug #403876 I got code for discover-data from Auke Kok to extract
which PCI devices the various kernel modules are attached to.  This
information would make it a lot easier to figure out which kernel
module have a problem if the Debian installation isn't working as it
should, so I believe it is important to get it included in the
installation-report package in Etch.  I set severity important because
of this.

Here is a patch to enable it, based on the current svn code.  I've
tested it on my installed system, but not in the udeb / d-i
environment.  I'm not sure if for example awk, sed and the /sys/ mount
point is available in that environment, so it might fail there.

Index: report-hw
===================================================================
--- report-hw	(revision 43704)
+++ report-hw	(working copy)
@@ -17,9 +17,11 @@
 uname -a 2>&1 | addinfo "umame -a"
 
 if type lspci >/dev/null 2>&1; then
+	lspci=lspci
 	lspci -nn  2>&1 | addinfo "lspci -nn"
 	lspci -vnn 2>&1 | addinfo "lspci -vnn"
 elif /target/usr/bin/lspci >/dev/null; then
+	lspci=/target/usr/bin/lspci
 	/target/usr/bin/lspci -nn 2>&1 | addinfo "lspci -nn"
 	/target/usr/bin/lspci -vnn 2>&1 | addinfo "lspci -vnn"
 else
@@ -49,3 +51,20 @@
 		/usr/lib/directfb-0.9.25/bin/dfbinfo 2>&1 | addinfo dfbinfo
 	fi
 fi
+
+# List which modules are refering to which PCI devices
+if [ "$lspci" ] && [ -d /sys/bus/pci/devices ] ; then
+    echo loaded modules:
+    (
+	cd /sys/bus/pci/devices
+	for address in * ; do
+	    if [ -d "$address/driver/module" ] ; then
+		module=`cd $address/driver/module ; pwd -P | xargs basename`
+		if grep -q "^$module " /proc/modules ; then
+		    address=$(echo $address |sed s/0000://)
+		    echo "`lspci -n -s $address | tail -n 1 | awk '{print $3}'` $module"
+		fi
+	    fi
+	done
+    ) | addinfo modulemap
+fi



Reply to: