カーネルのコンパイル(5)再度 3.2.9 を

Debian LS-VL

調子に乗って、最新の stable Linux 3.2.9をコンパイル、 起動しようとしたら、 異音を発しながら、リブートを繰り返す LinkStation が出来上がった(楽

root ファイルシステムがマウント出来なかったのだが、それが
ハードウェア的な原因か、それとも
カーネルがファイルシステムを壊したのか
を検証する。

ハックキットをインストールして最初の設定を済ます

必要なパッケージのインストール

カーネルのコンパイルに必要なパッケージをインストールする
root@vl:~# apt-get install bzip2 make libc6-dev libncurses5-dev uboot-mkimage patch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  binutils cpp cpp-4.4 gcc gcc-4.4 libc-dev-bin libgmp3c2 libgomp1 libmpfr4
  linux-libc-dev manpages-dev
Suggested packages:
  binutils-doc bzip2-doc cpp-doc gcc-4.4-locales gcc-multilib autoconf
  automake1.9 libtool flex bison gdb gcc-doc libmudflap0-4.4-dev gcc-4.4-doc
  libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7
  glibc-doc make-doc ed diffutils-doc
The following NEW packages will be installed:
  binutils bzip2 cpp cpp-4.4 gcc gcc-4.4 libc-dev-bin libc6-dev libgmp3c2
  libgomp1 libmpfr4 libncurses5-dev linux-libc-dev make manpages-dev patch
  uboot-mkimage
0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.2 MB of archives.
After this operation, 46.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
	:
	:
Setting up libncurses5-dev (5.7+20100313-5) ...
Setting up make (3.81-8) ...
Setting up manpages-dev (3.27-1) ...
Setting up uboot-mkimage (0.4) ...
!root@vl:~#

カーネルソースの取得と展開

再度カーネル 3.2.9 のソースを取得する
yasunari@vl:~$ cd /mnt/share/
yasunari@vl:/mnt/share$ mkdir src
yasunari@vl:/mnt/share$ cd src
yasunari@vl:/mnt/share/src$ wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.9.tar.bz2
--2012-03-05 23:31:50--  http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.9.tar.bz2
Resolving www.kernel.org... 149.20.4.69
Connecting to www.kernel.org|149.20.4.69|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 78132997 (75M) [application/x-bzip2]
Saving to: `linux-3.2.9.tar.bz2'

100%[======================================>] 78,132,997   594K/s   in 2m 11s

2012-03-05 23:34:01 (584 KB/s) - `linux-3.2.9.tar.bz2' saved [78132997/78132997]

yasunari@vl:/mnt/share/src$ tar jxvf linux-3.2.9.tar.bz2
	:
	:
linux-3.2.9/virt/kvm/iodev.h
linux-3.2.9/virt/kvm/iommu.c
linux-3.2.9/virt/kvm/irq_comm.c
linux-3.2.9/virt/kvm/kvm_main.c
yasunari@vl:/mnt/share/src$

パッチの取得と適用

yasunari@vl:/mnt/share/src$ wget http://tyche.pu-toyama.ac.jp/~a-urasim/lsvl/data/kernel-2.6.38-lsvl.patch
--2012-03-05 23:42:48--  http://tyche.pu-toyama.ac.jp/~a-urasim/lsvl/data/kernel-2.6.38-lsvl.patch
Resolving tyche.pu-toyama.ac.jp... 133.55.114.186
Connecting to tyche.pu-toyama.ac.jp|133.55.114.186|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5957 (5.8K) [text/plain]
Saving to: `kernel-2.6.38-lsvl.patch'

100%[======================================>] 5,957       --.-K/s   in 0.04s

2012-03-05 23:42:49 (157 KB/s) - `kernel-2.6.38-lsvl.patch' saved [5957/5957]

yasunari@vl:/mnt/share/src$ cd linux-3.2.9
yasunari@vl:/mnt/share/src/linux-3.2.9$ patch -p1 < ../kernel-2.6.38-lsvl.patch
patching file arch/arm/mach-kirkwood/Kconfig
patching file arch/arm/mach-kirkwood/Makefile
patching file arch/arm/mach-kirkwood/lsvl-setup.c
patching file arch/arm/tools/mach-types
Hunk #1 FAILED at 3316.
1 out of 1 hunk FAILED -- saving rejects to file arch/arm/tools/mach-types.rej
yasunari@vl:/mnt/share/src/linux-3.2.9$ cd arch/arm/tools/
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/tools$ vi mach-types.rej mach-types
2 files to edit
	:
	:
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/tools$ cd ../mach-kirkwood$
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/mach-kirkwood$ vi lsvl-setup.c
	:

カーネルの設定

yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/tools$ cd ../../..
yasunari@vl:/mnt/share/src/linux-3.2.9$ make kirkwood_defconfig
#
# configuration written to .config
#
yasunari@vl:/mnt/share/src/linux-3.2.9$
ん?なんか出力が少ない
yasunari@vl:/mnt/share/src/linux-3.2.9$ cp .config .config.save
yasunari@vl:/mnt/share/src/linux-3.2.9$ make menuconfig
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
yasunari@vl:/mnt/share/src/linux-3.2.9$ make menuconfig
scripts/kconfig/mconf Kconfig
	:
	:
#
# configuration written to .config
#


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

yasunari@vl:/mnt/share/src/linux-3.2.9$

コンパイル

yasunari@vl:/mnt/share/src/linux-3.2.9$ make dep
scripts/kconfig/conf --silentoldconfig Kconfig
*** Warning: make dep is unnecessary now.
yasunari@vl:/mnt/share/src/linux-3.2.9$ make uImage
  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
	:
	:
一時間弱待ち

プシュー
ゴクゴク
むはー(笑

  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-3.2.9-20120306
Created:      Tue Mar  6 22:11:54 2012
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2802248 Bytes = 2736.57 kB = 2.67 MB
Load Address: 0x00008000
Entry Point:  0x00008000
  Image arch/arm/boot/uImage is ready
yasunari@vl:/mnt/share/src/linux-3.2.9$ make modules
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
	:
	:
  LD [M]  lib/crc-itu-t.ko
  CC      net/core/pktgen.mod.o
  LD [M]  net/core/pktgen.ko
yasunari@vl:/mnt/share/src/linux-3.2.9$

インストール

yasunari@vl:/mnt/share/src/linux-3.2.9$ su - root
Password:
root@vl:~# cd /boot
root@vl:/boot# ls
initrd.buffalo  lost+found  uImage.buffalo
root@vl:/boot# mv uImage.buffalo uImage.buffalo.orig
root@vl:/boot# cd /mnt/share/src/linux-3.2.9
root@vl:/mnt/share/src/linux-3.2.9# cp arch/arm/boot/uImage /boot/uImage.buffalo
root@vl:/mnt/share/src/linux-3.2.9# make modules_install
  INSTALL crypto/cbc.ko
  INSTALL crypto/pcbc.ko
  INSTALL drivers/cdrom/cdrom.ko
  INSTALL drivers/hid/hid-logitech-dj.ko
  INSTALL drivers/scsi/scsi_wait_scan.ko
  INSTALL drivers/scsi/sg.ko
  INSTALL drivers/scsi/sr_mod.ko
  INSTALL drivers/usb/class/usblp.ko
  INSTALL fs/isofs/isofs.ko
  INSTALL fs/udf/udf.ko
  INSTALL lib/crc-itu-t.ko
  INSTALL net/core/pktgen.ko
  DEPMOD  3.2.9-20120306
root@vl:/mnt/share/src/linux-3.2.9#

リブート

root@vl:/mnt/share/src/linux-3.2.9# reboot
リブートを繰り返す LinkStation 再現完了

HDD を見る

LS-VL から HDD を取り外し、USB で LS-QL に接続、 マウントしてみる
root@qube:~# dmesg | tail
sd 2:0:0:0: [sdd] Mode Sense: 21 00 00 00
sd 2:0:0:0: [sdd] Assuming drive cache: write through
sd 2:0:0:0: [sdd] 398297088 512-byte hardware sectors (203928 MB)
sd 2:0:0:0: [sdd] Write Protect is off
sd 2:0:0:0: [sdd] Mode Sense: 21 00 00 00
sd 2:0:0:0: [sdd] Assuming drive cache: write through
 sdd: sdd1 sdd2 sdd3 sdd4
sd 2:0:0:0: [sdd] Attached SCSI disk
sd 2:0:0:0: Attached scsi generic sg3 type 0
usb-storage: device scan complete
root@qube:~# mkdir /tmp/root
root@qube:~# mount /dev/sdd2 /tmp/root
root@qube:~# ls /tmp/root
bin   dev  home    lib    mnt  proc  sbin     srv  tmp  var
boot  etc  initrd  media  opt  root  selinux  sys  usr
root@qube:~#
マウントできた。
と言うことは先日の HDD は物理的故障か?
ややこしい時に壊れるなぁ!

ログを見る

root@qube:~# cd /tmp/root/var/log/
root@qube:/tmp/root/var/log#
ちょこちょこ見てみたが、ログは残っていないようだ。残念
ということで、シリアルコンソールが繋がらない LS-VL ではお手上げ\-_-/

LS-VL

楽天市場
Amazon
livedoor デパート
バッファローダイレクト
Yahoo!ショッピング


カーネルのコンパイル(4)起動しない 3.2.9 からの復旧
ハックの記録
LinkStation/玄箱 をハックしよう

次の目標

Copyright (C) 2003-2012 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市