I got drivers to compile


Forum: Other Help Topics
Topic: I got drivers to compile
started by: jerome5

Posted by jerome5 on Sep. 02 2004,03:33
Update:
Installed  an outdated version of the source
2.4.22 instead of 2.4.26 for DSL 0.8

After much searching I found a debian package for alien and its dependencies and converted the rpm package to a deb.

I got a spec file and a tar.gz file in the root directory
After I ran Make install
I got a bunch of unresolved symbols and an error.

[I]
But the most important thing is that it made a BCMSM.o file, I figuer this is the driver for the modem, and it took a bit of tweeking to get it to compile anyway.[I]

--------------------- BCMSM-init-redhat
# BCMSM init.d script for RedHat
# Copyright © 2000 Broadcom Corporation.  All rights reserved.
# chkconfig: 12345 99 1
# description: BCM V.92 56K Modem
# . /etc/rc.d/init.d/functions

echo "line8"
manage_nodes(2)

function manage_nodes()
{
# $1 - DEVICE
# $2 - CREATE/REMOVE
create=$2
if [ -z $create ]; then
create="0"
fi
if [ -e /proc/tty/drivers ]; then
MINOR_MATCH_PATTERN=^.*/dev/$1[[:space:]]*[[:digit:]]*[[:space:]]*
MINOR_LIST=`egrep "$MINOR_MATCH_PATTERN" /proc/tty/drivers | sed "s#$MINOR_MATCH_PATTERN\([0-9\-]*\).*#\1#"`
MINOR_START=`echo $MINOR_LIST | sed 's/\([0-9]*\).*/\1/'`
MINOR_END=`echo $MINOR_LIST | sed 's/\([0-9]*\)-\([0-9]*\).*/\2/'`
else
MINOR_START="0"
MINOR_END="0"
fi
for suffix in "" "audio" "eye" "log" "status"; do
if [ ! -z $suffix ]; then
devname=$1"_"$suffix
else
devname=$1
fi

major=`egrep "$devname$" /proc/devices | sed 's/\([0-9]*\) .*/\1/'`
if [ ! -z $major ]; then
for ((minor=($MINOR_START); ($minor <= $MINOR_END); minor=($minor + 1))) ; do
devnode=/dev/ttySM$suffix$minor
if [ -e $devnode ]; then
rm -f $devnode
fi
if [ $create = "1" ]; then
mknod $devnode c $major $minor
chmod 666 $devnode
fi
done
fi
done
suffix="config"
devname=$1"_"$suffix
major=`egrep "$devname$" /proc/devices | sed 's/\([0-9]*\) .*/\1/'`
minor=0
devnode=/dev/ttySM$suffix
if [ -e $devnode ]; then
rm -f $devnode
fi
if [ $create = "1" ]; then
mknod $devnode c $major $minor
chmod 666 $devnode
fi
}

if [ ! -e /proc/devices ]; then
exit 0
fi

DEVICE=BCMSM
KERNEL_VERSION=`uname -r`
MODULE_DIR=`echo /lib/modules/$KERNEL_VERSION`


case "$1" in
 start)
echo -n "Starting $DEVICE: "

echo -n "$DEVICE "

if [ ! -f $MODULE_DIR/modules.dep ]; then
depmod -a
fi

modprobe $DEVICE 2>/dev/null

manage_nodes $DEVICE 1

if [ -e /dev/ttySMconfig ]; then
if [ -f /etc/$DEVICE.conf ]; then
cat /etc/$DEVICE.conf > /dev/ttySMconfig
fi
fi

echo

touch /var/lock/subsys/$DEVICE

;;
 stop)
echo -n "Shutting down $DEVICE: "

if lsmod | grep -q $DEVICE; then
echo -n "$DEVICE "
if [ -e /dev/ttySMconfig ]; then
cat /dev/ttySMconfig > /etc/$DEVICE.conf
fi

manage_nodes $DEVICE 0

rmmod $DEVICE
fi

echo

rm -f /var/lock/subsys/$DEVICE

;;
 restart|reload)
$0 stop
$0 start
;;
 *)
echo "Usage: start {start|stop|restart|reload}"
exit 1
esac

exit 0
------------------------

---------_BCMSM-3.4.19.spec
Summary: BCM V.92 56K Modem kernel module.
Name: BCMSM
Vendor: Broadcom Corporation
Version: 3.4.19
Release: 6
Source: BCMSM-3.4.19.tar.gz
Copyright: Commercial
Group: System Environment/Kernel
Provides: BCMSM


%description
This package contains the BCM V.92 56K Modem module compiled
for kernel versions 2.4.9-e.3 2.4.9-e.3smp 2.4.9-e.3enterprise 2.4.9-e.3summit .

