#! /bin/sh
# Silly wrapping of insmod to allow dynamic major numbers
#

FILE="cxdrv.o"
DEV="cx100"

/sbin/insmod -f $FILE $*  || exit 1

#make nodes
cd /dev
rm -f cxg0 cxg0ol cxg0f cxg0pgm
rm -f cxg1 cxg1ol cxg1f cxg1pgm
rm -f cxg2 cxg2ol cxg2f cxg2pgm
rm -f cxg3 cxg3ol cxg3f cxg3pgm

major=`grep $DEV /proc/devices | awk "{print \\$1}"`

mknod cxg0    c $major 0
mknod cxg1    c $major 1
mknod cxg2    c $major 2
mknod cxg3    c $major 3

mknod cxg0ol  c $major 16
mknod cxg1ol  c $major 17
mknod cxg2ol  c $major 18
mknod cxg3ol  c $major 19

mknod cxg0f   c $major 32
mknod cxg1f   c $major 33
mknod cxg2f   c $major 34
mknod cxg3f   c $major 35

mknod cxg0pgm c $major 48
mknod cxg1pgm c $major 49
mknod cxg2pgm c $major 50
mknod cxg3pgm c $major 51


#edit this one to suit your needs
chmod go+rw /dev/cxg*


