Articles
[SCRIPT] Make module for PCTEL modems
- Details
- Created on 12 January 2011
Pctel Modems have linux drivers see this page for more information
http://linmodems.technion.ac.il/package ... lcome.html
If you see the welcome page above, you will see I participated a bit in the helping of getting the driver to work, but if it were not for Porteus & community, it would not have been possible either, I tested code without being harmed.
NOTE: This script has been written for Porteus V1.0
Copy + paste main code and save as pctel.pbuild.sh
Make it executable with: chmod +x pctel.pbuild.sh
Change into the folder and run script with: ./pctel.pbuild.sh
bash-4.1# cat pctel.pbuild
#!/bin/bash
PKG=pctel-0.9.7-9-rht-11
TMP=/tmp/pctel-$$
# download the source from linmodems page, uncomment if you want to download pctel source
#wget http://linmodems.technion.ac.il/packages/pctel/pctel-0.9.7-9-rht-11.tar.gz
#set -e
tar -zxvf $PKG*
sleep 2;
cd $PKG/src
sed -i '88 a #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)' linmodem-2.6.c
sed -i '90 a #else' linmodem-2.6.c
sed -i '91 a static DEFINE_SEMAPHORE(linmodem_sem);' linmodem-2.6.c
sed -i '92 a #endif' linmodem-2.6.c
sed -i '1207 a #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)' linmodem-2.6.c
sed -i '1209 a #else' linmodem-2.6.c
sed -i '1210 a static DEFINE_SEMAPHORE(serial_sem);' linmodem-2.6.c
sed -i '1211 a #endif' linmodem-2.6.c
sleep 3;
# run ./configure -auto for the type of modem you have
# you can have pct789,,,cm8738, i8xx, sis, via686a
./configure -auto # otherwise change this to your modem type :)
make
make install DESTDIR=$TMP
#mkdir -p $TMP/lib/modules/`uname -r`/misc/
#cp -ra /lib/modules/`uname -r`/misc/*.ko $TMP/lib/modules/`uname -r`/misc/
mkdir -p $TMP/etc/udev/rules.d/
echo "KERNEL==\"ttyS_PCTEL0\", SYMLINK=\"modem\"" > $TMP/etc/udev/rules.d/70-pctel.rules
sleep 3
rm -rf /lib/modules/`uname -r`/misc/pctel.o
rm -rf /lib/modules/`uname -r`/misc/ptserial.o
sleep 3
cd ../../
mkdir -p $TMP/etc/rc.d/
echo "#!/bin/bash " >> $TMP/etc/rc.d/rc.pctel
echo "#==========================================================" >> $TMP/etc/rc.d/rc.pctel
echo "# Startup script for PCTEL modem modules " >> $TMP/etc/rc.d/rc.pctel
echo "# " >> $TMP/etc/rc.d/rc.pctel
echo "# copied from http://kristol.org/david/dell-i8200/#pctel " >> $TMP/etc/rc.d/rc.pctel
echo "# and modified for Slax Linux Live/Porteus LiveCD by " >> $TMP/etc/rc.d/rc.pctel
echo "# Antonio A. Olivares " >> $TMP/etc/rc.d/rc.pctel
echo "# This email address is being protected from spambots. You need JavaScript enabled to view it., This email address is being protected from spambots. You need JavaScript enabled to view it. " >> $TMP/etc/rc.d/rc.pctel
echo "#==========================================================" >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo "/sbin/depmod -a " >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo "if [-e /dev/modem] &> /dev/null; then" >> $TMP/etc/rc.d/rc.pctel
echo " { " >> $TMP/etc/rc.d/rc.pctel
echo " echo \"Linking /dev/ttyS_PCTEL0 to /dev/modem to let kppp access modem\" " >> $TMP/etc/rc.d/rc.pctel
echo " ln -s /dev/ttyS_PCTEL0 /dev/modem " >> $TMP/etc/rc.d/rc.pctel
echo " } " >> $TMP/etc/rc.d/rc.pctel
echo "fi " >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo "# See how we were called. " >> $TMP/etc/rc.d/rc.pctel
echo " case \"\$1\" in " >> $TMP/etc/rc.d/rc.pctel
echo " start) " >> $TMP/etc/rc.d/rc.pctel
echo " echo -n \"Starting pctel . . .\" " >> $TMP/etc/rc.d/rc.pctel
echo " modprobe linmodem" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe pctel" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe pctel_hw" >> $TMP/etc/rc.d/rc.pctel
echo " echo \"done\" " >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " stop)" >> $TMP/etc/rc.d/rc.pctel
echo " echo -n \"Shutting down pctel . . .\"" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe -r pctel" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe -r pctel_hw" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe -r linmodem" >> $TMP/etc/rc.d/rc.pctel
echo " echo \"done\"" >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " status)" >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " restart)" >> $TMP/etc/rc.d/rc.pctel
echo " \$0 stop" >> $TMP/etc/rc.d/rc.pctel
echo " \$0 start" >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " *)" >> $TMP/etc/rc.d/rc.pctel
echo " echo \"Usage: pctel {start|stop|restart|status}\" " >> $TMP/etc/rc.d/rc.pctel
echo " exit 1" >> $TMP/etc/rc.d/rc.pctel
echo " esac" >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo " exit 0" >> $TMP/etc/rc.d/rc.pctel
chmod +x $TMP/etc/rc.d/rc.pctel
# copy build script
mkdir -p $TMP/usr/src/pbuilds/
cp $0 $TMP/usr/src/pbuilds/
find $TMP -type d | xargs chmod -v 755
find $TMP | grep .gz | xargs gunzip
find $TMP | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
dir2xzm $TMP $PKG.xzm
rm -Rf $TMP
rm -Rf $PKG
chmod 755 $PKG.xzm
Thanks Tonio !!