The following script
edits the kernel version information of a module to match the running
kernel. Note that this does not update the module code to fix any actual
kernel API discrepancies, but simply masquerades the module as having
been compiled under a different version. This allows the module's insertion
without warnings using a plain insmod
call, but by no means guarantees
the module's functioning.
Note that the script must be made executable by something like
chmod +x fixscript
.
The script:
#!/bin/bash F=/tmp/objcopyscript S=/tmp/syms MI=/tmp/modinfo echo -ne "kernel_version="`uname -r`"\0" > $MI depmod -e $1 | grep -vE "^ltmodem" > $S echo "#!/bin/bash" > $F echo "objcopy \\" >> $F for i in `cat $S` ; do echo -n doing $i new=`awk '/ '$i'_R/ { printf("%s", $2); }' < /proc/ksyms` echo " $new" echo "--redefine=$i=$new \\" >> $F done echo "--remove-section=.modinfo \\" >> $F echo "--add-section=.modinfo=$MI \\" >> $F echo '$*' >> $F cat $F chmod a+x $F $F $1 $2 rm -f $F $S $MI
The Lucent driver installation script defaults to having the module loaded upon boot, by appending the line
insmod -f ltmodemto the end of the initialization script
/etc/rc.d/rc.local
. If
you have, i.e., an ESS modem, you could replace "ltmodem" with "esscom"
above to have your module automatically loaded on boot.
However, many users prefer to run "lean kernels" which only have the auxiliary modules inserted when necessary. Below are examples of scripts for starting and stopping an online session using a Lucent winmodem with the ltmodem.o driver. It can be applied to many other drivers by simply replacing "ltmodem" with "YourModemDriver".
Modemup:
#!/bin/sh # This script inserts the kernel modules supporting # WinModems using the Lucent ltmodem.o module. # Save as /usr/local/bin/Modemup, then # chmod a+x /usr/local/bin/Modemup # to make it executable. # Since insmod & rmmmod require root permission, permission for an # ordinary User must be given under secure-su or sudo. # # the ltmodem.o driver must be within /lib/modules/kernl-version/misc # # When kernel-source-2.?.?? code becomes available for ltmodem.o , # forced "-f" insertion should be removed from the following line: /sbin/insmod -f ltmodem # and the complaint about version mis-match will also then disappear. insmod slhc # is needed to support ppp insmod ppp # if you are using a ppp.o which is not version matched with the kernel # insmod -f ppp # may be necessary instead echo Loaded kernel modules are: lsmod # An automatic start of the ppp connection is specified # by entering the command that starts your online session such as: # wvdial, pon, ppp-on, kppp or # Whatever ## End Modemup
Modown:
#! /bin/sh # /usr/local/bin/Modown ends a pppd session and does cleanup. # Save as /usr/local/bin/Modown, then # chmod a+x /usr/local/bin/Modown # Starting pppd session related modules are: # ppp_deflate 39108 1 (autoclean) # bsd_comp 3664 0 (autoclean) # ppp 19916 2 (autoclean) [ppp_deflate bsd_comp] # slhc 4200 1 (autoclean) [ppp] # ltmodem 452936 1 # NOTE THAT ltmodem did NOT acquire autoclean status echo " " echo Terminating ppp0 with poff poff sleep 1 # is a pause to let the poff process to terminate, after which /sbin/rmmod ltmodem # removes ltmodem.o module echo " " echo Removed module ltmodem # /sbin/lsmod # echo " " # echo A pause before removing modules ppp_deflate bsd_comp, then ppp slhc sleep 1 /sbin/rmmod ppp_deflate bsd_comp /sbin/rmmod ppp slhc /sbin/lsmod # but doesn't remove the sound related modules called up. Thus echo " " echo Removing sound related module called by LTmodem, soundcore echo " " if not otherwise in use. /sbin/rmmod soundcore echo Remaining modules in kernel-`uname -r` are: /sbin/lsmod # displays remaining modules echo " " ## End Modown
Example PPP scripts configured for a Debian installation by pppconfig are:
/etc/ppp/peers/provider:
# This optionfile was generated by pppconfig 2.0.5. hide-password noauth connect "/usr/sbin/chat -v -f /etc/chatscripts/provider" debug /dev/ttyS14 # port used by the Lucent Winmodem 115200 defaultroute noipdefault user NameAtIP remotename provider ipparam provider
/etc/chatscripts/provider:
# This chatfile was generated by pppconfig 2.0.5. # Please do not delete any of the comments. Pppconfig needs them. # # ispauth PAP # abortstring ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' # modeminit '' ATZ OK ATQ0V1E1S0=0&C1&D2S11=55+FCLASS=0 # ispnumber OK-AT-OK ATDT3019178111 # ispconnect CONNECT \d\c # prelogin # ispname # isppassword # postlogin # end of pppconfig stuff
The following is quoted from one of the PCTel readme files. My interpretation of this is that you should do something like
insmod pctel.o country_sel=7(depending on your country code, below). If this works for you (or doesn't), please let me know at sean(at)walbran.org
Set and report country code. This driver takes a module parameter to setup the correct country code setting for various country's telephone networks and it also can report back the country code been set. Here are the two versions for country_code selection and reporting: VERSION #1: To set country code: "country_sel_rep sel 7" will sets the country code to 7. To query the driver for the currently set country code: "country_sel_rep rep" returns the current country code as the exit code. VERSION #2: To set country code: "country_sel 7" to set the country code to 7. To query the driver for the currently set country code: "country_rep" return the current country code as the exit code. country_code country_name 1 USA 2 FRANCE 3 GERMANY 4 ITALY 5 SWEDEN 6 UK 7 JAPAN 8 AUSTRALIA 9 SPAIN 10 TAIWAN 11 SINGAPORE 12 KOREA 13 SWITZERLAND 14 NORWAY 15 NETHERLANDS 16 BELGIUM 17 CANADA 18 IRELAND 19 PORTUGAL 20 POLAND 21 HUNGARY 22 FINLAND 23 DENMARK 24 AUSTRIA 25 S.AFRICA 26 CTR21 COUNTRIES 27 CHINA 28 MALAYSIA 29 LUXUMBURG 30 GREECE 31 ICELAND 32 NEW ZEALAND 33 BRAZIL