Re: /proc/pci deprecation?

From: Tomas Szepe (szepe@pinerecords.com)
Date: Sat Dec 07 2002 - 08:20:00 EST


> > It is invaluable during installation, when no lspci is installed yet.
> > I know that I need e100/eepro100 for
> > 'Ethernet controller: Intel Corp. 82801BA/BAM/CA/CAM E', but I do not
> > have even slightest idea what device 8086:2449 is, whether USB or NIC or
> > VGA or some bridge.
>
> at least, the file "modules.pcimap" tells you which modules support these
> devices, by vendor/model codes. I once developped a little installation script
> which loaded all the NICs it could by listing /proc/bus/pci/devices and
> modules.pcimap. I too agree that names in /proc/pci are *really* useful, but I
> often omit them when I need a very little image. Perhaps having a list of names
> only for devices supported by the kernel and modules at compile time would be
> an acceptable compromise?

I've been using the following script in my install images to find kernel
modules for various PCI devices (the mechanism's not perfect, though,
I know of at least one module that "doesn't put" its ids in modules.pcimap):

#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin

PCIMAP=/lib/modules/$(uname -r)/modules.pcimap
ALLDEV=$(lspci -n| sed -e 's/^.*:[[:blank:]]\+\([^[:blank:]]\+\).*$/\1/')

if [ -n "$ALLDEV" -a -r $PCIMAP ]; then
  for i in $ALLDEV; do
    VENDOR="$(echo $i| cut -d':' -f1)"
    DEVICE="$(echo $i| cut -d':' -f2)"
    MODULE=$(grep "0x0000$VENDOR[[:blank:]]\+0x0000$DEVICE" $PCIMAP| \
      awk '{ print $1; }')
    echo -n "Vendor $VENDOR, dev $DEVICE: "
    if [ -n "$MODULE" ]; then
      echo $MODULE
    else
      echo "(no matching module)"
    fi
  done
fi

-- 
Tomas Szepe <szepe@pinerecords.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:29 EST