%prep
%setup

%build

%install
for k in 2.4.9-e.3 2.4.9-e.3smp 2.4.9-e.3enterprise 2.4.9-e.3summit  ; do
make clean
make install KERNEL_VERSION=$k KERNEL_DIR=/usr/src/kernel_headers/linux-$k RPM=1 INSTALL_ROOT=$RPM_BUILD_ROOT
done

%clean

%pre
set allow_null_glob_expansion;

#Unload device if present
if lsmod | grep -q BCMSM ; then
rmmod BCMSM 2>&1 > /dev/null
fi

ok=0
for v in 2.4.9-e.3 2.4.9-e.3smp 2.4.9-e.3enterprise 2.4.9-e.3summit  ; do
if [ "`uname -r`" == $v ] ; then ok=1 ; fi
done;
#Disable this check by OEM request.
ok=1
if [ $ok == 0 ] ; then
echo "error: the installed kernel is `uname -r` but this package requires one of the following kernels: 2.4.9-e.3 2.4.9-e.3smp 2.4.9-e.3enterprise 2.4.9-e.3summit "
exit -1
fi



%post

/sbin/depmod -a

for v in 2.4.9-e.3 2.4.9-e.3smp 2.4.9-e.3enterprise 2.4.9-e.3summit  ; do
if [ "`uname -r`" == $v ] ; then
/etc/rc.d/init.d/BCMSM start 2>&1 > /dev/null
break
fi
done;

if [ -x /sbin/chkconfig  ] ; then
/sbin/chkconfig --add BCMSM
fi

#If chkconfig fails setup links manually
if [ "`echo /etc/rc.d/rc[12345].d`" != '/etc/rc.d/rc[12345].d' ]; then
for RCDIR in /etc/rc.d/rc[12345].d; do
if [ ! -e $RCDIR/S99BCMSM ]; then
ln -s /etc/rc.d/init.d/BCMSM $RCDIR/S99BCMSM
fi
done
fi
if [ "`echo /etc/rc.d/rc[06].d`" != '/etc/rc.d/rc[06].d' ]; then
for RCDIR in /etc/rc.d/rc[06].d; do
if [ ! -e $RCDIR/K01BCMSM ]; then
ln -s /etc/rc.d/init.d/BCMSM $RCDIR/K01BCMSM
fi
done
fi

#Back up previous /dev/modem
if [ "`echo /dev/modem*`" != '/dev/modem*' ] ; then
mv /dev/modem /dev/BCMSM_old_modem_link ;
fi
ln -s /dev/ttySM0 /dev/modem


%preun
set allow_null_glob_expansion;

if [ -x /sbin/chkconfig  ] ; then
if  /sbin/chkconfig --list | grep -q BCMSM  ; then
/sbin/chkconfig --del BCMSM
fi
fi

#In case chkconfig fails and doesnt remove links
if [ "`echo /etc/rc.d/rc[12345].d`" != '/etc/rc.d/rc[12345].d' ]; then
for RCDIR in /etc/rc.d/rc[12345].d; do
rm -f $RCDIR/S99BCMSM;
done;
fi;
if [ "`echo /etc/rc.d/rc[06].d`" != '/etc/rc.d/rc[06].d' ]; then
for RCDIR in /etc/rc.d/rc[06].d; do
rm -f $RCDIR/K01BCMSM;
done;
fi;

if [ "`echo /dev/BCMSM_old_modem_link*`" != '/dev/BCMSM_old_modem_link*' ] ; then
rm -f /dev/modem
mv -f /dev/BCMSM_old_modem_link /dev/modem ;
fi

rm -f /dev/ttySM*
rm -f /etc/BCMSM.conf
rm -f /var/lock/subsys/BCMSM

if lsmod | grep -q BCMSM ; then
rmmod BCMSM
fi

exit 0

%postun

/sbin/depmod -a

exit 0

%files
%defattr(-,root,root)
/lib/modules/2.4.9-e.3/misc/BCMSM.o
/lib/modules/2.4.9-e.3smp/misc/BCMSM.o
/lib/modules/2.4.9-e.3enterprise/misc/BCMSM.o
/lib/modules/2.4.9-e.3summit/misc/BCMSM.o

/etc/rc.d/init.d/BCMSM

%changelog
*Fri May 17 2002 Luis Gutierrez <luisgm@broadcom.com>
-First revision

------------

OK after all this I realise that this is supposed to make a device ttySM*  (I actually got it to make /dev/ttySMconfig)  and put it as the device in ppp config but still no workie. If anyone has experience with making and installing drivers please share what you know. I think I am really close to having a linmodem

Posted by jerome5 on Sep. 02 2004,03:41
< Driver source >

Sorry for the long post.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.