Intel Pro Wireless 2200BG を利用するためのカーネル再構築の方法(結局わかっていないし,再構築は不要だった)

いろいろ書いた後に http://debian.fam.cx/index.php?Software%2FLinuxKernel を見つけた.ふぅ.

コンパイルしたカーネルファイルサイズは2.5倍になっていた.また,MSN Japan - ニュース, 天気, メール (Outlook, Hotmail), Bing検索, Skype および Let's Note(CF-W2)のdebian Linuxで無線LANに接続 - きょうのかんぱぱ の情報より,カーネルを再構築する必要がなくなるようだった.

あ,カーネル再構築は不要だった.

  1. ipw2200-fw-3.0.tgz を取得
  2. .fw ファイル3つ全てを /usr/lib/hotplug/firmware/ にコピー
  3. /etc/networks/interfaces を編集

GUI のツールは WEP にしか対応していないため,WPA な自宅では /etc/networks/interfaces を手で編集せねばならない.簡単だったけど.

カーネル再構築とその意義

カーネルLinuxカーネルのことで,これを再構築することをいう.カーネルコンパイルという語も同義.カーネルは多くの機能を持つが,各機能の要不要を選択して再構築するとそのマシン専用のカーネルを作ると,いいことがある.

  • たぶん動作が軽くなる
  • たいていカーネルファイルサイズを縮小できる
  • そのマシン固有のハードウェア*1を利用できる

私の場合は CF-T2C の無線デバイス Intel Pro Wireless 2200BG を使うのに必要らしいから実行する.

必要な作業を確認

ここでは http://www.hanecci.com/pukiwiki/index.php?Linux%2FDebian%2FThinkpad_T43p#h13f287d に従う.必要なものを取得する.

ipw2200,ipw2200-1.2.2.tgz
http://ipw2200.sourceforge.net/
ipw2200-fw,ipw2200-fw-3.0.tgz
http://ipw2200.sourceforge.net/firmware.php
ieee80211,ieee80211-1.2.18.tgz
http://ieee80211.sourceforge.net/

INSTALL ファイルを読んで,カーネル設定をどうしろと書いてあるのか確認する.カーネルバージョンが 2.6.8 以降が必要だとかもここに書かれている.

  1. 指定の方法を含んでカーネルを再構築する
  2. ieee80211 をインストールする
  3. ipw2200 をインストールする
  4. ipw2200-fw をインストールする
  5. ドライバをロードする

カーネル再構築作業の流れ

  1. カーネル再構築環境を作る
  2. カーネルコンパイルのオプションを設定する
  3. カーネルコンパイルする
  4. 作ったカーネルを使用できるよう,ブートローダを編集する
  5. 作ったカーネルに問題がなければ,カーネルをリネームする
カーネル再構築環境を作る

再構築のためにカーネルソースとコンパイラと各種ライブラリが必要になる.カーネルソースは ftp://ring.nict.go.jp/pub/linux/kernel.org/kernel/v2.6/ とかから番号の最も大きい tar.gz ファイルを得る.最近だと 2.6.28 が最新らしい.けれども,インストール時のカーネルと一致するものを探す.カーネルバージョンの違いはオプション設定が変化するからだ.現在のカーネルバージョンは uname -r で 2.6.18.6 と判明する.

su -
apt-get install kernel-package kernel-source module-init-tools ncureses-dev
tar zxvf /home/username/Desktop/ダウンロード/linux-2.6.18.6.tar.gz -C /usr/src
# rm /usr/src/linux # 2回目以降なら,前回作ったシンボリックリンクを消す
ln -s linux-2.6.28 linux
カーネルコンパイルのオプションを設定
cd /usr/src/linux
make oldconfig
make menuconfig

oldconfig は同じカーネルだろ?旧設定ファイルは素通りするよな?という確認のためやってみた.しかし素通りしなかった.

     COPS LocalTalk PC support (COPS) [N/m/?] (NEW)
   PNP EIDE support (BLK_DEV_IDEPNP) [N/y/?] (NEW)
 Digi Intl. RightSwitch SE-X support (DGRS) [N/m/y/?] (NEW)
 3Com 3C359 Token Link Velocity XL adapter support (3C359) [N/m/y/?] (NEW)
 SMC ISA/MCA adapter support (SMCTR) [N/m/y/?] (NEW)
DABUSB driver (USB_DABUSB) [N/m/?] (NEW)
 USB Keyspan USA-xxx Serial Driver (USB_SERIAL_KEYSPAN) [N/m/?] (NEW)
EMI 6|2m USB Audio interface support (USB_EMI62) [N/m/?] (NEW)
EMI 2|6 USB Audio interface support (USB_EMI26) [N/m/?] (NEW)
 BSD Secure Levels (SECURITY_SECLVL) [N/m/y/?] (NEW)

以上全て,どんな機能を持つんだろうかと多少調べながらも,既定の N を選択しておいた.次は,menuconfig でコンパイルオプションを INSTALL ファイルの通り変更する.これに関する,第5節を後でコピペする.またこの menuconfig で,CF-T2C にあったオプションを適当に選択していく.Linux/Linux/カーネル再構築/menuconfig - cubic9.com をチラ見しながら,これいらねーやと思ったら外す.たとえば,CPU 選択くらいは誰でもできるだろう.

