Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

nvidia_supported for paldo
Saturday, June 23rd, 2007 at 9:07:41am UTC 

  1. #!/bin/sh -e
  2.  
  3. # Install linux-restricted-modules and binutils, start the script, and put its
  4. # output to modalias_override/nvidia.
  5.  
  6. # This is a nasty kluge, but it seems to work. Better check the output when
  7. # upgrading to a new release of the nvidia driver, though.
  8.  
  9. # Whenever a PCI ID is supported by both nvidia and nvidia_legacy, it is only
  10. # listed for nvidia.
  11.  
  12. echo "# Listing generated by nvidia_supported. Do not edit manually."
  13.  
  14. device_ids() {
  15.         local filename="$1"
  16.  
  17.         # Find the first symbol of the .rodata section...
  18.         objdump --section=.rodata --syms "$filename" |
  19.         sed -n '/SYMBOL TABLE/,+2 {
  20.           s/^\([0-9a-f]\+\)\s\+l\s\+O\s\+\S\+\s\+\([0-9a-f]\+\)\s\+\(\S\+\).*/\1 \2 \3/p
  21.         }' |
  22.         while read start stop symname; do
  23.                 # ...and grab the IDs from its hex dump.
  24.                 objdump --section=.rodata --full-contents \
  25.                   --start-address="0x$start" --stop-address="0x$stop" "$filename" |
  26.                 sed -n 's/^ [0-9a-f]\+ \([0-9a-f]\{2\}\)\([0-9a-f]\{2\}\).*/\2\1/p' |
  27.                 sort | uniq
  28.         done
  29. }
  30.  
  31. set -- "/lib/modules/$(uname -r)/kernel/drivers/video/nvidia.ko" nvidia \
  32.   "/lib/modules/$(uname -r)/kernel/drivers/video/nvidia_96xx.ko" nvidia_96xx \
  33.   "/lib/modules/$(uname -r)/kernel/drivers/video/nvidia_71xx.ko" nvidia_71xx \
  34.  
  35. seen_ids=' '
  36.  
  37. while [ -n "$1" ]; do
  38.         filename="$1"; shift
  39.         modname="$1";  shift
  40.  
  41.         orig_ids="$(device_ids "$filename")"
  42.         ids=''
  43.  
  44.         for id in $orig_ids; do
  45.                 case "$seen_ids" in
  46.                 *" $id "*)
  47.                         # Already seen the ID.
  48.                         ;;
  49.                 *)
  50.                         # Not seen it yet.
  51.                         seen_ids="${seen_ids}${id} "
  52.                         ids="$ids $id"
  53.                         ;;
  54.                 esac
  55.         done
  56.  
  57.         for id in $ids; do
  58.                 printf "alias pci:v%08Xd%08Xsv*sd*bc03sc*i* %s\n" \
  59.                   0x10de "0x$id" "$modname"
  60.         done
  61. done | sort

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right