sourceからの kernel構築
sorry Japanese only
PAGE作成日 2005/06/12
最終更新日 2005/06/12
page size = Mbyte

関連するページ vine linux3.1 kernelを srcから作成 iptables3+brctl kernelの update sourceからの kernel構築

Networkを Swハブのように動作させるため brctlを組み込むのに sourceから kernelを再構築する必要がありました。

作業的には、以下の方法で進めます。

(1) kernelオプションの確認
(2) ソースの展開
(3) コンパイル

うまくいけば、時間がかかるだけで手順的には難しくありません。

kernelオプション確認

今回は brctlというネットワークをブリッジ接続する為に kernelを再コンパイルしたのですが、
以下のオプションを確認(変更)する必要がありました。

802.1d Ethernet Bridging
Network packet filtering debugging

それぞれを、Enable,Disableであることを以下の方法で確認できます。

/usr/src/linux/make menuconfigを実行
以下のメニューが表示されるので、Networking optionsにカーソル合わせてエンター
 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq Main Menu qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted letters are hotkeys.  Pressing <Y>  x
  x  includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.  Legend: [*]        x
  x  built-in  [ ] excluded  <M> module  < > module capable                                                         x
  x                                                                                                                 x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x                             Code maturity level options  --->                                               x x
  x x                             Loadable module support  --->                                                   x x
  x x                             Processor type and features  --->                                               x x
  x x                             General setup  --->                                                             x x
  x x                             Memory Technology Devices (MTD)  --->                                           x x
  x x                             Parallel port support  --->                                                     x x
  x x                             Plug and Play configuration  --->                                               x x
  x x                             Block devices  --->                                                             x x
  x x                             Multi-device support (RAID and LVM)  --->                                       x x
  x x                             Networking options  --->                                                        x x
  x x                             Telephony Support  --->                                                         x x
  x x                             ATA/IDE/MFM/RLL support  --->                                                   x x
  x x                             SCSI support  --->                                                              x x
  x x                             Fusion MPT device support  --->                                                 x x
  x x                             IEEE 1394 (FireWire) support (EXPERIMENTAL)  --->                               x x
  x x                             I2O device support  --->                                                        x x
  x x                             Network device support  --->                                                    x x
  x x                             Amateur Radio support  --->                                                     x x
  x x                             IrDA (infrared) support  --->                                                   x x
  x x                             ISDN subsystem  --->                                                            x x
  x x                             Old CD-ROM drivers (not SCSI, not IDE)  --->                                    x x
  x x                             Input core support  --->                                                        x x
  x x                             Character devices  --->                                                         x x
  x x                             Multimedia devices  --->                                                        x x
  x x                             Crypto Hardware support  --->                                                   x x
  x x                             File systems  --->                                                              x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv(+)qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
  x                                        <Select>    < Exit >    < Help >                                         x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