コンパイル

revision 値は自由にできる.

make-kpkg --initrd --revision=gsy.1 kernel-image

deb ファイルを作るらしい.放置しておく.

ipw2200 の INSTALL ファイル第5節

5.  KERNEL REQUIREMENTS - Configuration
-----------------------------------------------

Your kernel must be configured and compiled to provide certain capabilities
needed by the ieee80211 subsystem and Intel PRO/Wireless 2915ABG
Network Connection driver for Linux.  

In addition, kernel versions 2.6.14 and later are providing *old* ieee80211
subsystem and Intel PRO/Wireless 2915ABG Network Connection driver
as a part of the mainline tree.  If these are compiled into your kernel 
(i.e. not provided as modules, but rather as built-in), you will
need to re-configure (using n to exclude/disable ieee80211 subsystem and
Intel PRO/Wireless 2915ABG Network Connection driver) and rebuild
your kernel before proceeding with your Intel PRO/Wireless 2915ABG
Network Connection driver upgrade. See below.

You can verify that your running kernel is configured properly by
searching the following file for the #define entries described below:

	/lib/modules/`uname -r`/build/include/linux/autoconf.h

If you need to change anything in your kernel configuration (e.g. using
make menuconfig), make sure that you also rebuild, install, and reboot to the
new kernel image before proceeding with your Intel PRO/Wireless 2915ABG
Network Connection driver for Linux upgrade. For help or instructions on 
configuring and building the kernel, please consult the documentation contained
in your distribution.

MAKE SURE THAT THE FOLLOWING CAPABILITIES ARE ENABLED:

~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define CONFIG_NET_RADIO 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Failure to enable CONFIG_NET_RADIO will result in Wireless Tools (iwconfig,
iwlist, etc.) not functioning.  In 2.6.x, this is enabled via menuconfig:

        Device Drivers ->
                Networking support ->
                        Network device support ->
                                Wireless LAN (non-hamradio) ->
                                        Wireless LAN drivers (non-hamradio) & WE


~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define CONFIG_FW_LOADER 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Intel PRO/Wireless 2915ABG Network Connection driver loads firmware
via the Linux firmware hotplug capability (see later section on firmware loading).
In 2.6.x, this is enabled via menuconfig:

        Device Drivers ->
                Generic Driver Options ->
                        Hotplug firmware loading support


~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define CONFIG_CRYPTO 1
#define CONFIG_CRYPTO_ARC4(_MODULE) 1
#define CONFIG_CRC32(_MODULE) 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Intel PRO/Wireless 2915ABG Network Connection driver uses the WEP
encryption and decryption algorithms provided by the Linux kernel.  To use
WEP you must enable the Crypto library support (CONFIG_CRYPTO) and the ARC4
cipher algorithm (CONFIG_CRYPTO_ARC4) as noted below:

        Cryptographic options ->
                ARC4 cipher algorithm

You also need to enable the CRC32 (CONFIG_CRC32) algorithm as noted below:

        Library routines ->
                CRC32 functions


~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define CONFIG_CRYPTO_MICHAEL_MIC(_MODULE) 1
#define CONFIG_CRYPTO_AES_586(_MODULE) 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you wish to enable (optional) WPA support, you also need to enable the
following crypto library modules (in addition to those required for WEP above):

        Cryptographic options ->
                Michael MIC keyed digest algorithm
                AES cipher algorithms (i586)



NOW MAKE SURE THAT THE FOLLOWING CAPABILITIES ARE *NOT* ENABLED!!

~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define CONFIG_IEEE80211 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~
If ieee80211 subsystem support is built into your kernel (i.e. in kernel verison 
2.6.14 and later), you must de-configure that capability and rebuild your
kernel before upgrading ieee80211 subsystem and Intel PRO/Wireless 2915ABG Network
Connection driver.In 2.6.x, this is *dis*abled via menuconfig (enter n for no):

        Networking ->
                Networking support (NET [=y]) ->
                        Generic IEEE 802.11 Networking Stack

NOTE:  If ieee80211 subsystem is supported as a module (this would show up as
#define CONFIG_IEEE80211_MODULE 1), you do not need to rebuild your kernel,
but you will need to remove the binary module and relevant include files
(see UPGRADING FROM PRIOR VERSIONS, below).


~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define CONFIG_IPW2200 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~
If Intel PRO/Wireless 2915ABG Network Connection driver is built into
your kernel (i.e. in kernel version 2.6.14 and later), you must de-configure
that capability and rebuild your kernel before upgrading ieee80211 subsystem
and Intel PRO/Wireless 2915ABG Network Connection driver. In 2.6.x, this is 
*dis*abled via menuconfig (enter n for no):

        Device Drivers ->
                Network device support ->
                        Network device support (NETDEVICES [=y]) ->
                                Wireless LAN (non-hamradio) ->
                                        Intel PRO/Wireless 2200BG and 2915ABG...

NOTE:  If Intel PRO/Wireless 2915ABG Network Connection driver for Linux is
supported as a module (this would show up as #define CONFIG_IPW2200_MODULE 1),
you do not need to rebuild your kernel, but you will need to remove the binary
module and relevant include files (see UPGRADING FROM PRIOR VERSIONS, below).

*1:ソニーVAIO についているジョグダイヤルとか