#!/bin/sh module="pci_avnet" #device="pci_avnet" dev0="av_sram" dev1="av_flash" dev2="av_ctrlreg" dev3="av_led" mode="777" # Group: since distributions do it differently, look for wheel or use staff if grep '^staff:' /etc/group > /dev/null; then group="staff" else group="wheel" fi # invoke insmod with all arguments we got # and use a pathname, as newer modutils don't look in . by default /sbin/insmod ./$module.ko $* || exit 1 major=$(awk "\$2==\"$module\" {print \$1}" /proc/devices) echo ${major} rm -f /dev/${dev0} rm -f /dev/${dev1} rm -f /dev/${dev2} rm -f /dev/${dev3} mknod /dev/${dev0} c $major 0 mknod /dev/${dev1} c $major 1 mknod /dev/${dev2} c $major 2 mknod /dev/${dev3} c $major 3 chgrp $group /dev/${dev0} chgrp $group /dev/${dev1} chgrp $group /dev/${dev2} chgrp $group /dev/${dev3} chmod $mode /dev/${dev0} chmod $mode /dev/${dev1} chmod $mode /dev/${dev2} chmod $mode /dev/${dev3} #major='cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"` #echo major is ${major} # Create 8 entry points, as SHORT_NR_PORTS is 8 by default #rm -f /dev/${device} #mknod /dev/${device} c $major 0 #chgrp $group /dev/${device} #chmod $mode /dev/${device}