Linux HOWTOs

About | Home | Search


HOWTO: pciutils
Description: Configure/list PCI devices
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# pciutils 2.2.6
# ===============
# Slackware 8.1's 'pciutils' package includes version 2.1.10, 9.0's, 9.1's,
# 10.0's, 10.1's, and 10.2's include 2.1.11, 11.0's includes 2.2.3, and
# 12.0's includes 2.2.5

# The "home" download URL is ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/
# but I almost always have trouble getting there

# If you have a pciutils that was installed into /usr/local, follow the
# uninstall instructions at the bottom before continuing below

cd
test -f installed/pciutils-2.2.6.tar.bz2 &&
 mv installed/pciutils-2.2.6.tar.bz2 .
test ! -f pciutils-2.2.6.tar.bz2 &&
 wget http://ftp.kernel.org/pub/software/utils/pciutils/\
pciutils-2.2.6.tar.bz2

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "80643f3fb571b489fc9fda4faff03aee  pciutils-2.2.6.tar.bz2" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "95cb624280e737143f97c1d5e22f471f41b45222  pciutils-2.2.6.tar.bz2" | \
 sha1sum -c

# Verify tarall w/ gpg:
( gpg --list-keys 517D0F0E > /dev/null 2>&1 || gpg --recv-keys 517D0F0E ) &&
 wget -nc http://ftp.kernel.org/pub/software/utils/pciutils/\
pciutils-2.2.6.tar.bz2.sign &&
  gpg --verify pciutils-2.2.6.tar.bz2.sign && rm pciutils-2.2.6.tar.bz2.sign

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "pciutils-*" -exec rm -r {} \;
tar xjvf ~/pciutils-2.2.6.tar.bz2
cd pciutils-2.2.6
test $UID = 0 && chown -R root:root .

# Update the update-pciids.sh script with a new URL to get
# the pci.ids file from, and a new location for the new one
cat update-pciids.sh | sed \
 -e 's%SRC="http://pciids.sourceforge.net/v2.2/pci.ids"%\
SRC="http://pciids.sourceforge.net/pci.ids"%' \
 -e 's%DEST=pci.ids%DEST=/usr/share/pci.ids%' > update-pciids.sh.new
test -s update-pciids.sh.new &&
 ( diff -q update-pciids.sh update-pciids.sh.new
   test $? -eq 1 &&
    ( mv update-pciids.sh update-pciids.sh.old
      mv update-pciids.sh.new update-pciids.sh ))

# Build the new version
make PREFIX=/usr SBINDIR=/sbin

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg pciutils
rm -f /usr/sbin/pcimodules /usr/man/man8/pcimodules.8
make install PREFIX=/usr SBINDIR=/sbin

# Create a monthly cron job to update /usr/share/pci.ids
# (you can also just run /sbin/update-pciids manually, but you'll
# probably never think of it again)
#
# If you have the /etc/cron.(hourly|daily|weekly|monthly) directories set
# up:
test -d /etc/cron.monthly &&
 ( cat << EOF > /etc/cron.monthly/pciutils
#!/bin/sh
/sbin/update-pciids > /dev/null 2>&1
if [ \$? != 0 ]; then
  echo "Error running update-pciids"
  exit 1
fi
EOF
   chmod 700 /etc/cron.monthly/pciutils )
#
## If not, create a cron job like this to run it on the 15th of every month
## at 2:34am:
# 34 2 15 * *	/sbin/update-pciids

# And run it manually now:
/sbin/update-pciids

# Become yourself again
exit

cd
rm -f installed/pciutils-*.tar.*
mv pciutils-2.2.6.tar.bz2 installed/

# If you find that you have new IDs to add, go here:
# http://pciids.sf.net/


# If you ever want to uninstall pciutils, try this:
cd
DIR=`find src -maxdepth 1 -type d -name "pciutils-*" | sort | tail`
test -s "$DIR" && ( cd $DIR ; make uninstall )
su
removepkg pciutils
for pfx in /usr/local /usr;
do
  rm -f $pfx/sbin/lspci $pfx/sbin/setpci $pfx/sbin/update-pciids \
   $pfx/share/pci.ids \
   $pfx/man8/lspci.8 $pfx/man8/setpci.8 $pfx/man8/update-pciids.8
done
( cd /sbin ; rm -f lspci setpci update-pciids )
exit
find src -maxdepth 1 -type d -name "pciutils-*" -exec rm -r {} \;
rm -f installed/pciutils-*.tar.*

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>