This should behave exactly the same under 2.4 as the existing script, but
also function under 2.6 (using /sys/class/graphics/fb?).
Tested under 2.6.15 on Ultra80 with 2x Creator3D-m6, not yet tested on
2.4.x (but runs exactly the same code....)
(2.6.15 also needs the afbinit patch in #346085 to actually run)
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
set -e
# This only applies to UltraSPARC's
[ `uname -m` = "sparc64" ] || exit 0
# The microcode loader binary and the microcode itself must exist.
if [ ! -x /usr/sbin/afbinit -o ! -f /usr/lib/afb.ucode ]; then
exit
fi
case "$1" in
start)
# For kernel 2.6.x, we have sysfs available...
# /proc/fb *looks* like it could be used, but acts strangely on reads.
# (Why does "cat /dev/fb" work, but "cat /dev/fb > /tmp/fb.txt" fail?)
# Check all framebuffer devices...
for FB in /sys/class/graphics/fb? ; do
AFB=`basename ${FB}`
# If they are Elite 3Ds, then load microcode, otherwise do
nothing
if [ `grep -c "Elite 3D" ${FB}/name` -ne 0 ]; then
echo -n "${AFB}: Loading Elite3D microcode... "
/usr/sbin/afbinit /dev/${AFB} /usr/lib/afb.ucode
echo "done."
fi
done
# For kernel 2.4.x, we still need to grovel through dmesg, sigh...
if [ `/bin/dmesg | grep -c "Elite 3D"` -ne 0 ]; then
# Make FB device list. (Just hope dmesg buffer was big
enough...)
afb_devs=`/bin/dmesg | /bin/egrep -i "Elite 3D" | /bin/sed
's/\:.*//'`
for AFB in ${afb_devs}; do
echo -n "${AFB}: Loading Elite3D microcode... "
/usr/sbin/afbinit /dev/${AFB} /usr/lib/afb.ucode
echo "done."
done
fi
;;
stop|restart|force-reload) # Nothing
;;
*)
echo "Usage: $0 start" >&2
exit 1
;;
esac
exit 0