examples/msr/msr_load
author Florian Pose <fp@igh-essen.com>
Tue, 26 Sep 2006 16:38:38 +0000
branchstable-1.1
changeset 1728 4cf9c3e9f0bd
parent 232 f6594a07cdda
permissions -rwxr-xr-x
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
224
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
#!/bin/sh 
232
f6594a07cdda MSR example finished.
Florian Pose <fp@igh-essen.com>
parents: 224
diff changeset
     2
module="ec_msr_sample"
224
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
device="msr"
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
mode="664"
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
# Group: since distributions do it differently, look for wheel or use staff
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
if grep '^staff:' /etc/group > /dev/null; then
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
    group="staff"
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
else
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
    group="wheel"
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
fi
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
# invoke insmod with all arguments we got
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
# and use a pathname, as newer modutils don't look in . by default
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
/sbin/insmod -f ./$module.ko $* || exit 1
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
major=`cat /proc/devices | awk "\\$2==\"$device\" {print \\$1}"`
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
echo $major
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
# Remove stale nodes and replace them, then give gid and perms
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
# Usually the script is shorter, it's scull that has several devices in it.
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
rm -f /dev/${device}
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
mknod /dev/${device} c $major 0
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
# ln -sf ${device}0 /dev/${device}
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
chgrp users /dev/${device}
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
chmod $mode  /dev/${device}
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
4828e5e419bf Renamed rt example to msr.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36