2.kernel-2.2.19から2.4.18へ移行

2.1 lilo.confの編集(LILO Boot Menuを活かす)

カーネルを再構築してみようとネットで情報を探っていると「liloプロンプトで古いカーネ ルを選ぶ、とか、選べるようにしておく」などの記事や/etc/lilo.confの編集法が目につく ことと思います。しかし、きっとあたりまえ過ぎて載せていないのでしょうが、どうしたら 選べるのかの辺りに不親切さを感じます。と、いうことで"LILO Boot Menu"を活かす方法を。
他のディストリビュージョンは知りませんがdebianのデフォルトでは、"LILO Boot Menu"を 表示する設定になっていません。しかし、ちょこちょこっと所々コメントを外してやりさえすれば OKです。
/etc/lilo.confの編集

# message=/boot/bootmess.txt
# prompt ←コメントを外す
# single-key
# delay=100 ←コメントを外す
# timeout=100 ←コメントを外す
これ以外は、とりあえずそのままで編集を終える。

# lilo -v
(-v は無くてもいいですが、いろいろ見えるから参考になるかも)

# reboot

どうです?"LILO Boot Menu"画面が出てきたでしょう。
一度でもカーネルを再構築されていたなら

"LILO Boot Menu"

Linux
LinuxOLD

と、表示するでしょう。

2.2 カーネルのバックアップ

カーネルの再構築の前にこれまで働いていたカーネルのバックアップを名前を付替えてとっておく

例:
今のカーネル:2.2.19
前のカーネル:2.2.18

# cd /boot
# cp -p vmlinuz-2.2.18 vmlinuz-2.2.18.010627.01
# cp -p vmlinuz-2.2.19 vmlinuz-2.2.19.020104.01

2.3 lilo.confの再編集(これまで働いていたカーネルを使えるようにしておく)

"LILO Boot Menu"画面で古いカーネルを選択できるようにする。今回の例では2.2.18と2.2.19でバージョン に違いがあるのでわかり易いですが同じバージョンでmenuconfigの設定を換えた場合などに有効です。
今回menuconfigの設定を誤ってしまいNICが黙ってしまうミスを犯したんですが、準備をしておいて事無きを得ました(^^;)

再度/etc/lilo.confの編集

次を追加する

image=/boot/vmlinuz-2.2.18.010627.01
label=Linux2.2.18.01 ← 長いと怒られるよ(^^;)
read-only
optional

image=/boot/vmlinuz-2.2.19.020104.01
label=Linux2.2.19.01
read-only
optional

2.4 編集したliloを有効に

編集したliloを有効に

# lilo -v

ここで怒られなくなるまで/etc/lilo.confの編集をしてみる。
(label名が長すぎると怒られるよ)

怒られなかったら再起動してみる。

# reboot

"LILO Boot Menu"

Linux
LinuxOLD
Linux2.2.18.01
Linux2.2.19.01

と、表示したら成功です。
後は新しいカーネルをインストールして例え動きがおかしくなったとしても、以前の安定したカーネルに戻す ことができますから安心していろんな設定を試すことができますね。

2.5 ソースからの展開

# cd /usr/src
# tar -jxvf kernel-source-2.4.18.tar.bz2 .....展開
# ln -s kernel-source-2.4.18 linux ...........シンボリックリンクを張る
# ln -s kernel-source-2.4.18 linux-2.4.18 ....シンボリックリンクを張る

2.6 menuconfigの設定

# cd /usr/src/linux
# make menuconfig

Load an Alternate Configuration File ←最初にここを選択

以前動いていたconfig設定を読み込んだほうが安全でしょう。かなりハードには詳しいつもりでも 動かなくしてしまった事があります(^^;) 残しておいた/boot/config-2.4.03.my03などを予め読み込むことに。
Linux Kernel v2.4.18 Configuration

■ Code maturity level options --->

[ ] Prompt for development and/or incomplete code/drivers
■ Loadable module support --->
[*] Enable loadable module support
[*] Set version information on all module symbols
[*] Kernel module loader
■ Processor type and features --->
(Pentium-MMX) Processor family
< > Toshiba Laptop support
< > Dell laptop support
< > /dev/cpu/microcode - Intel IA32 CPU microcode support
< > /dev/cpu/*/msr - Model-specific register support
< > /dev/cpu/*/cpuid - CPU information support
(off) High Memory Support
[ ] Math emulation
[ ] MTRR (Memory Type Range Register) support
[ ] Symmetric multi-processing support
[ ] Multiquad NUMA system
■ General setup --->
[*] Networking support
[*] PCI support
(Any) PCI access mode
[*] PCI device name database
[ ] EISA support
[ ] MCA support
[*] Support for hot-pluggable devices
PCMCIA/CardBus support --->
<*> PCMCIA/CardBus support ←これがないとPCMCIA network device supportが消えてしまう(^^;)
[*] CardBus support ←これがないとダメみたい
[*] i82092 compatible bridge support えいっ全部チェック
[*] i82365 compatible bridge support えいっ全部チェック
[*] Databook TCIC host bridge support えいっ全部チェック
PCI Hotplug Support --->
[*] System V IPC
[ ] BSD Process Accounting
[*] Sysctl support
(ELF) Kernel core (/proc/kcore) format
<*> Kernel support for a.out binaries
<*> Kernel support for ELF binaries
<*> Kernel support for MISC binaries
[*] Power Management support
< > Advanced Power Management BIOS support
■ Memory Technology Devices (MTD) --->
< > Memory Technology Device (MTD) support
■ Parallel port support --->
< > Parallel port support
■ Plug and Play configuration --->
<*> Plug and Play support
< > ISA Plug and Play support
■ Block devices --->
<*> Normal PC floppy disk support
< > XT hard disk support
< > Compaq SMART2 support
< > Compaq Smart Array 5xxx support
< > Mylex DAC960/DAC1100 PCI RAID Controller support
< > Loopback device support
< > Network block device support
< > RAM disk support
■ Multi-device support (RAID and LVM) --->
[ ] Multiple devices driver support (RAID and LVM)
■ Networking options --->
<*> Packet socket
[ ] Packet socket: mmapped IO
< > Netlink device emulation (NEW)
[*] Network packet filtering (replaces ipchains)
[ ] Network packet filtering debugging (NEW)
[*] Socket Filtering
<*> Unix domain sockets
[*] TCP/IP networking
[*] IP: multicasting
[*] IP: advanced router
[ ] IP: policy routing (NEW)
[ ] IP: equal cost multipath (NEW)
[ ] IP: use TOS value as routing key (NEW)
[ ] IP: verbose route monitoring (NEW)
[ ] IP: large routing tables (NEW)
[ ] IP: kernel level autoconfiguration
< > IP: tunneling
< > IP: GRE tunnels over IP
[ ] IP: multicast routing
[ ] IP: TCP Explicit Congestion Notification support
[ ] IP: TCP syncookie support (disabled per default)
IP: Netfilter Configuration --->
< > Connection tracking (required for masq/NAT)
< > IP tables support (required for filtering/masq/NAT)
<*> ipchains (2.2-style) support ←とりあえずipchainsを採用!
< > ipfwadm (2.0-style) support
--- < > The IPX protocol
< > Appletalk protocol support
< > DECnet Support
< > 802.1d Ethernet Bridging
QoS and/or fair queueing --->
[ ] QoS and/or fair queueing
■ Telephony Support --->
< > Linux telephony support
■ ATA/IDE/MFM/RLL support --->
<*> ATA/IDE/MFM/RLL support
IDE, ATA and ATAPI Block devices --->
<*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
--- Please see Documentation/ide.txt for help/info on IDE drives
[ ] Use old disk-only driver on primary interface
<*> Include IDE/ATA-2 DISK support
[*] Use multi-mode by default
< > PCMCIA IDE support
<*> Include IDE/ATAPI CDROM support
< > Include IDE/ATAPI TAPE support
< > Include IDE/ATAPI FLOPPY support
< > SCSI emulation support
--- IDE chipset support/bugfixes
[*] CMD640 chipset bugfix/support
[ ] CMD640 enhanced support
[ ] ISA-PNP EIDE support
[*] RZ1000 chipset bugfix/support
[*] Generic PCI IDE chipset support
[*] Sharing PCI IDE interrupts support
[*] Generic PCI bus-master DMA support
[ ] Boot off-board chipsets first support
[*] Use PCI DMA by default when available
[ ] AEC62XX chipset support
[ ] ALI M15x3 chipset support
[ ] AMD Viper support
[ ] CMD64X chipset support
[ ] CY82C693 chipset support
[ ] Cyrix CS5530 MediaGX chipset support
[ ] HPT34X chipset support
[ ] HPT366 chipset support
[*] Intel PIIXn chipsets support
[*] PIIXn Tuning support
[ ] NS87415 chipset support (EXPERIMENTAL)
[ ] PROMISE PDC202{46|62|65|67|68} support
[ ] ServerWorks OSB4/CSB5 chipsets support
[ ] SiS5513 chipset support
[ ] SLC90E66 chipset support
[ ] Tekram TRM290 chipset support (EXPERIMENTAL)
[ ] VIA82CXXX chipset support
[ ] Other IDE chipset support
[ ] IGNORE word93 Validation BITS
■ SCSI support --->
< > SCSI support
■ Fusion MPT device support --->
< > Fusion MPT (base + ScsiHost) drivers
■ I2O device support --->
< > I2O support
■ Network device support --->
[*] Network device support
ARCnet devices --->
< > ARCnet support
Dummy net driver support
< > Bonding driver support
< > EQL (serial line load balancing) support
< > Universal TUN/TAP device driver support
Ethernet (10 or 100Mbit) --->
[*] Ethernet (10 or 100Mbit)
< > Sun Happy Meal 10/100baseT support
< > Sun GEM support
[ ] 3COM cards
< > AMD LANCE and PCnet (AT1500 and NE2100) support
[ ] Western Digital/SMC cards
[ ] Racal-Interlan (Micom) NI cards
< > DEPCA, DE10x, DE200, DE201, DE202, DE422 support
< > HP 10/100VG PCLAN (ISA, EISA, PCI) support
[ ] Other ISA cards
[ ] EISA, VLB, PCI and on board controllers
[ ] Pocket and portable adapters
Ethernet (1000 Mbit) --->
< > Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support
< > D-Link DL2000-based Gigabit Ethernet support
< > National Semiconduct DP83820 support
< > Packet Engines Hamachi GNIC-II support
< > SysKonnect SK-98xx support
[ ] FDDI driver support
< > PPP (point-to-point protocol) support
< > SLIP (serial line) support
Wireless LAN (non-hamradio) --->
[ ] Wireless LAN (non-hamradio
Token Ring devices --->
[ ] Token Ring driver support [ ] Fibre Channel driver support
Wan interfaces --->
[ ] Wan interfaces support
PCMCIA network device support --->
[*] PCMCIA network device support
< > 3Com 3c589 PCMCIA support
< > 3Com 3c574 PCMCIA support
< > Fujitsu FMV-J18x PCMCIA support
<*> NE2000 compatible PCMCIA support
< > Asix AX88190 PCMCIA support
< > New Media PCMCIA support
< > SMC 91Cxx PCMCIA support
< > Xircom 16-bit PCMCIA support
< > Xircom CardBus support (new driver)
< > Xircom Tulip-like CardBus support (old driver)
[ ] Pcmcia Wireless LAN
■ Amateur Radio support --->
[ ] Amateur Radio support
■ IrDA (infrared) support --->
< > IrDA subsystem support
■ ISDN subsystem --->
< > ISDN support
■ Old CD-ROM drivers (not SCSI, not IDE) --->
[ ] Support non-SCSI/IDE/ATAPI CDROM drives
■ Input core support --->
< > Input core support
■ Character devices --->
[*] Virtual terminal
[*] Support for console on virtual terminal
<*> Standard/generic (8250/16550 and compatible UARTs) serial supportx x
[ ] Support for console on serial port
[ ] Extended dumb serial driver options
[ ] Non-standard serial port support
[*] Unix98 PTY support
(256) Maximum number of Unix98 PTYs in use (0-2048)
I2C support --->
Mice --->
Joysticks ---> < > QIC-02 tape support
Watchdog Cards --->
< > Intel i8x0 Random Number Generator support
< > /dev/nvram support
< > Enhanced Real Time Clock Support
< > Double Talk PC internal speech card support
< > Siemens R3964 line discipline
< > Applicom intelligent fieldbus card support
Ftape, the floppy tape device driver --->
<*> /dev/agpgart (AGP Support)
[*] Intel 440LX/BX/GX and I815/I830M/I840/I850 support
[*] Intel I810/I815/I830M (on-board) support
[*] VIA chipset support
[*] AMD Irongate, 761, and 762 support
[*] Generic SiS support
[*] ALI chipset support
[ ] Serverworks LE/HE support
[*] Direct Rendering Manager (XFree86 DRI support)
[ ] Build drivers for old (XFree 4.0) DRM (NEW)
--- DRM 4.1 drivers
<*> 3dfx Banshee/Voodoo3+
< > ATI Rage 128
<*> ATI Radeon
< > Intel I810
< > Matrox g200/g400
< > SiS (NEW)
PCMCIA character devices --->
< > ACP Modem (Mwave) support
■ Multimedia devices --->
< > Video For Linux
■ File systems --->
[ ] Quota support
< > Kernel automounter support
<*> Kernel automounter version 4 support (also supports v3)
< > Reiserfs support
< > Ext3 journalling file system support (EXPERIMENTAL)
< > DOS FAT fs support
< > Compressed ROM file system support
[*] Virtual memory file system support (former shm fs)
< > Simple RAM-based file system support
<*> ISO 9660 CDROM file system support
[ ] Microsoft Joliet CDROM extensions
[ ] Transparent decompression extension
< > Minix fs support
< > FreeVxFS file system support (VERITAS VxFS(TM) compatible)
< > NTFS file system support (read only)
< > OS/2 HPFS file system support
[*] /proc file system support
[*] /dev/pts file system for Unix98 PTYs
< > ROM file system support
<*> Second extended fs support
< > System V/Xenix/V7/Coherent file system support
< > UDF file system support (read only)
< > UFS file system support (read only)
Network File Systems --->
< > Coda file system support (advanced network fs)
<*> NFS file system support
[ ] Provide NFSv3 client support
<*> NFS server support
[ ] Provide NFSv3 server support
< > SMB file system support (to mount Windows shares etc.)
< > NCP file system support (to mount NetWare volumes)
Partition Types --->
[ ] Advanced partition selection
■ Console drivers --->
[*] VGA text console
[ ] Video mode selection support
■ Sound --->
< > Sound card support
■ USB support --->
< > Support for USB
--- USB Controllers
--- USB Device Class drivers
--- SCSI support is needed for USB Storage
--- USB Human Interface Devices (HID)
--- Input core support is needed for USB HID
--- USB Imaging devices
--- USB Multimedia devices
--- Video4Linux support is needed for USB Multimedia device support
--- USB Network adaptors
--- USB port drivers
USB Serial Converter support --->
--- USB Miscellaneous drivers
■ Kernel hacking --->
[ ] Kernel debugging
このmenuconfigの設定だとconfigはこんな感じになりました
config-2.4.18

2.7 カーネルパッケージを作成

# make-kpkg clean
# make-kpkg --revision hoge.020527.01 kernel_image

kernel-image-2.4.18_hoge.020527.01_i386.deb ←ができる!

2.8 インストール前にPCカードを外す

PCカード(NIC)はこの時点で外した方が無難でしょう。きっと後で外すことになるはずです
2.9 kernel-2.4.18をインストール

ここでやっとインストールできる

# dpkg -i /usr/src/kernel-image-2.4.18_hoge.020527.01_i386.deb

WARNING
If you are keeping another operating system or another version
of Linux on a separate disk partition, you should not have LILO
install a boot block now. Wait until you read the LILO documentation.
That is because installing a boot block now might make the other
system un-bootable. If you only want to run this version of Linux,
go ahead and install the boot block here. If it does not work, you
can still boot this system from a boot floppy.

Would you like to create a boot floppy now? [No]
You already have a LILO configuration in /etc/lilo.conf
Install a boot block using the existing /etc/lilo.conf? [Yes]

Testing lilo.conf ...
Testing successful.
Installing the partition boot sector...
Installation successful.

リブートする

# shutdown -r 0