以下の画面が表示されるので、
Network packet filtering debuggingの * を消す (Disable)
802.1d Ethernet Bridgingの部分は Mとか付いてれば OK
 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq Networking options qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted letters are hotkeys.  Pressing <Y>  x
  x  includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.  Legend: [*]        x
  x  built-in  [ ] excluded  <M> module  < > module capable                                                         x
  x                                                                                                                 x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x                          <*> Packet socket                                                                  x x
  x x                          [*]   Packet socket: mmapped IO                                                    x x
  x x                          <*> Netlink device emulation                                                       x x
  x x                          [*] Network packet filtering (replaces ipchains)                                   x x
  x x                          [ ] Network packet filtering debugging                                         x x
  x x                          [*] Socket Filtering                                                               x x
  x x                          <*> Unix domain sockets                                                            x x
  x x                          [*] TCP/IP networking                                                              x x
  x x                          [*]   IP: multicasting                                                             x x
  x x                          [*]   IP: advanced router                                                          x x
  x x                          [*]     IP: policy routing                                                         x x
  x x                          [*]       IP: use netfilter MARK value as routing key                              x x
  x x                          [*]       IP: fast network address translation                                     x x
  x x                          [*]     IP: equal cost multipath                                                   x x
  x x                          [*]     IP: use TOS value as routing key                                           x x
  x x                          [ ]     IP: verbose route monitoring                                               x x
  x x                          [ ]   IP: kernel level autoconfiguration                                           x x
  x x                          <M>   IP: tunneling                                                                x x
  x x                          <M>   IP: GRE tunnels over IP                                                      x x
  x x                          [*]     IP: broadcast GRE over IP                                                  x x
  x x                          [*]   IP: multicast routing                                                        x x
  x x                          [*]     IP: PIM-SM version 1 support                                               x x
  x x                          [*]     IP: PIM-SM version 2 support                                               x x
  x x                          [ ]   IP: ARP daemon support (EXPERIMENTAL)                                        x x
  x x                          [ ]   IP: TCP Explicit Congestion Notification support                             x x
  x x                          [*]   IP: TCP syncookie support (disabled per default)                             x x
  x x                            IP: Netfilter Configuration  --->                                                x x
  x x                            IP: Virtual Server Configuration  --->                                           x x
  x x                          <M>   The IPv6 protocol (EXPERIMENTAL)                                             x x
  x x                            IPv6: Netfilter Configuration  --->                                              x x
  x x                          <M>   Kernel httpd acceleration (EXPERIMENTAL)                                     x x
  x x                          < > Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)                                x x
  x x                          < > 802.1Q VLAN Support                                                            x x
  x x                          ---                                                                                x x
  x x                          <M> The IPX protocol                                                               x x
  x x                          [*]   IPX: Full internal IPX network                                               x x
  x x                          <M> Appletalk protocol support                                                     x x
  x x                          Appletalk devices  --->                                                            x x
  x x                          < > DECnet Support                                                                 x x
  x x                          <M> 802.1d Ethernet Bridging                                                    x x
  x x                          < > CCITT X.25 Packet Layer (EXPERIMENTAL)                                         x x
  x x                          < > LAPB Data Link Driver (EXPERIMENTAL)                                           x x
  x x                          [ ] 802.2 LLC (EXPERIMENTAL)                                                       x x
  x x                          [ ] Frame Diverter (EXPERIMENTAL)                                                  x x
  x x                          < > Acorn Econet/AUN protocols (EXPERIMENTAL)                                      x x
  x x                          < > WAN router                                                                     x x
  x x                          [ ] Fast switching (read help!)                                                    x x
  x x                          [ ] Forwarding between high speed interfaces                                       x x
  x x                          QoS and/or fair queueing  --->                                                     x x
  x x                          Network testing  --->                                                              x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
  x                                        <Select>    < Exit >    < Help >                                         x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Network packet filtering debuggingが有効のままで brctlを機能させると、以下のようなメッセージが
/var/log/messagesへ鬼のように書き込まれます。
messagesって、殆ど何も書き込まれないログファイルなのですが、数十分で 10Mbyteぐらいのログが出来上がってびっくりしました。

/var/log/messages
Jun 12 23:48:50 vine1 kernel: skb: pf=7 (owned) dev=eth0 len=74
Jun 12 23:48:50 vine1 kernel: nf_hook: hook 4 already set.
Jun 12 23:48:50 vine1 kernel: skb: pf=7 (owned) dev=eth0 len=74
Jun 12 23:48:50 vine1 kernel: nf_hook: hook 0 already set.
Jun 12 23:48:50 vine1 kernel: skb: pf=2 (unowned) dev=br0 len=40
Jun 12 23:48:50 vine1 kernel: PROTO=6 192.168.0.2:2025 192.168.0.5:23 L=40 S=0x00 I=8241 F=0x4000 T=64
Jun 12 23:48:50 vine1 kernel: nf_hook: hook 1 already set.
Jun 12 23:48:50 vine1 kernel: skb: pf=2 (unowned) dev=br0 len=40
Jun 12 23:48:50 vine1 kernel: PROTO=6 192.168.0.2:2025 192.168.0.5:23 L=40 S=0x00 I=8241 F=0x4000 T=64

kernel sourceからの make

アットマーク・アイティのサイトを参考にさせていただきました。

以下の所から kernel sourceを rpmします。
rpm -ivh http://www.dnsbalance.ring.gr.jp/archives/linux/Vine/Vine-2.6/updates/RPMS/i386/kernel-source-2.4.22-0vl2.19.i386.rpm

/usr/src/linux下に展開されるようなので、以下のコマンドを実行

cd /usr/src/linux
make menuconfig
詳しくは brctlのページを参照

make dep
make clean
make bzImage
make modules
make modules_install

これから先は、エイヤ!でやってしまったので記録が残っていません。
次やるときに更新しようと思います。

一応メモ

以下のファイルが出来上がります。
/usr/src/linux/arch/i386/boot/bzImage
/usr/src/linux/System.map
これを /bootディレクトリーへコピー
自分の好きな名前でよいです。

cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-200506
cp /usr/src/linux/System.map /boot/System.map-200506

initrdの作成
grubの更新

11238
戻る