#!/bin/bash
# 
# A small script to load a kernel module and
# make the corresponding files in /dev/

module="memmap"
device="memmap"
group="root"
mode="664"

# start up module
/sbin/insmod -f $module $* || exit 1

#remove stale nodes
rm -f /dev/${device}

major=`cat /proc/devices | awk ""\\$2==\"$module"\" {print \\$1}"`

mknod /dev/${device} c $major 0

#change permissions
chgrp $group /dev/${device}
chmod $mode /dev/${device} 
