[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



On Sunday 31 December 2006 11:14, Petter Reinholdtsen wrote:
> 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.

I have reworked the patch a bit and was going to commit when I noticed two 
commands are used that are not supported in the d-i environment: awk and 
xargs.

Can you please have a look at fixing that?

Cheers,
FJP

Index: report-hw
===================================================================
--- report-hw	(revision 43840)
+++ report-hw	(working copy)
@@ -14,11 +14,30 @@
 	fi
 }
 
+list_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
+}
+
 uname -a 2>&1 | addinfo "umame -a"
 
 if type lspci >/dev/null 2>&1; then
 	lspci -nn  2>&1 | addinfo "lspci -nn"
 	lspci -vnn 2>&1 | addinfo "lspci -vnn"
+
+	# List which modules are referring to which PCI devices
+	if [ -d /sys/bus/pci/devices ] ; then
+		# Avoid working directory change
+		( list_loaded_modules ) | addinfo modulemap
+	fi
 else
 	addfile /proc/pci
 	addfile /proc/bus/pci/devices

Attachment: pgpAVqm6pe3Qg.pgp
Description: PGP signature


Reply to: