[SCRIPT] for Agere Pinball modems agrsm06pci.slaxbuild
Posted: 28 Dec 2010, 20:33
Cut + paste code below and save as:
Then
and
produces agrsm module in sq4 module.
Code: Select all
agrsm06pci.slaxbuild
Code: Select all
chmod +x agrsm06pci.slaxbuild
Code: Select all
# ./agrsm06pci.slaxbuild
Code: Select all
#!/bin/sh
# slax build script for agrsm06pci
# uncomment if you have download agrsm code from LinModems Resource Page
# wget http://linmodems.technion.ac.il/packages/ltmodem/11c11040/agrsm06pci-2.1.80~20100106.tar.gz
CWD=$PWD
ARCH=$(uname -m)
ARCH=${ARCH:-i486}
TMP=/tmp/packages
PKG=$TMP/_pkg_
#get ready when slax's gonna change the module's extension
#just like slackware did since version 13
pkgext=lzm
#SLAXMAJOR=$(awk '{print $2}' /etc/slax-version | cut -d'.' -f1)
#don't know yet what it's gonna be
#if [ $SLAXMAJOR -ge 7 ]; then
# pkgext=lzm
#fi
#archive expected in format agrsm06pci-*.tar.gz
if [ $(ls agrsm06pci-*.tar.gz 2>/dev/null | wc -l) -ne 1 ]; then
echo "couldn't find the source archive"
exit 1
fi
archive=$(ls agrsm06pci-*.tar.gz)
src=$(tar tf $archive| head -n1 | tr -d \/)
VERSION=$(echo ${archive%.tar.gz} | sed 's?^agrsm06pci-??' | \
sed 's?-[a-z]\{3,\}$??' | sed 's?-?_?g')
LIB=""
case "$ARCH" in
i386) CFLAGS="-O3 -march=i386 -mcpu=i686";;
i486) CFLAGS="-O3 -march=i486 -mtune=i686";;
i686) CFLAGS="-O3 -march=i686 -mtune=i686";;
athlon-xp) CFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer";;
x86_64) CFLAGS="-O3"; LIB=64;;
esac
#should we include the architexture in the name?
#MODNAME=agrsm06pci-${VERSION}-$ARCH.$pkgext
MODNAME=agrsm06pci-$VERSION.sq4.$pkgext
description()
{
cat <<EOD
# write description for agrsm06pci
Vendor 11c1 is Lucent Technologies. Modem technologies were transferred to Agere Systems Inc,
which has now been incorporated into LSI Inc, http:/www.lsi.com .
Their Linux code developer/maintainer is Soumyendu Sarkar. Linuz support for a chipset and
its continued maintenance is typically only initiated at the request of a major chipset buyer,
or comparable sponsor. Several different modem chipset types with varying support under Linux are produced:
.
Device ID ChipType Linux drivers Comment
--------- ------------- -------------- -----------------------------
0620 Pinball agrsm In some HP desktop PCs
0630 SV92EX agrsm In some newer PCs
The agrsm code packages compile into a agrmodem.ko + agrserial.ko driver pair.
But there are specialized packages for the different chipsets. The following resources
can be accessed at: http://linmodems.technion.ac.il/packages/ltmodem/11c11040/ has resources.
EOD
}
permissions()
{
chown -R root:root .
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
find . -perm 400 -exec chmod 644 {} \;
find . -perm 440 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 511 -exec chmod 755 {} \;
find . -perm 711 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
}
strip()
{
(cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null
)
}
generatelist()
{
(cd $PKG
LIST=$PKG/usr/src/slaxbuilds/agrsm06pci/pkglist.txt
rm -f $LIST
find * | while read f
do
if [ -d "$f" ]; then
echo "${f}/" >> $LIST
fi
if [ -L "$f" ]; then
echo "$f -> $(readlink -n $f)" >> $LIST
elif [ ! -d "$f" ]; then
echo "$f" >> $LIST
fi
done
)
}
if [ -e $TMP ]; then
rm -Rf $TMP/*
fi
mkdir -p $TMP
cd $TMP
tar zxvf $CWD/$archive || exit 1
cd $src || exit 1
permissions || exit 1
#make module || exit 1
make || exit 1
clear
mkdir -p $PKG
#make install || exit 1
./agrinst || exit 1
mkdir -p $PKG/usr/lib/AgereSoftModem
cp AgereMdmDaemon $PKG/usr/lib/AgereSoftModem/
mkdir -p $PKG/lib/modules/`uname -r`/kernel/drivers/char/
cp /lib/modules/`uname -r`/kernel/drivers/char/agr* $PKG/lib/modules/`uname -r`/kernel/drivers/char/
mkdir -p $PKG/etc/rc.d/
cp agr_softmodem $PKG/etc/rc.d/rc.agr_softmodem
chmod +x $PKG/etc/rc.d/rc.agr_softmodem
depmod -a
strip
#normally this is not necessary
(cd $PKG/usr
if [ -d share/man ]; then
mv share/man .
fi
)
(cd $PKG/usr
if [ -d share/doc ]; then
mv share/doc .
fi
)
#we might want to copy README* LICENCE etc to $PKG/usr/doc/agrsm06pci-$VERSION
mkdir -p $PKG/usr/doc/agrsm06pci-$VERSION
cp README* LICENSE $PKG/usr/doc/agrsm06pci-$VERSION
# copy this script and some info to /usr/src/slaxbuilds/agrsm06pci
mkdir -p $PKG/usr/src/slaxbuilds/agrsm06pci
cp $CWD/agrsm06pci.slaxbuild $PKG/usr/src/slaxbuilds/agrsm06pci
description > $PKG/usr/src/slaxbuilds/agrsm06pci/readme.txt
generatelist
clear
echo
cd $CWD
rm -f $MODNAME
#mksquashfs $PKG $MODNAME -b 256K -lzmadic 256K || exit 33
dir2lzm $PKG $MODNAME
chmod a-wx $MODNAME
chmod a+r $MODNAME
echo
echo " agrsm06pci"
echo
description
echo
echo "module $MODNAME successfully created in $CWD"
echo
echo "removing stuff from install"
rm -rf /usr/lib/AgereSoftModem/
rm -rf /lib/modules/`uname -r`/kernel/drivers/char/agr*
rm -Rf $TMP/*