カーネルアップグレード

emergeでgentoo-sourcesが入っていたので,
2.6.27-gentoo-r8から,2.6.28-gentoo-r5にアップグレードしました.


参考にするのはGentooHandbook
http://www.gentoo.org/doc/ja/kernel-upgrade.xml

「3.」にあるように

[ebuild    NS ] sys-kernel/gentoo-sources-2.6.9-r2 [2.6.8-r5]

NSとあるのは,New Slotの意味であり

注意: 上の出力にある"NS"ラベルは、新しいカーネルが個別に(New Slot)にインストールされるという意味です。すなわち、古いカーネルのソースは手動で削除するまで保存されます。

http://www.gentoo.org/doc/ja/kernel-upgrade.xml

だそうです.

この後の設定を行っていきます.

4.シンボリックリンクの更新

# ls -lFGg /usr/src/
total 8
lrwxrwxrwx  1   22 Feb 16 16:51 linux -> linux-2.6.27-gentoo-r8/
drwxr-xr-x 24 4096 Apr  9 20:20 linux-2.6.27-gentoo-r8/
drwxr-xr-x 22 4096 Jun 20 11:42 linux-2.6.28-gentoo-r5/

古いカーネルを指しているので,

# cd /usr/src
# ln -sfn linux-2.6.28-gentoo-r5 linux
# ls -lFGg 
total 8
lrwxrwxrwx  1   22 Jun 20 12:43 linux -> linux-2.6.28-gentoo-r5/
drwxr-xr-x 24 4096 Jun 20 12:42 linux-2.6.27-gentoo-r8/
drwxr-xr-x 22 4096 Jun 20 11:42 linux-2.6.28-gentoo-r5/

更新しました.

カーネルオプションの確認

カーネルコンパイルの前に,カーネルオプションを確認.
以前のバージョンとできるだけ同じようにしつつ,
イメージのサイズを小さくできたらいいな.


動いていたバージョンから,冒険するために変更してみたのは以下.

Bus options
PCIバス接続ハードウエアをどのように検出するかを設定する
PCI_GOANY: BIOS -> Any
Location:
 -> Bus options (PCI etc.)
   -> PCI support (PCI [=y])
     -> PCI access mode (<choice> [=y])
Networking support
IPsecのPF_KEYv2に対応したソケットを利用可能にする
CONFIG_NET_KEY: Y -> n
Location:
 -> Networking support (NET [=y])
   -> Networking options

DHCPクライアント機能を有効にする
CONFIG_IP_PNP_DHCP: Y -> n
Location:
 -> Networking support (NET [=y])
   -> Networking options
     -> TCP/IP networking (INET [=y])
       -> IP: kernel level autoconfiguration (IP_PNP [=y])

RARPでIPアドレスを取得可能にする
CONFIG_IP_PNP_RARP: n -> Y
Location:
 -> Networking support (NET [=y])
   -> Networking options
     -> TCP/IP networking (INET [=y])
       -> IP: kernel level autoconfiguration (IP_PNP [=y])

ATM(非同期転送モード)の設定
CONFIG_ATM: M -> n
Location:
 -> Networking support (NET [=y])
   -> Networking options

仮想サブネット(IEEE802.1Q)を利用可能にする
CONFIG_VLAN_8021Q: M -> n
Location:
 -> Networking support (NET [=y])
   -> Networking options

無線LANに関する設定
WIRELESS: 構造が変わっているが,部分的にY -> 完全にn
Location:
 -> Networking support (NET [=y])

RFスイッチを経由した制御を有効にする
CONFIG_RFKILL: M -> n
Location:
 -> Networking support (NET [=y])
Device Drivers

音声なし,などできるだけ軽くしていく方向で.

ISAデバイスのPlug and Playの有効?
CONFIG_ISAPNP: Y -> n
Location:
 -> Device Drivers
   -> Plug and Play support (PNP [=y])

