[SCRIPT] pctel.slaxbuild for PCTEL modems

Post tutorials, HOWTO's and other useful resources here.
Post Reply
Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

[SCRIPT] pctel.slaxbuild for PCTEL modems

Post#1 by Tonio » 28 Dec 2010, 20:18

Pctel Modems have linux drivers see this page for more information
http://linmodems.technion.ac.il/packag ... come.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 slax-remix by fanthom & community, it would not have been possible either :(, I tested code without being harmed :)
Copy + paste code and save as

Code: Select all

pctel.slaxbuild
run from terminal

Code: Select all

chmod +x pctel.slaxbuild
and run

Code: Select all

/pctel.slaxbuild
to generate pctel module.

Code: Select all

#!/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*
cd $PKG/src
# 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/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/Slax Remix CD by " >> $TMP/etc/rc.d/rc.pctel
echo "# Antonio A. Olivares " >> $TMP/etc/rc.d/rc.pctel
echo "# olivares14031@gmail.com,discuss@linmodems.org " >> $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/slaxbuilds/
cp $0 $TMP/usr/src/slaxbuilds/
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


dir2lzm $TMP $PKG.sq4.lzm
rm -Rf $TMP
rm -Rf $PKG
chmod 755 $PKG.sq4.lzm

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: [SCRIPT] pctel.slaxbuild for PCTEL modems

Post#2 by Tonio » 03 Jul 2011, 01:38

Due to new changes & requirements. slaxbuilds no longer applies, we need to create pbuilds :

copy and paste the following and save it as pctel.pbuild and run command to generate module.

Code: Select all

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/package ... -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 "# olivares14031@gmail.com, discuss@linmodems.org " >> $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

Post Reply