]> git.pld-linux.org Git - packages/afbinit.git/blob - afbinit.init
- initial
[packages/afbinit.git] / afbinit.init
1 #!/bin/sh
2 #
3 # afbinit       firmware loader for Elite 3D cards
4 #
5 # chkconfig:    2345 90 10
6 #
7 # description:  Load microcode at boottime to all detected Elite3D
8 #               graphics cards.
9 #
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 UCODE=/lib/firmware/afb.ucode
15 LOADER=/usr/sbin/afbinit
16
17 ARCH=$(uname -m)
18 # If this is not sparc64, get out of here.
19 if [ "$ARCH" != "sparc64" ]; then
20         echo "$ARCH cannot have AFB"
21         return 1
22 fi
23         
24 # The microcode loader binary and the microcode
25 # itself must exist.
26 if [ ! -x $LOADER ]; then
27         echo "Missing afbinit"
28         return 1
29 fi
30         
31 if [ ! -f $UCODE ]; then
32         echo "Missing microcode"
33         return 1
34 fi
35         
36 # Make FB device list.
37 afb_devs=$(awk '/Elite/ {printf "fb%d\n",$1}' /proc/fb) 
38 if [ -z "$afb_devs" ]; then
39         echo "No AFB detected"
40         return 1
41 fi
42
43 start()
44 {
45         # Load microcode onto each card.
46         for afb in $afb_devs; do
47                 show "Starting afbinit for $afb device "
48                 busy
49                 $LOADER /dev/$afb $UCODE > /dev/null
50                 RETVAL=$?
51                 [ $RETVAL -eq 0 ] && ok || fail
52         done
53 }
54
55 case "$1" in
56         start|restart|reload)
57                 start
58                 ;;
59         stop)
60                 ;;
61         *)
62                 msg_usage "$0 {start|stop|restart|reload}"
63                 exit 3
64                 ;;
65 esac
This page took 0.076147 seconds and 4 git commands to generate.