CONFIG_BLK_CPQ_DA: M -> n
Location:
 -> Device Drivers
   -> Block devices (BLK_DEV [=y])

CONFIG_BLK_CPQ_CISS_DA: M -> n
Location:
 -> Device Drivers
   -> Block devices (BLK_DEV [=y])

CONFIG_EEPROM_93CX6: M -> n
Location:
 -> Device Drivers
   -> Misc devices (MISC_DEVICES [=y])

CONFIG_FUJITSU_LAPTOP: M -> n
Location:
 -> Device Drivers
   -> Misc devices (MISC_DEVICES [=y])

CONFIG_MSI_LAPTOP: M -> n
Location:
 -> Device Drivers
   -> Misc devices (MISC_DEVICES [=y])

CONFIG_SONY_LAPTOP: M -> n
Location:
 -> Device Drivers
   -> Misc devices (MISC_DEVICES [=y])

CONFIG_THINKPAD_ACPI: M -> n
Location:
 -> Device Drivers
   -> Misc devices (MISC_DEVICES [=y])
Device Drivers->ディスク関連
  • Device Drivers -> ATA/ATAPI/WFW/RLL support
  • Device Drivers -> SCSI device support
  • Device Drivers -> Serial ATA (prod) and Parallel ATA (experimental) drivers

これらはPCの起動に関わると思うので,ちょっと厄介.前回はかなり悩まされた.


(1) Device Drivers -> ATA/ATAPI/WFW/RLL support
ざっと見た感じ,いくつか変わってる.いやだなあ.

CONFIG_BLK_DEV_IDE:
(Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support)
が消えてた.
Documentation/ide/ide.txtに,

The latest standards define some enhancements, known as the ATA-6 spec,
which grew out of vendor-specific "Enhanced IDE" (EIDE) implementations.

と書いてあるのと関係あるかな?2.6.27-r8の方にも書いてはあるのだけれど.


フロッピーとIDEディスクの設定の配置が変更されているようだ.
つまり,2.6.27-r8では以下だったのが,

