[pkg-nvidia-devel] r1361 - in /packages/nvidia-graphics-drivers/trunk/debian: changelog extract-pci-ids.sh

anbe-guest at users.alioth.debian.org anbe-guest at users.alioth.debian.org
Sat Jul 10 22:58:16 UTC 2010


Author: anbe-guest
Date: Sat Jul 10 22:58:15 2010
New Revision: 1361

URL: http://svn.debian.org/wsvn/pkg-nvidia/?sc=1&rev=1361
Log:
add helper script to extract the supported PCI IDs from nv-kernel.o

Added:
    packages/nvidia-graphics-drivers/trunk/debian/extract-pci-ids.sh
Modified:
    packages/nvidia-graphics-drivers/trunk/debian/changelog

Modified: packages/nvidia-graphics-drivers/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/changelog?rev=1361&op=diff
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/changelog (original)
+++ packages/nvidia-graphics-drivers/trunk/debian/changelog Sat Jul 10 22:58:15 2010
@@ -32,6 +32,9 @@
   * Remove possible LEGACY part from virtual package name
     nvidia-kernel-NVIDIAVERSION (provided by the kernel module).
   * Add a new substvar for marking the special driver from the NVIDIA Perfkit.
+  * Add helper script debian/extract-pci-ids.sh to extract the PCI IDs of
+    supported devices from nv-kernel.o.  Based on the nvidia_supported script
+    found in Ubuntu's nvidia-current package.  Refresh nv-kernel.ids.
 
  -- Andreas Beckmann <debian at abeckmann.de>  Wed, 23 Jun 2010 08:33:44 +0200
 

Added: packages/nvidia-graphics-drivers/trunk/debian/extract-pci-ids.sh
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/extract-pci-ids.sh?rev=1361&op=file
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/extract-pci-ids.sh (added)
+++ packages/nvidia-graphics-drivers/trunk/debian/extract-pci-ids.sh Sat Jul 10 22:58:15 2010
@@ -1,0 +1,45 @@
+#!/bin/sh
+# Based on the nvidia_supported script from Ubuntu's nvidia-current package.
+#set -e
+
+
+[ -n "$1" ] || {
+  echo "USAGE: $0 path/to/nv/nv-kernel.o" >&2
+  exit 1
+}
+
+device_ids() {
+  local filename="$1"
+
+  local list_prev="$(mktemp)"
+  local list_cur="$(mktemp)"
+
+  # Find the symbols of the .rodata section...
+  objdump --section=.rodata --syms "$filename" |
+  sed -nr 's/^([0-9a-f]+)\s+l\s+O\s+\S+\s+([0-9a-f]+)\s+\S+.*/\1 \2/p' |
+  while read start length; do
+    objdump --section=.rodata --full-contents \
+      --start-address="0x$start" \
+      --stop-address="$((0x$start+0x$length))" "$filename" |
+    sed -nr 's/^ [0-9a-f]+ ([0-9a-f]{2})([0-9a-f]{2})0000.*/\2\1/p' |
+    sort | uniq | grep -vx "0000" >"$list_cur"
+
+    # The consistent thing between different releases has been that there are
+    # two subsequent symbols with the same PCI ID list near the beginning. Find
+    # them.
+    if [ -s "$list_prev" -a -s "$list_cur" ] &&
+       cmp -s "$list_prev" "$list_cur"; then
+      cat "$list_cur"
+      break
+    fi
+
+    cp "$list_cur" "$list_prev"
+  done
+
+  rm -f "$list_prev" "$list_cur"
+}
+
+for id in $(device_ids "$1"); do
+  echo 10de$id
+done
+




More information about the Pkg-nvidia-devel mailing list