afbinit improvements

"Dominik 'Rathann' Mierzejewski" <[email protected]> Wed, 27 Apr 2005 22:51:28 +0200
Newsgroups gmane.linux.aurora.devel
Message-ID <[email protected]>
Attached are:
my improved spec file
patch to rc.afb combining gentoo's and my own improvements
patch to Makefile allowing to build a 64bit binary
a manpage from gentoo (AFAIR)

I hope it'll be useful. Sorry for not providing a patch for the
specfile.

-- 
Dominik 'Rathann' Mierzejewski <rathann*at*icm.edu.pl>
Interdisciplinary Centre for Mathematical and Computational Modelling
Warsaw University  |  http://www.icm.edu.pl  |  tel. +48 (22) 5540810

_______________________________________________
Aurora-sparc-devel mailing list
[email protected]
http://lists.auroralinux.org/mailman/listinfo/aurora-sparc-devel
Aurora FAQ: http://www.ecs.soton.ac.uk/~mas01r/aurorafaq.html
afbinit.8 (text/plain, 2.3 KB)
.\" This -*- nroff -*- file has been generated from
.\" DocBook SGML with docbook-to-man on Debian GNU/Linux.
...\"
...\"	transcript compatibility for postscript use.
...\"
...\"	synopsis:  .P! <file.ps>
...\"
.de P!
\\&.
.fl			\" force out current output buffer
\\!%PB
\\!/showpage{}def
...\" the following is from Ken Flowers -- it prevents dictionary overflows
\\!/tempdict 200 dict def tempdict begin
.fl			\" prolog
.sy cat \\$1\" bring in postscript file
...\" the following line matches the tempdict above
\\!end % tempdict %
\\!PE
\\!.
.sp \\$2u	\" move below the image
..
.de pF
.ie     \\*(f1 .ds f1 \\n(.f
.el .ie \\*(f2 .ds f2 \\n(.f
.el .ie \\*(f3 .ds f3 \\n(.f
.el .ie \\*(f4 .ds f4 \\n(.f
.el .tm ? font overflow
.ft \\$1
..
.de fP
.ie     !\\*(f4 \{\
.	ft \\*(f4
.	ds f4\"
'	br \}
.el .ie !\\*(f3 \{\
.	ft \\*(f3
.	ds f3\"
'	br \}
.el .ie !\\*(f2 \{\
.	ft \\*(f2
.	ds f2\"
'	br \}
.el .ie !\\*(f1 \{\
.	ft \\*(f1
.	ds f1\"
'	br \}
.el .tm ? font underflow
..
.ds f1\"
.ds f2\"
.ds f3\"
.ds f4\"
'\" t 
.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n  
.TH "AFBINIT" "8" 
.SH "NAME" 
afbinit \(em Initialize the AFB microcode for Elite 3D framebuffer cards 
.SH "SYNOPSIS" 
.PP 
\fBafbinit\fP /dev/fb[0123] [ucode_file]  
.SH "DESCRIPTION" 
.PP 
This manual page documents briefly the 
\fBafbinit\fP command. 
.PP 
This manual page was written for the \fBDebian GNU/Linux\fP distribution 
because the original program does not have a manual page. 
 
.PP 
The \fBafbinit\fP command is used to initialize 
Elite 3D framebuffers with the AFB microcode that is required to use 
the accelration functions under XFree86. You need only tell it which 
framebuffer to use it on, and where the afb.ucode file is (if not in 
the default location). 
 
.SH "FILES" 
.PP 
\fB/usr/lib/afb.ucode\fP
.PP 
\fB/etc/init.d/afb\fP
.SH "AUTHOR" 
.PP 
This manual page was written by Ben Collins [email protected] for 
the \fBDebian GNU/Linux\fP system (but may be used by others).  Permission is 
granted to copy, distribute and/or modify this document under 
the terms of the GNU Free Documentation 
License, Version 1.1 or any later version published by the Free 
Software Foundation; with no Invariant Sections, no Front-Cover 
Texts and no Back-Cover Texts. 
...\" created by instant / docbook-to-man, Thu 29 Nov 2001, 21:26
afbinit-rc.patch (text/plain, 2.3 KB)
--- afbinit-1.0.1/rc.afb.rc	1999-09-08 08:42:36.000000000 +0200
+++ afbinit-1.0.1/rc.afb	2005-01-04 22:41:36.000000000 +0100
@@ -1,7 +1,11 @@
 #!/bin/bash
+#
+# afbinit	Load SUN AFB aka Elite3D firmware
+# 
+# chkconfig: 12345 01 99
+# description: Load microcode at boottime to all detected Elite3D
+#              graphics cards.
 # $Id: rc.afb,v 1.1.1.1 1999/09/08 06:42:36 davem Exp $
-# Load microcode at boottime to all detected Elite3D
-# graphics cards.
 #
 
 # If this is not sparc64 or no AFBs, get out of here.
@@ -10,11 +14,6 @@
 	exit 0
 fi
 
-if [ `/bin/dmesg | /bin/grep -c "Elite 3D"` -eq 0 ]
-then
-	exit 0
-fi
-
 # The microcode loader binary and the microcode
 # itself must exist.
 if [ ! -x /usr/sbin/afbinit -o ! -f /usr/lib/afb.ucode ]
@@ -22,13 +21,53 @@
 	exit 0
 fi
 
-# Make FB device list.
-afb_devs=`/bin/dmesg | /bin/egrep -i "Elite 3D" | /bin/sed 's/\:.*//'`
+RETVAL=0
+
+# See how we were called.
+case "$1" in
+  start)
+        if [ ! -f /var/lock/subsys/afbinit ]; then
+	    # Make FB device list, depending on which kind of kernel we have.
+	    # First, try kernel 2.4.x
+
+	    if [ `/bin/dmesg | /bin/grep -c "Elite 3D"` -gt 0 ]
+	    then
+
+		afb_devs=`/bin/dmesg | /bin/egrep -i "Elite 3D" | /bin/sed 's/\:.*//'`
+
+		# Load microcode onto each card.
+		for AFB in ${afb_devs}
+		do
+			echo -n "${AFB}: Loading Elite3D microcode... "
+			/usr/sbin/afbinit /dev/${AFB} /usr/lib/afb.ucode && touch /var/lock/subsys/sysstat
+			RETVAL=$?
+			echo "done."
+		done
+	    fi
+	    ##
+	    #	OK, we're not kernel 2.4.x
+	    #	try kernel 2.6.x
+
+	    if [ `/bin/dmesg | /bin/grep -c "ffb: AFB"` -gt 0 ]
+	    then
+
+		afb_devs=`/bin/cat -s /proc/fb  | /bin/egrep -i "Elite 3D" | /bin/sed 's/\ .*//'`
+		# Load microcode onto each card.
+		for AFB in ${afb_devs}
+		do
+			echo -n "/dev/fb/${AFB}: Loading Elite3D microcode... "
+			/usr/sbin/afbinit /dev/fb/${AFB} /usr/lib/afb.ucode && touch /var/lock/subsys/sysstat
+			RETVAL=$?
+			echo "done."
+		done
+	    fi
+	fi
+        ;;
 
-# Load microcode onto each card.
-for AFB in ${afb_devs}
-do
-	echo -n "${AFB}: Loading Elite3D microcode... "
-	/usr/sbin/afbinit /dev/${AFB} /usr/lib/afb.ucode
-	echo "done."
-done
+  stop|status|restart|reload)
+        ;;
+  *)
+        echo "Usage: afbinit {start|stop|status|restart|reload}"
+        exit 1
+esac
+exit $RETVAL
afbinit-rpm.patch (text/plain, 338 B)
--- afbinit-1.0.1/Makefile.r	1999-09-08 08:42:36.000000000 +0200
+++ afbinit-1.0.1/Makefile	2005-01-04 22:21:06.000000000 +0100
@@ -1,6 +1,6 @@
 # $Id: Makefile,v 1.1.1.1 1999/09/08 06:42:36 davem Exp $
 afbinit: afbinit.c
-	gcc -Wa,-Av9a -O -o afbinit afbinit.c
+	gcc $(OPTFLAGS) -o afbinit afbinit.c
 
 clean:
 	rm -f afbinit afbinit.o
afbinit.spec (text/plain, 1.9 KB)
%define name afbinit
%define version 1.0.1
%define release 5.gs

Summary: Sun AFB aka Sun Elite 3D microcode firmware loader
Name: %{name}
Version: %{version}
Release: %{release}
Vendor: Dave Miller
Group: System Environment/Base
Source: %{name}-%{version}.tar.bz2
Source1: %{name}.8
Source2: http://patches.sun.com/all_signed/112620-10.jar
Patch0: %{name}-rc.patch
Patch1: %{name}-rpm.patch
License: GPL
BuildRoot: %{_tmppath}/%{name}-%{version}-root
ExclusiveArch: sparc64
Prereq: chkconfig
BuildRequires: unzip

%description
This port provides a program that loads the microcode firmware onto Sun
Microsystems AFB Graphics Accelerators aka Sun Microsystems Elite 3D
found in many UltraSPARC systems. The microcode is necessary if you want
to run XFree86 with acceleration on these cards.
The microcode in itself has to be obtained from an existing
SunOS/Solaris installation.

%prep
%setup -q -a 2
%patch0 -p1 -b .rc
%patch1 -p1 -b .r

%build
%{__make} OPTFLAGS="$RPM_OPT_FLAGS"

%install
mkdir -p $RPM_BUILD_ROOT{%{_usr}/lib,%{_sbindir},%{_mandir}/man8,%{_sysconfdir}/init.d}
install -m755 %{name} $RPM_BUILD_ROOT%{_sbindir}/
install -m755 rc.afb $RPM_BUILD_ROOT%{_sysconfdir}/init.d/afbinit
install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man8/
install -m444 112620-10/SUNWafbcf/reloc/lib/afb.ucode $RPM_BUILD_ROOT%{_usr}/lib/

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%preun
/sbin/chkconfig --del afbinit

%post
/sbin/chkconfig --add afbinit

%files
%defattr(644,root,root,755)
%attr(444,root,root) %{_usr}/lib/afb.ucode
%attr(755,root,root) %{_sbindir}/%{name}
%attr(755,root,root) %{_sysconfdir}/init.d/%{name}
%{_mandir}/man8/%{name}.*

%changelog
* Mon Jan 10 2005 Dominik Mierzejewski <[email protected]>
- get afb.ucode from Sun's website

* Tue Jan 04 2005 Dominik Mierzejewski <[email protected]>
- initial build
- added manpage from Debian
- added and modified rc script patch from Gentoo
- patched Makefile to honour external OPTFLAGS