カーネルのコンパイル(3)3.2.9

Debian LS-VL

調子に乗って、最新の stable Linux 3.2.9。
まぁ、うまくいかんでしょう。

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

yasunari@vl:/mnt/share/src$ wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.9.tar.bz2
--2012-03-04 21:13:14--  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   548K/s   in 87s

2012-03-04 21:14:41 (879 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/
linux-3.2.9/.gitignore
linux-3.2.9/.mailmap
linux-3.2.9/COPYING
linux-3.2.9/CREDITS
linux-3.2.9/Documentation/
linux-3.2.9/Documentation/.gitignore
linux-3.2.9/Documentation/00-INDEX
	:
	:
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$

LS-VL用パッチの適用

2.6.38 用のパッチをあてる。
あたらなかったら、あきらめる。
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$ 
ヤッパリ reject が。
でも、このぐらいなら直せそう
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$ ls -l mach-types*
-rw-r--r-- 1 yasunari yamasita 46847 Mar  1 09:32 mach-types
-rw-r--r-- 1 yasunari yamasita 46847 Mar  1 09:32 mach-types.orig
-rw-r--r-- 1 yasunari yamasita   302 Mar  4 21:34 mach-types.rej
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/tools$ cat mach-types.rej
--- arch/arm/tools/mach-types   2011-03-15 01:20:32.000000000 +0000
+++ arch/arm/tools/mach-types   2011-03-17 12:39:32.000000000 +0000
@@ -3316,3 +3316,4 @@
 t5388p                 MACH_T5388P             T5388P                  3336
 dingo                  MACH_DINGO              DINGO                   3337
 goflexhome             MACH_GOFLEXHOME         GOFLEXHOME              3338
+lsvl                   MACH_LSVL               LSVL                    527
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/tools$ vi mach-types
	:
	:
*** mach-types.orig     Thu Mar  1 09:32:49 2012
--- mach-types  Sun Mar  4 21:47:06 2012
***************
*** 118,123 ****
--- 118,124 ----
  omap_osk              MACH_OMAP_OSK           OMAP_OSK                515
  tosa                  MACH_TOSA               TOSA                    520
  avila                 MACH_AVILA              AVILA                   526
+ lsvl                  MACH_LSVL               LSVL                    527
  edb9302                       MACH_EDB9302            EDB9302                 538
  husky                 MACH_HUSKY              HUSKY                   543
  shepherd              MACH_SHEPHERD           SHEPHERD                545
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/tools$
これでいけるかな?

カーネルの設定

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
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
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
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
	:
	:
「General Setup」→「Initial RAM filesytem ..」に チェック。 多分要らない
「System Type」→「Marvell Kirkwood Implementations」→ 「Buffalo LS-VL Series.」にチェック
「File systems」→「XFS filesystem support」にチェック
「File systems」→「Partition Types」→ 「Advanced partition selection」にチェック + 同階層の「EFI GUID Partition support」にチェック
#
# 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
	:
	:
一時間弱待ち

プシュー
ゴクゴク
むはー

  CC      arch/arm/mach-kirkwood/t5325-setup.o
  CC      arch/arm/mach-kirkwood/lsvl-setup.o
arch/arm/mach-kirkwood/lsvl-setup.c:156: error: unknown field 'boot_params' specified in initializer
make[1]: *** [arch/arm/mach-kirkwood/lsvl-setup.o] Error 1
make: *** [arch/arm/mach-kirkwood] Error 2
yasunari@vl:/mnt/share/src/linux-3.2.9$
あちゃー。
こうなったら、手に負えんな。。。

ごそごそ

yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/mach-kirkwood$ mv lsvl-setup.c{,.orig}
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/mach-kirkwood$ cp lsvl-setup.c.orig lsvl-setup.c
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/mach-kirkwood$ diff -c lsvl-setup.c.orig lsvl-setup.c
*** lsvl-setup.c.orig   Sun Mar  4 21:34:05 2012
--- lsvl-setup.c        Sun Mar  4 22:13:45 2012
***************
*** 153,159 ****
  }

  MACHINE_START(LSVL, "Buffalo LS-VL Series")
!       .boot_params    = 0x00000100,
        .init_machine   = lsvl_init,
        .map_io         = kirkwood_map_io,
        .init_irq       = kirkwood_init_irq,
--- 153,159 ----
  }

  MACHINE_START(LSVL, "Buffalo LS-VL Series")
!       .atag_offset    = 0x100,
        .init_machine   = lsvl_init,
        .map_io         = kirkwood_map_io,
        .init_irq       = kirkwood_init_irq,
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/mach-kirkwood$
とりあえず、エラーが出たところを修正
yasunari@vl:/mnt/share/src/linux-3.2.9/arch/arm/mach-kirkwood$ popd
/mnt/share/src/linux-3.2.9
yasunari@vl:/mnt/share/src/linux-3.2.9$ make uImage
  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
  CHK     include/generated/compile.h
  CC      arch/arm/mach-kirkwood/lsvl-setup.o
  CC      arch/arm/mach-kirkwood/cpuidle.o
  LD      arch/arm/mach-kirkwood/built-in.o
とりあえず、コンパイルは通過。まぁ動かんやろけど、、、

ゴクゴク
むはー

  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-3.2.9-20120304
Created:      Mon Mar  5 00:16:16 2012
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2802240 Bytes = 2736.56 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$
続いてカーネルモジュール
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
	:
	:
  CC      drivers/usb/class/usblp.mod.o
  LD [M]  drivers/usb/class/usblp.ko
  CC      fs/isofs/isofs.mod.o
  LD [M]  fs/isofs/isofs.ko
  CC      fs/udf/udf.mod.o
  LD [M]  fs/udf/udf.ko
  CC      lib/crc-itu-t.mod.o
  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$
できた。

インストール

uImage を /boot に置く
root@vl:~# cd /mnt/share/src/linux-3.2.9
root@vl:/mnt/share/src/linux-3.2.9# rm /boot/uImage.buffalo
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#
カーネルモジュールもインストール
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-20120304
root@vl:/mnt/share/src/linux-3.2.9#

リブート

root@vl:/mnt/share/src/linux-3.2.9# shutdown -h now
って、落ちひんやん

電源 SW を OFF にして、

root@vl:~# reboot
異音を発しながら、リブートを繰り返す LinkStation が出来上がった(楽

LS-VL

楽天市場
Amazon


カーネルのコンパイル(2)2.6.38
ハックの記録
LinkStation/玄箱 をハックしよう

カーネルのコンパイル(4)起動しない 3.2.9 からの復旧

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