CONFIG_BLK_DEV_IDEDISK:
(Include IDE/ATA-2 DISK support)
Location:
 -> Device Drivers
   -> ATA/ATAPI/MFM/RLL support (IDE [=y])
     -> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support (BLK_DEV
CONFIG_BLK_DEV_IDEFLOPPY:
(Include IDE/ATAPI FLOPPY support)
Location:
 -> Device Drivers
   -> ATA/ATAPI/MFM/RLL support (IDE [=y])
     -> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support (BLK_DEV

2.6.28-r5では以下に変更されているようだ.

CONFIG_IDE_GD:
(generic ATA/ATAPI disk support)
Location:
 -> Device Drivers
   -> ATA/ATAPI/MFM/RLL support (IDE [=y])

CONFIG_IDE_GD_ATA:
(ATA disk support)
Location:
 -> Device Drivers
   -> ATA/ATAPI/MFM/RLL support (IDE [=y])
     -> generic ATA/ATAPI disk support (IDE_GD [=y])

CONFIG_IDE_GD_ATAPI:
(ATAPI floppy support)
Location:
 -> Device Drivers
   -> ATA/ATAPI/MFM/RLL support (IDE [=y])
     -> generic ATA/ATAPI disk support (IDE_GD [=y])

フロッピーは,2.6.27-r8では`M'にしたけれど,
2.6.28-r5では`Y/n'しかスイッチできなかったので,Yにした.


(2) Device Drivers -> SCSI device support

CONFIG_CHR_DEV_SCH: Y -> n
Location:
 -> Device Drivers
   -> SCSI device support

CONFIG_SCSI_MULTI_LUN: Y -> n
Location:
 -> Device Drivers
   -> SCSI device support

CONFIG_SCSI_SCAN_ASYNC: Y -> n
Location:
 -> Device Drivers
   -> SCSI device support

以下が追加されてる.

CONFIG_SCSI_SAS_ATA:
Location:
 -> Device Drivers
   -> SCSI device support
     -> SCSI Transports
       -> SAS Domain Transport Attributes (SCSI_SAS_LIBSAS [=y])

libataが必須らしい.
libataは入れるつもりだが,これは必要なさそう.`n'とする.


(3) Device Drivers -> Serial ATA (prod) and Parallel ATA (experimental) drivers
2.6.27-r8と同じにした.


Device Drivers続き
CONFIG_DAVICOM_PHY: Y -> n
Location:
 -> Device Drivers
   -> Network device support (NETDEVICES [=y])
     -> PHY Device support and infrastructure (PHYLIB [=y])

CONFIG_FIXED_PHY: Y -> n
Location:
 -> Device Drivers
   -> Network device support (NETDEVICES [=y])
     -> PHY Device support and infrastructure (PHYLIB [=y])

CONFIG_E1000E: Y -> n
Location:
 -> Device Drivers
   -> Network device support (NETDEVICES [=y])
     -> Ethernet (1000 Mbit) (NETDEV_1000 [=y])

CONFIG_SENSORS_VT8231: n -> M
Location:
 -> Device Drivers
   -> Hardware Monitoring support (HWMON [=m])

CONFIG_DAB: Y -> n
Location:
 -> Device Drivers
   -> Multimedia devices

CONFIG_DRM: Y -> n
Location:
 -> Device Drivers
   -> Graphics support

CONFIG_FB_NVIDIA_BACKLIGHT: Y -> n
Location:
 -> Device Drivers
   -> Graphics support
     -> Support for frame buffer devices (FB [=y])
       -> nVidia Framebuffer Support (FB_NVIDIA [=y])

CONFIG_BACKLIGHT_CLASS_DEVICE: Y -> n
Location:
 -> Device Drivers
   -> Graphics support
     -> Backlight & LCD device support (BACKLIGHT_LCD_SUPPORT [=y])

CONFIG_USB_STORAGE_JUMPSHOT: Y -> n
Location:
 -> Device Drivers
   -> USB support (USB_SUPPORT [=y])
     -> USB Mass Storage support (USB_STORAGE [=m])

CONFIG_USB_STORAGE_ALAUDA: Y -> n
Location:
 -> Device Drivers
   -> USB support (USB_SUPPORT [=y])
     -> USB Mass Storage support (USB_STORAGE [=m])

CONFIG_USB_LCD: Y -> n
Location:
 -> Device Drivers
   -> USB support (USB_SUPPORT [=y])

CONFIG_USB_LED: Y -> n
Location:
 -> Device Drivers
   -> USB support (USB_SUPPORT [=y])

以下が追加されている.

CONFIG_STAGING_EXCLUDE_BUILD:
Location:
 -> Device Drivers
   -> Staging drivers (STAGING [=y])

`n'にしておく.

File systems

DVDドライブを搭載しているのに,iso9660しか入れてなかったようなのでUDFも追加.

CONFIG_UDF_FS: n -> Y
Location:
 -> File systems
   -> CD-ROM/DVD Filesystems

CONFIG_NTFS_RW: n -> Y
Location:
 -> File systems
   -> DOS/FAT/NT Filesystems
     -> NTFS file system support (NTFS_FS [=m])
Kernel hacking
CONFIG_OPTIMIZE_INLINING: n -> Y
Location:
 -> Kernel hacking
Security options

securityfsが追加されていた.
(securityfs?
Linux Kernel Watch番外編:セキュリティをやってるやつらは狂っている?! − @IT@IT:オリジナルセキュリティモジュールを拡張する(1/2))
使う当てはない分からないので今回はnにしておく.

Cryptographic API
  • FIPS 200 compliance
  • CRC32c INTEL hardware acceleration
  • Pseudo Random Number Generation for Cryptographic modules

が追加されていた.

これらはnにしておいた.

CONFIG_CRYPTO_CRC32C: Y -> M
Location:
 -> Cryptographic API (CRYPTO [=y])
Library routines
CONFIG_CRC_ITU_T: n -> M
Location:
 -> Library routines

CONFIG_LIBCRC32C: Y -> n
Location:
 -> Library routines

コンパイル,その後の設定

コンパイル

# make && make modules_install


カーネルイメージのコピー

# cp -a arch/x86/boot/bzImage /boot/kernel-2.6.28-gentoo-r5

arch/i386/boot/bzImageが,
arch/x86/boot/bzImageにシンボリックリンクを張っていたので,
gentoo handbookとは違ってi386ではなく,x86にした.


.configファイルもバックアップを取っておくといいかもしれない.

CONFIG_IKCONFIG_PROC
Location:
 -> General setup
   -> Kernel .config support (IKCONFIG [=y])

を`Y'にしておけば,

# zcat /proc/config.gz

で確認することはできますけれども.


自動的にロードさせるモジュールの設定
とりあえず,全部自動ロードさせる.

# find /lib/modules/2.6.28-gentoo-r5/ -type f -iname '*.o' -or -iname '*.ko' | sed -e 's#^.*/\(.*\)\.k\?o$#\1#' >> /etc/modules.autoload.d/kernel-2.6


grub.confの更新;以下の行を追加

title Gentoo Linux 2.6.28-r5
root (hd0,0)
kernel /boot/kernel-2.6.28-gentoo-r5 root=/dev/hda2 noapic

たぶん,grub-installをする必要はないと思う.

6.外部モジュール

は無かったはず.

7.新しいカーネルで再起動

# shutdown -r now

緊張の時.


カーネルコンパイルをしては起動せず,
# オプションを変更してコンパイルの無限ループはもうたくさん!

起動できたらあとは楽しむだけ

# 2,3回失敗したけど ;(

補足1

一応lspci,lsmodの結果を載せておく.


まずは2.6.27-r8から.

  • lspci
00:00.0 Host bridge: VIA Technologies, Inc. VT82C693A/694x [Apollo PRO133x] (rev c4)
00:01.0 PCI bridge: VIA Technologies, Inc. VT82C598/694x [Apollo MVP3/Pro133x AGP]
00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 22)
00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 10)
00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 10)
00:07.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 10)
00:07.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 30)
00:0c.0 Mass storage controller: Promise Technology, Inc. PDC20265 (FastTrak100 Lite/Ultra100) (rev 02)
00:0e.0 RAID bus controller: Silicon Image, Inc. SiI 3512 [SATALink/SATARaid] Serial ATA Controller (rev 01)
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 Gigabit Ethernet Adapter (rev 11)
01:00.0 VGA compatible controller: nVidia Corporation NV10 [GeForce 256 SDR] (rev 10)
  • lsmod
Module                  Size  Used by
ipv6                  236260  14
dock                   18448  0
video                  26640  0
backlight              13188  1 video
output                 11776  1 video
ac                     12544  0
battery                16640  0
fan                    12804  0
via_velocity           37508  0
crc_ccitt              10240  1 via_velocity
thermal                24092  0
processor              39656  1 thermal
button                 16528  0
rtc                    20768  0
tg3                   111748  0
e1000                 119616  0
jfs                   169836  0
raid10                 30080  0
raid456               129296  0
async_memcpy           10880  1 raid456
async_xor              12160  1 raid456
xor                    21896  2 raid456,async_xor
async_tx               15948  3 raid456,async_memcpy,async_xor
raid1                  30080  0
raid0                  15872  0
dm_bbr                 20128  0
dm_snapshot            24996  0
dm_mirror              29440  0
dm_mod                 63428  3 dm_bbr,dm_snapshot,dm_mirror
sbp2                   29960  0
ohci1394               38192  0
ieee1394               92600  2 sbp2,ohci1394
sl811_hcd              19968  0
usbhid                 35712  0
ohci_hcd               29700  0
uhci_hcd               30988  0
usb_storage           120608  0
ehci_hcd               39948  0
usbcore               133484  7 sl811_hcd,usbhid,ohci_hcd,uhci_hcd,usb_storage,ehci_hcd
lpfc                  216016  0
qla2xxx               168548  0
firmware_class         17408  1 qla2xxx
megaraid_sas           35504  0
megaraid_mbox          38160  0
megaraid_mm            18464  1 megaraid_mbox
megaraid               44360  0
aacraid                68996  0
sx8                    25484  0
DAC960                 73032  0
cciss                  41220  0
cpqarray               28004  0
3w_9xxx                39300  0
3w_xxxx                32928  0
mptsas                 43144  0
scsi_transport_sas     37120  1 mptsas
mptfc                  25988  0
scsi_transport_fc      49028  3 lpfc,qla2xxx,mptfc
scsi_tgt               22344  1 scsi_transport_fc
mptspi                 28296  0
mptscsih               41344  3 mptsas,mptfc,mptspi
mptbase                78308  4 mptsas,mptfc,mptspi,mptscsih
atp870u                36352  0
dc395x                 39052  0
sim710                 13188  0
53c700                 33444  1 sim710
qla1280               123660  0
dmx3191d               20096  0
sym53c8xx              77588  0
qlogicfas408           15104  0
aha152x                42512  0
aha1740                15872  0
advansys               85248  0
initio                 24900  0
BusLogic               72948  0
arcmsr                 29952  0
aic7xxx               168760  0
aic79xx               241624  0
scsi_transport_spi     30848  7 mptspi,53c700,dmx3191d,sym53c8xx,aha152x,aic7xxx,aic79xx
sg                     41360  0
pdc_adma               17668  0
sata_inic162x          20228  0
sata_mv                28936  0
ata_piix               26372  0
ahci                   34180  0
sata_qstor             17924  0
sata_vsc               16516  0
sata_uli               15620  0
sata_sis               16772  0
sata_sx4               20484  0
sata_nv                33160  0
sata_via               19588  0
sata_svw               15748  0
sata_sil24             24068  0
sata_sil               19080  0
sata_promise           20996  0
scsi_wait_scan          9472  0
pata_sis               21892  1 sata_sis
libata                152248  17 pdc_adma,sata_inic162x,sata_mv,ata_piix,ahci,sata_qstor,sata_vsc,sata_uli,sata_sis,sata_sx4,sata_nv,sata_via,sata_svw,sata_sil24,sata_sil,sata_promise,pata_sis


そして,今回セットアップした2.6.28-r5.

  • lspci
00:00.0 Host bridge: VIA Technologies, Inc. VT82C693A/694x [Apollo PRO133x] (rev c4)
00:01.0 PCI bridge: VIA Technologies, Inc. VT82C598/694x [Apollo MVP3/Pro133x AGP]
00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 22)
00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 10)
00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 10)
00:07.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 10)
00:07.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 30)
00:0c.0 Mass storage controller: Promise Technology, Inc. PDC20265 (FastTrak100 Lite/Ultra100) (rev 02)
00:0e.0 RAID bus controller: Silicon Image, Inc. SiI 3512 [SATALink/SATARaid] Serial ATA Controller (rev 01)
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 Gigabit Ethernet Adapter (rev 11)
01:00.0 VGA compatible controller: nVidia Corporation NV10 [GeForce 256 SDR] (rev 10)
  • lsmod
Module                  Size  Used by
test_nx                 2432  0 
xfrm_user              17920  0 
xt_policy               3200  0 
xt_TCPMSS               3328  0 
ah4                     4736  0 
ipcomp                  3200  0 
xfrm_ipcomp             5256  1 ipcomp
xfrm4_mode_transport     2176  0 
esp4                    5888  0 
xfrm4_mode_tunnel       2688  0 
xfrm4_mode_beet         2816  0 
xfrm4_tunnel            2432  0 
tunnel4                 3080  1 xfrm4_tunnel
inet_lro                6400  0 
dc395x                 29324  0 
sim710                  3716  0 
aic94xx                58844  0 
qla2xxx               161740  0 
raid_class              4864  0 
a100u2w                 8640  0 
arcmsr                 20096  0 
scsi_wait_scan          1664  0 
libsrp                  6528  0 
qla4xxx                46780  0 
qla1280               113932  0 
tmscsim                18220  0 
aacraid                59276  0 
megaraid_sas           26392  0 
megaraid_mbox          26384  0 
megaraid_mm             8732  1 megaraid_mbox
qlogicfas408            6912  0 
53c700                 22152  1 sim710
aic79xx               118452  0 
aic7xxx               107300  0 
aha1740                 6784  0 
megaraid               30992  0 
3w_9xxx                26888  0 
initio                 15684  0 
ipr                    71700  0 
3w_xxxx                21764  0 
BusLogic               20740  0 
nsp32                  20728  0 
scsi_transport_srp      5760  0 
gdth                   76116  0 
advansys               70656  0 
dmx3191d                9984  0 
scsi_dh                 6404  0 
sym53c8xx              65048  0 
scsi_transport_spi     19200  5 53c700,aic79xx,aic7xxx,dmx3191d,sym53c8xx
atp870u                25600  0 
hptiop                 12544  0 
lpfc                  222416  0 
scsi_transport_fc      35460  2 qla2xxx,lpfc
scsi_tgt               11544  3 libsrp,scsi_transport_srp,scsi_transport_fc
psmouse                37392  0 
ehci_hcd               29708  0 
ohci_hcd               20624  0 
usbserial              24964  0 
usb_storage            98264  0 
cypress_cy7c63          3712  0 
hid_sunplus             2304  0 
hid_cherry              2432  0 
hid_apple               6144  0 
hid_a4tech              2816  0 
hid_sony                2944  0 
hid_samsung             2432  0 
hid_logitech            4992  0 
hid_chicony             2304  0 
hid_cypress             2688  0 
hid_pl                  2304  0 
hid_ezkey               2176  0 
hid_monterey            2432  0 
hid_microsoft           3588  0 
hid_dell                2304  0 
hid_belkin              2688  0 
hid_bright              2304  0 
usbhid                 30804  3 hid_logitech,hid_dell,hid_bright
hid_petalynx            2816  0 
hid_gyration            2560  0 
nbd                    10128  0 
DAC960                 59152  0 
vt8231                 14348  0 
hwmon                   2844  1 vt8231
hwmon_vid               3072  0 
pata_acpi               4224  0 
ata_generic             4996  0 
sata_sis                5508  0 
pata_sis               10116  1 sata_sis
ahci                   27144  0 
sata_sil24             12548  0 
ntfs                  175788  0 
udf                    65676  0 
crc_itu_t               2432  1 udf
ext2                   42500  0 
deflate                 2944  0 
zlib_deflate           18152  1 deflate
sg                     25012  0 
via_velocity           26248  0 
sata_sil                7560  3 
libata                149356  8 ipr,pata_acpi,ata_generic,sata_sis,pata_sis,ahci,sata_sil24,sata_sil
uhci_hcd               19856  0 
crc_ccitt               2432  1 via_velocity
usbcore               118228  9 ehci_hcd,ohci_hcd,usbserial,usb_storage,cypress_cy7c63,hid_sony,usbhid,uhci_hcd

補足2:起動時でオートロードできないモジュール

が,いくつかある.
そういえば前のバージョンでも見た記憶がある.忘れてた.

floppy
fdomain
eata
NCR53c406a
sym53c416
aha152x
u14-34f
pas16
ultrastor
in2000
dpt_i2o
dtc
qlogicfas
ips
wd7000
t128

この16個.

  • /lib/modules/以下をfindなどで探し,所属するディレクトリ名からmenuconfigの,どのセクションに入っているのか確かめる
  • `M'から'n'にして,構築し直してみる
  • 動けばよし