#!/bin/sh
module="mpc429LNX"
device="mpc429_"
mode="666"

# invoke insmod with all arguments we were passed
# and use a pathname, as newer modutils don't look in . by default
#/sbin/insmod -f ./$module.o $* || exit 1
insmod -f ./$module.ko $* p0=0x350 r0=6  r1=5|| exit 1

# remove stale nodes
rm -f /dev/${device}[0-7]


major=`awk "\\$2==\"$device\" {print \\$1}" /proc/devices`


mknod /dev/${device}0 c $major 0
#mknod /dev/${device}1 c $major 1
#mknod /dev/${device}2 c $major 2
#mknod /dev/${device}3 c $major 3
#mknod /dev/${device}4 c $major 4
#mknod /dev/${device}5 c $major 5
#mknod /dev/${device}6 c $major 6
#mknod /dev/${device}7 c $major 7

# give appropriate group/permissions, and change the group.
# Not all distributions have staff; some have "wheel" instead.
group="staff"
grep '^staff:' /etc/group > /dev/null || group="wheel"

chgrp $group /dev/${device}[0-7]
chmod $mode /dev/${device}[0-7]

