以下のスクリプトは、モジュールのカーネル・バージョン情報を編集して、実行
カーネルと一致させます。
これは、実際にはカーネル API の矛盾を修正するためのモジュールコードの
アップデートはせず、単に異なるバージョンの下でコンパイルされたモジュール
を仮装する、ということに注意してください。
これは、簡素な insmod コールを使って
【訳注:つまり -f フラグで強制しなくても】、警告無しでモジュールの挿入を
できるようにしますが、決してモジュールの動作を保証するものではありません。
スクリプトを以下に示しますが、 http://walbran.org/sean/linux/stodolsk/fixscript からダウンロードすることもできます。
スクリプトは chmod +x fixscript のようにして、実行可能にする
必要があることに注意してください。
The script:
#! /bin/bash
# To make this file executable: chmod +x fixscript
# This is a very slight edit of the ltfixscript contributed to
# the Linmodems Newslist
# From - Sun Jul 23 04:27:38 2000
# From: "Mark Spieth" <mark at digivation.com.au>
# To: <discuss@linmodems.org>
# Subject: ltmodem symbols and version fixed
# Date: Sun, 23 Jul 2000 12:39:44 +1000
# Organization: Digivation Pty Ltd
echo "Fixscript V1.21"
if [ -z "$1" -o -z "$2" ]; then
cat <<END
This script changes version number tags of binary
kernel modules to match the version of the currently
running kernel. It also renames any symbol that the
current kernel cannot resolve into their equivalent
resolvable symbols.
For inserting binary modules into kernels, the fixed
module can be inserted with:
insmod module
which is used in automated kernel module management,
rather than forcing module loading with:
insmod -f module
which is necessary when kernel and module versions
are not matched.
WARNING! This change is purely cosmetic, and the use
of version matched binaries whenever possible is
strongly advised. It may crash your kernel due to
inconsistencies in data structures between the kernel
as it stands and the headers used to originally compile
the module being fixed. No guarantees are given or implied
under any circumstances.
GNU objcopy version 2.9.5 or later is required;
this is provided as part of the binary utilities
packages such as the Debian binutils.deb
USAGE: fixscript input-file output-file
END
exit 1
fi
MI=/tmp/modinfo
DI=/tmp/depinfo
#new kernel version modinfo section
echo -ne "kernel_version="`uname -r`"\0" > $MI
#build the objcopy command
CMD="objcopy"
#for i in `depmod -e $1 | grep -vE "^$1:"` ; do
depmod -e $1 2>$DI
AWKSTR=\$2
for i in `awk "{print $AWKSTR}" $DI | grep _R` ; do
echo doing $i
i1=`echo $i | awk '{
gsub(/_R[0-9a-fA-F]+/,"");
printf("%s", $1);
}'`
echo "i1=" $i1
echo " trunc=\"$i1\""
searchstr=$i1"_R"
echo "searchstr=" $searchstr
new=`cat /proc/ksyms | grep $searchstr | awk "{print $AWKSTR}"`
echo " new=$new"
CMD="$CMD --redefine-sym=$i=$new"
done
#replace the modinfo section with the new one
CMD="$CMD --remove-section=.modinfo --add-section=.modinfo=$MI"
CMD="$CMD $*"
#run the command
echo "CMD:" $CMD
$CMD
#remove the section file
rm -f $MI
rm -f $DI
初期化スクリプト /etc/rc.d/rc.local の最後に
insmod -f ltmodemを追加することにより、Lucent ドライバのインストール用スクリプトは、 デフォルトでブート時にモジュールがロードされるようになります。 例えば ESS モデムをお持ちなら上記の "ltmodem" を "esscom" に置き換えると ブート時にモジュールが自動的にロードされます。 しかし、初期化スクリプトは Linux ディストリビューションによって異なるの で、あなたの固有の設定に合わせて適切なスクリプトを見つけるか/修正するか/ 作成する、必要があることにご注意ください。
しかし多くのユーザは、必要なときだけ補助モジュールを挿入する 「スリムなカーネル」を実行することを好みます。 以下に、 Lucent winmodem と ltmodem.o ドライバを使ったオンライン・セッシ ョンをスタート、ストップするためのスクリプトの例を示します。 これは、単に "ltmodem" を "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
pppconfig による Debian へのインストール用 PPP スクリプトの例を示します:
/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
下記は、PCTel readme ファイルから引用しました。これの私の解釈は、
insmod pctel.o country_sel=7のようにしなければならないということです (下記に示すあなたの国のカントリーコードに依存します)。 これが動作したら(または動作しなかったら)、私 sean(at)walbran.org に教えて ください。
カントリーコードの設定とレポート
このドライバは、様々な国の電話網のための正しいカントリーコードを設定し たり、どのカントリーコードがセットされているかを報告できるモジュール・ パラメータがあります。 カントリーコードの選択と報告のための 2つのバージョンがあります:
バージョン 1: カントリーコードをセットするには: "country_sel_rep sel 7" は、カントリーコードを 7 にセットします。 現在セットされているカントリーコードを、ドライバにたずねるには: "country_sel_rep rep" は、戻り値として現在のカントリーコードを返します。
バージョン 2:
カントリーコードをセットするには:
"country_sel 7" は、カントリーコードを 7 にセットします。
現在セットされているカントリーコードをドライバにたずねるには:
"country_rep" は、戻り値として現在のカントリーコードを返します。
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