カーネルのコンパイル

Debian LS-VL

Debian でのサーバ構成が一息着いたので、、

次は LS-VL のカーネルのコンパイル。
これまで、カーネルには手をつけずにいたのだが、 ある理由(内緒:笑)で標準カーネルにはない機能を 使いたくなった。
まずは、先人に準じ 猫のクマさんの手順を検証する。

gcc 4.2 のインストール

4.2 が要るの?

現在インストールされているのは?

root@vl:~# dpkg -l | grep gcc
ii  gcc-4.4-base                    4.4.5-8                      The GNU Compiler Collection (base package)
ii  libgcc1                         1:4.4.5-8                    GCC support library
root@vl:~#
4.4

4.2 は、ある?

root@vl:~# apt-cache search gcc | grep gcc
colorgcc - Colorizer for GCC warning/error messages
gcc-4.1-base - The GNU Compiler Collection (base package)
gcc-4.1-locales - The GNU C compiler (native language support files)
gcc-4.1-source - Source of the GNU Compiler Collection
gcc-4.1 - The GNU C compiler
gcc-4.3-base - The GNU Compiler Collection (base package)
gcc-4.3-locales - The GNU C compiler (native language support files)
gcc-4.3-source - Source of the GNU Compiler Collection
gcc-4.3 - The GNU C compiler
gcc-4.4-base - The GNU Compiler Collection (base package)
gcc-4.4-locales - The GNU C compiler (native language support files)
gcc-4.4-source - Source of the GNU Compiler Collection
gcc-4.4 - The GNU C compiler
libgcc1-dbg - GCC support library (debug symbols)
libgcc1 - GCC support library
gcc-avr - The GNU C compiler (cross compiler for avr)
gcc - The GNU C compiler
gcc-h8300-hms - The GNU C compiler (cross compiler for h8300-hitachi-coff)
gcc-m68hc1x - GNU C compiler for the Motorola 68HC11/12 processors
gcc-mingw32 - The GNU Compiler Collection (cross compiler for MingW32 / MingW64)
gccxml - XML output extension to GCC
python-pygccxml - specialized XML reader reads the output from gccxml
root@vl:~#
4.1, 4.3 はあるのに、4.2 だけはない。

4.2 は何が違う?とりあえず、4.4 のままで強行

ソースの取得

しっかしまぁ、Buffalo の ダウンロードのページの一番下、 「ソースコードダウンロードサービス」の●にリンクされているのは 「製品写真データダウンロードサービス」という トラップは何とかならないものか(笑

愚痴はさておき、、、

yasunari@vl:/mnt/share/src$ wget http://buffalo.jp/php/los.php?to=gpl/storage/ls-x/140/linux-2.6.31.8.tar.bz2
--2012-03-03 08:54:02--  http://buffalo.jp/php/los.php?to=gpl/storage/ls-x/140/linux-2.6.31.8.tar.bz2
Resolving buffalo.jp... 202.51.11.200
Connecting to buffalo.jp|202.51.11.200|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://driver.opensource.buffalo.jp/buf-odrv/gpl/storage/ls-x/140/linux-2.6.31.8.tar.bz2 [following]
--2012-03-03 08:54:02--  http://driver.opensource.buffalo.jp/buf-odrv/gpl/storage/ls-x/140/linux-2.6.31.8.tar.bz2
Resolving driver.opensource.buffalo.jp... 61.125.141.31
Connecting to driver.opensource.buffalo.jp|61.125.141.31|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 96212737 (92M) [application/octet-stream]
Saving to: `los.php?to=gpl%2Fstorage%2Fls-x%2F140%2Flinux-2.6.31.8.tar.bz2'

100%[======================================>] 96,212,737  10.7M/s   in 8.7s

2012-03-03 08:54:11 (10.6 MB/s) - `los.php?to=gpl%2Fstorage%2Fls-x%2F140%2Flinux-2.6.31.8.tar.bz2' saved [96212737/96212737]

yasunari@vl:/mnt/share/src$ ls -l
total 93960
-rw-r--r-- 1 yasunari yamasita 96212737 Jan 21  2011 los.php?to=gpl%2Fstorage%2Fls-x%2F140%2Flinux-2.6.31.8.tar.bz2
yasunari@vl:/mnt/share/src$
ふげー。
yasunari@vl:/mnt/share/src$ mv los.php\?to\=gpl%2Fstorage%2Fls-x%2F140%2Flinux-2.6.31.8.tar.bz2 linux-2.6.31.8.tar.bz2
yasunari@vl:/mnt/share/src$ ls -l
total 93960
-rw-r--r-- 1 yasunari yamasita 96212737 Jan 21  2011 linux-2.6.31.8.tar.bz2
yasunari@vl:/mnt/share/src$

ソースの展開

yasunari@vl:/mnt/share/src$ tar jxvf linux-2.6.31.8.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
yasunari@vl:/mnt/share/src$
bzip2 もインストールしとらんのか、、、
yasunari@vl:/mnt/share/src$ su - root
Password:
root@vl:~# apt-get install bzip2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  bzip2-doc
The following NEW packages will be installed:
  bzip2
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 50.0 kB of archives.
After this operation, 160 kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org/debian/ squeeze/main bzip2 armel 1.0.5-6+squeeze1 [50.0 kB]
Fetched 50.0 kB in 0s (101 kB/s)
Selecting previously deselected package bzip2.
(Reading database ... 11200 files and directories currently installed.)
Unpacking bzip2 (from .../bzip2_1.0.5-6+squeeze1_armel.deb) ...
Processing triggers for man-db ...
Setting up bzip2 (1.0.5-6+squeeze1) ...
!root@vl:~# exit
logout
yasunari@vl:/mnt/share/src$
今度こそ、、、
yasunari@vl:/mnt/share/src$ tar jxvf linux-2.6.31.8.tar.bz2
linux-2.6.31.8/
linux-2.6.31.8/kernel/
linux-2.6.31.8/kernel/dma.c
linux-2.6.31.8/kernel/smp.c
linux-2.6.31.8/kernel/ns_cgroup.c
	:
	:
linux-2.6.31.8/drivers/idle/Makefile
linux-2.6.31.8/.config.old
linux-2.6.31.8/.config
yasunari@vl:/mnt/share/src$
やぁ、、、カーネルソースなんて久しぶり。
.config もある。

Makefile の修正

猫のクマさんの手順に従う
yasunari@vl:/mnt/share/src$ cd linux-2.6.31.8
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ mv Makefile{,.orig}
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ cp Makefile.orig Makefile
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ vi Makefile
	:
	:
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ diff -c Makefile.orig Makefile
*** Makefile.orig       Tue Mar 30 01:38:28 2010
--- Makefile    Sat Mar  3 09:03:58 2012
***************
*** 181,187 ****
  # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
  export KBUILD_BUILDHOST := $(SUBARCH)
  ARCH          ?= arm
! CROSS_COMPILE ?= arm-mv5sft-linux-gnueabi-

  # Architecture as present in compile.h
  UTS_MACHINE   := $(ARCH)
--- 181,187 ----
  # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
  export KBUILD_BUILDHOST := $(SUBARCH)
  ARCH          ?= arm
! CROSS_COMPILE ?=

  # Architecture as present in compile.h
  UTS_MACHINE   := $(ARCH)
yasunari@vl:/mnt/share/src/linux-2.6.31.8$

カーネルのコンフィギュレーション

yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make oldconfig
-bash: make: command not found
yasunari@vl:/mnt/share/src/linux-2.6.31.8$
げほげほ。
make libc6-dev をインストールする。
root@vl:~# apt-get install make libc6-dev
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 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
The following NEW packages will be installed:
  binutils cpp cpp-4.4 gcc gcc-4.4 libc-dev-bin libc6-dev libgmp3c2 libgomp1
  libmpfr4 linux-libc-dev make manpages-dev
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.4 MB of archives.
After this operation, 39.0 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org/debian/ squeeze/main binutils armel 2.20.1-16 [3093 kB]
Get:2 http://ftp.jp.debian.org/debian/ squeeze/main libgmp3c2 armel 2:4.3.2+dfsg-1 [251 kB]
Get:3 http://ftp.jp.debian.org/debian/ squeeze/main libmpfr4 armel 3.0.0-2 [467 kB]
Get:4 http://ftp.jp.debian.org/debian/ squeeze/main cpp-4.4 armel 4.4.5-8 [3427 kB]
Get:5 http://ftp.jp.debian.org/debian/ squeeze/main cpp armel 4:4.4.5-1 [15.0 kB]
Get:6 http://ftp.jp.debian.org/debian/ squeeze/main libgomp1 armel 4.4.5-8 [26.4 kB]
Get:7 http://ftp.jp.debian.org/debian/ squeeze/main gcc-4.4 armel 4.4.5-8 [534 kB]
Get:8 http://ftp.jp.debian.org/debian/ squeeze/main gcc armel 4:4.4.5-1 [4984 B]
Get:9 http://ftp.jp.debian.org/debian/ squeeze/main libc-dev-bin armel 2.11.3-2 [206 kB]
Get:10 http://ftp.jp.debian.org/debian/ squeeze/main linux-libc-dev armel 2.6.32-41 [830 kB]
Get:11 http://ftp.jp.debian.org/debian/ squeeze/main libc6-dev armel 2.11.3-2 [2516 kB]
Get:12 http://ftp.jp.debian.org/debian/ squeeze/main make armel 3.81-8 [393 kB]
Get:13 http://ftp.jp.debian.org/debian/ squeeze/main manpages-dev all 3.27-1 [1639 kB]
Fetched 13.4 MB in 1s (6707 kB/s)
Selecting previously deselected package binutils.
(Reading database ... 11228 files and directories currently installed.)
Unpacking binutils (from .../binutils_2.20.1-16_armel.deb) ...
Selecting previously deselected package libgmp3c2.
Unpacking libgmp3c2 (from .../libgmp3c2_2%3a4.3.2+dfsg-1_armel.deb) ...
Selecting previously deselected package libmpfr4.
Unpacking libmpfr4 (from .../libmpfr4_3.0.0-2_armel.deb) ...
Selecting previously deselected package cpp-4.4.
Unpacking cpp-4.4 (from .../cpp-4.4_4.4.5-8_armel.deb) ...
Selecting previously deselected package cpp.
Unpacking cpp (from .../cpp_4%3a4.4.5-1_armel.deb) ...
Selecting previously deselected package libgomp1.
Unpacking libgomp1 (from .../libgomp1_4.4.5-8_armel.deb) ...
Selecting previously deselected package gcc-4.4.
Unpacking gcc-4.4 (from .../gcc-4.4_4.4.5-8_armel.deb) ...
Selecting previously deselected package gcc.
Unpacking gcc (from .../gcc_4%3a4.4.5-1_armel.deb) ...
Selecting previously deselected package libc-dev-bin.
Unpacking libc-dev-bin (from .../libc-dev-bin_2.11.3-2_armel.deb) ...
Selecting previously deselected package linux-libc-dev.
Unpacking linux-libc-dev (from .../linux-libc-dev_2.6.32-41_armel.deb) ...
Selecting previously deselected package libc6-dev.
Unpacking libc6-dev (from .../libc6-dev_2.11.3-2_armel.deb) ...
Selecting previously deselected package make.
Unpacking make (from .../archives/make_3.81-8_armel.deb) ...
Selecting previously deselected package manpages-dev.
Unpacking manpages-dev (from .../manpages-dev_3.27-1_all.deb) ...
Processing triggers for man-db ...
!Setting up binutils (2.20.1-16) ...
Setting up libgmp3c2 (2:4.3.2+dfsg-1) ...
Setting up libmpfr4 (3.0.0-2) ...
Setting up cpp-4.4 (4.4.5-8) ...
Setting up cpp (4:4.4.5-1) ...
Setting up libgomp1 (4.4.5-8) ...
Setting up gcc-4.4 (4.4.5-8) ...
Setting up gcc (4:4.4.5-1) ...
Setting up libc-dev-bin (2.11.3-2) ...
Setting up linux-libc-dev (2.6.32-41) ...
Setting up libc6-dev (2.11.3-2) ...
Setting up make (3.81-8) ...
Setting up manpages-dev (3.27-1) ...
!root@vl:~# exit
logout
yasunari@vl:/mnt/share/src/linux-2.6.31.8$
気を取りなおして再実行。
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make oldconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/basic/hash
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -o arch/arm/Kconfig
#
# configuration written to .config
#
yasunari@vl:/mnt/share/src/linux-2.6.31.8$
tun.ko はいらないので、menuconfig は要らないが、 Local version は付けておく
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make menuconfig
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2
yasunari@vl:/mnt/share/src/linux-2.6.31.8$
ゲホゲホ
root@vl:~# apt-cache search ncurses | grep ncurses
abook - text-based ncurses address book application
audtty - ncurses based frontend to audacious
avida-viewer - ncurses viewer for avida
aylet - ncurses-based player for Spectrum '.ay' music files
bochs-term - Terminal (ncurses-based) plugin for Bochs
btscanner - ncurses-based scanner for Bluetooth devices
canto - flexible ncurses Atom/RSS newsreader for the console
clex - command line file manager which uses the ncurses library
cmus-plugin-ffmpeg - lightweight ncurses audio player (FFmpeg plugin)
cmus - lightweight ncurses audio player
libcunit1-ncurses-dev - Unit Testing Library for C (ncurses) -- development files
libcunit1-ncurses - Unit Testing Library for C (ncurses)
dares - rescue files from damaged CDs and DVDs (ncurses-interface)
dav-text - A minimalist ncurses-based text editor
libncurses-gst - Ncurses bindings for GNU Smalltalk
gom - Command line and interactive ncurses-based OSS audio mixer
gtypist - A simple ncurses touch typing tutor
libghc6-hscurses-dev - ncurses bindings for Haskell - development files for GHC6
libghc6-hscurses-doc - ncurses bindings for Haskell - documentation
libghc6-hscurses-prof - ncurses bindings for Haskell - profiling files for GHC6
hexcurse - A ncurses-based hex editor with many features
irmp3-ncurses - irmp3 control frontend
libkaya-ncurses-dev - Ncurses binding for kaya
libkaya-ncursesw-dev - Ncurses binding for kaya
moc-ffmpeg-plugin - ncurses based console audio player - ffmpeg plugin
moc - ncurses based console audio player
mtr-tiny - Full screen ncurses traceroute tool
mtr - Full screen ncurses and X11 traceroute tool
ncdu - ncurses disk usage viewer
ncmpc-lyrics - ncurses-based audio player (lyrics plugins)
ncmpc - ncurses-based audio player
ncmpcpp - ncurses-based client for the Music Player Daemon (MPD)
ncurses-hexedit - Edit files/disks in hex, ASCII and EBCDIC
libncurses-ruby1.8 - ruby Extension for the ncurses C library
libncurses-ruby1.9.1 - ruby Extension for the ncurses C library
libncurses-ruby - ruby Extension for the ncurses C library
libncurses5-dbg - debugging/profiling libraries for ncurses
libncurses5-dev - developer's libraries and docs for ncurses
libncurses5 - shared libraries for terminal handling
libncursesw5-dbg - debugging/profiling libraries for ncurses
libncursesw5-dev - developer's libraries for ncursesw
libncursesw5 - shared libraries for terminal handling (wide character support)
ncurses-base - basic terminal type definitions
ncurses-bin - terminal-related programs and man pages
ncurses-term - additional terminal type definitions
ninvaders - A space invaders-like game using ncurses
nrss - A ncurses-based RSS reader
libcurses-ocaml-dev - OCaml bindings for the ncurses library
libcurses-ocaml - OCaml bindings for the ncurses library
rexima - a simple ncurses/command-line mixer
rtorrent - ncurses BitTorrent client based on LibTorrent from rakshasa
tcd - Portable CD player with an ncurses interface
tig - ncurses-based Git repository browser
vifm - a ncurses based file manager with vi like keybindings
radio - ncurses-based radio application
root@vl:~#
libncurses5-dev をインストールすれば良い?
root@vl:~# apt-get install libncurses5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libncurses5-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1607 kB of archives.
After this operation, 6738 kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org/debian/ squeeze/main libncurses5-dev armel 5.7+20100313-5 [1607 kB]
Fetched 1607 kB in 0s (3522 kB/s)
Selecting previously deselected package libncurses5-dev.
(Reading database ... 14442 files and directories currently installed.)
Unpacking libncurses5-dev (from .../libncurses5-dev_5.7+20100313-5_armel.deb) ...
Processing triggers for man-db ...
Setting up libncurses5-dev (5.7+20100313-5) ...
!root@vl:~# exit
logout
yasunari@vl:/mnt/share/src/linux-2.6.31.8$
いい加減、sudo 使えよな。

再実行

yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make menuconfig
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
	:
	:
 .config - Linux Kernel v2.6.31.8 Configuration
 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
  lqqqqqqqqqqqqqqqqqqqqqq Linux Kernel Configuration qqqqqqqqqqqqqqqqqqqqqqqk
  x  Arrow keys navigate the menu.  <Enter> selects submenus --->.          x
  x  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, x
  x  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> x
  x  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x        General setup  --->                                          x x
  x x    [*] Enable loadable module support  --->                         x x
  x x    -*- Enable the block layer  --->                                 x x
  x x        System Type  --->                                            x x
  x x        Bus support  --->                                            x x
  x x        Kernel Features  --->                                        x x
  x x        Boot options  --->                                           x x
  x x        CPU Power Management  --->                                   x x
  x x        Floating point emulation  --->                               x x
  x x        Userspace binary formats  --->                               x x
  x x        Power management options  --->                               x x
  x x    [*] Networking support  --->                                     x x
  x x        Device Drivers  --->                                         x x
  x x        File systems  --->                                           x x
  x x        Kernel hacking  --->                                         x x
  x x        Security options  --->                                       x x
  x x    -*- Cryptographic API  --->                                      x x
  x x        Library routines  --->                                       x x
  x x    ---                                                              x x
  x x        Load an Alternate Configuration File                         x x
  x x        Save an Alternate Configuration File                         x x
  x x                                                                     x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
  x                    <Select>    < Exit >    < Help >                     x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
きたー。
猫のクマさんの手順に従い、Local version を付ける
 .config - Linux Kernel v2.6.31.8 Configuration
 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq


  lqqqqqqqqqqqqqqq Local version - append to kernel release qqqqqqqqqqqqqqqqk
  x  Please enter a string value. Use the <TAB> key to move from the input  x
  x  field to the buttons below it.                                         x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x-20120303-01                                                         x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
  x                                                                         x
  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
  x                         <  Ok  >      < Help >                          x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj



menuconfig を終わる
#
# configuration written to .config
#


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

yasunari@vl:/mnt/share/src/linux-2.6.31.8$ grep 2012 .config
# Sat Mar  3 09:25:24 2012
CONFIG_LOCALVERSION="-20120303-01"
yasunari@vl:/mnt/share/src/linux-2.6.31.8$

カーネルのコンパイル

yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make dep
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/arm/Kconfig
*** Warning: make dep is unnecessary now.
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make uImage
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  Generating include/asm-arm/mach-types.h
  CHK     include/linux/utsrelease.h
  UPD     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-arm
	:
	:
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
"mkimage" command not found - U-Boot images will not be built
  Image arch/arm/boot/uImage is ready
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ ls arch/arm/boot/
Image  Makefile  bootp  compressed  install.sh  zImage
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ ls arch/arm/boot/uImage
ls: cannot access arch/arm/boot/uImage: No such file or directory
yasunari@vl:/mnt/share/src/linux-2.6.31.8$
「Image arch/arm/boot/uImage is ready」って、嘘ばっかりやん

mkimage のインストール

どっちにしろこのあといるので、インストール
root@vl:~# apt-cache search mkimage
jigit - tools for working with jigdo files
uboot-mkimage - generate kernel image for U-Boot
root@vl:~# apt-get install uboot-mkimage
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  uboot-mkimage
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 11.4 kB of archives.
After this operation, 57.3 kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org/debian/ squeeze/main uboot-mkimage armel 0.4 [11.4 kB]
Fetched 11.4 kB in 0s (30.4 kB/s)
Selecting previously deselected package uboot-mkimage.
(Reading database ... 15495 files and directories currently installed.)
Unpacking uboot-mkimage (from .../uboot-mkimage_0.4_armel.deb) ...
Setting up uboot-mkimage (0.4) ...
!root@vl:~# exit
logout
yasunari@vl:/mnt/share/src/linux-2.6.31.8$

やり直し

yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make uImage
  CHK     include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-arm
  CALL    scripts/checksyscalls.sh
:1351:2: warning: #warning syscall migrate_pages not implemented
:1407:2: warning: #warning syscall pselect6 not implemented
:1411:2: warning: #warning syscall ppoll not implemented
:1451:2: warning: #warning syscall epoll_pwait not implemented
  CHK     include/linux/compile.h
  CC      arch/arm/mach-feroceon-kw/../plat-feroceon/mv_hal/buffalo/buffalocore.o
  LD      arch/arm/mach-feroceon-kw/feroceon.o
  LD      arch/arm/mach-feroceon-kw/built-in.o
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
  KSYM    .tmp_kallsyms1.S
  AS      .tmp_kallsyms1.o
  LD      .tmp_vmlinux2
  KSYM    .tmp_kallsyms2.S
  AS      .tmp_kallsyms2.o
  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  GZIP    arch/arm/boot/compressed/piggy.gz
  AS      arch/arm/boot/compressed/piggy.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-2.6.31.8-20120303-01
Created:      Sat Mar  3 10:21:42 2012
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2734564 Bytes = 2670.47 kB = 2.61 MB
Load Address: 0x00008000
Entry Point:  0x00008000
  Image arch/arm/boot/uImage is ready
yasunari@vl:/mnt/share/src/linux-2.6.31.8$

モジュールのコンパイル

yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make modules
  CHK     include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-arm
  CALL    scripts/checksyscalls.sh
:1351:2: warning: #warning syscall migrate_pages not implemented
:1407:2: warning: #warning syscall pselect6 not implemented
:1411:2: warning: #warning syscall ppoll not implemented
:1451:2: warning: #warning syscall epoll_pwait not implemented
  CC [M]  fs/fat/cache.o
  CC [M]  fs/fat/dir.o
  CC [M]  fs/fat/fatent.o
	:
	:
  CC      net/xfrm/xfrm_ipcomp.mod.o
  LD [M]  net/xfrm/xfrm_ipcomp.ko
  CC      net/xfrm/xfrm_user.mod.o
  LD [M]  net/xfrm/xfrm_user.ko
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ make modules_install
  INSTALL crypto/authenc.ko
  INSTALL crypto/ecb.ko
  INSTALL crypto/pcbc.ko
  INSTALL drivers/char/hw_random/rng-core.ko
	:
	:
  INSTALL net/ipv4/xfrm4_mode_transport.ko
  INSTALL net/ipv4/xfrm4_tunnel.ko
  INSTALL net/xfrm/xfrm_ipcomp.ko
  INSTALL net/xfrm/xfrm_user.ko
  DEPMOD  2.6.31.8-20120303-01
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ ls binaries/lib/modules/2.6.31.8-20120303-01/
build          modules.alias.bin  modules.devname  modules.symbols
kernel         modules.dep        modules.order    modules.symbols.bin
modules.alias  modules.dep.bin    modules.softdep  source
yasunari@vl:/mnt/share/src/linux-2.6.31.8$

uImage のコピー

ここからは、root で
yasunari@vl:/mnt/share/src/linux-2.6.31.8$ su - root
Password:
root@vl:~# cd /mnt/share/src/linux-2.6.31.8
root@vl:/mnt/share/src/linux-2.6.31.8#
バックアップを取ってコピーする。
root@vl:/mnt/share/src/linux-2.6.31.8# ls -l /boot
total 13100
-rwxrwxrwx 1 root root 10648541 Nov 23 19:12 initrd.buffalo
drwx------ 2 root root    16384 Nov 23 19:10 lost+found
-rw-r--r-- 1 root root  2724508 Jun  1  2011 uImage.buffalo
root@vl:/mnt/share/src/linux-2.6.31.8# mv /boot/uImage.buffalo{,.orig}
root@vl:/mnt/share/src/linux-2.6.31.8# cp arch/arm/boot/uImage /boot/uImage.buffalo
root@vl:/mnt/share/src/linux-2.6.31.8# !ls
ls -l /boot
total 15776
-rwxrwxrwx 1 root root 10648541 Nov 23 19:12 initrd.buffalo
drwx------ 2 root root    16384 Nov 23 19:10 lost+found
-rw-r--r-- 1 root root  2734628 Mar  3 10:35 uImage.buffalo
-rw-r--r-- 1 root root  2724508 Jun  1  2011 uImage.buffalo.orig
root@vl:/mnt/share/src/linux-2.6.31.8#

カーネルモジュールのインストール

root@vl:/mnt/share/src/linux-2.6.31.8# ls binaries/lib/modules/2.6.31.8-20120303-01/
build          modules.alias.bin  modules.devname  modules.symbols
kernel         modules.dep        modules.order    modules.symbols.bin
modules.alias  modules.dep.bin    modules.softdep  source
root@vl:/mnt/share/src/linux-2.6.31.8# (cd binaries/; tar cf - lib/)|(cd /; tar xvf -)
lib/
lib/modules/
lib/modules/2.6.31.8-20120303-01/
lib/modules/2.6.31.8-20120303-01/kernel/
lib/modules/2.6.31.8-20120303-01/kernel/crypto/
lib/modules/2.6.31.8-20120303-01/kernel/crypto/authenc.ko
lib/modules/2.6.31.8-20120303-01/kernel/crypto/ecb.ko
lib/modules/2.6.31.8-20120303-01/kernel/crypto/pcbc.ko
lib/modules/2.6.31.8-20120303-01/kernel/drivers/
lib/modules/2.6.31.8-20120303-01/kernel/drivers/char/
	:
	:
lib/modules/2.6.31.8-20120303-01/modules.symbols
lib/modules/2.6.31.8-20120303-01/modules.symbols.bin
lib/modules/2.6.31.8-20120303-01/modules.devname
root@vl:/mnt/share/src/linux-2.6.31.8#
猫のクマさんの手順では、initrd にもコピーを実施。
root@vl:/mnt/share/src/linux-2.6.31.8# mv /boot/initrd.buffalo{,.orig}
root@vl:/mnt/share/src/linux-2.6.31.8# dd if=/boot/initrd.buffalo.orig of=./initrd.gz bs=64 skip=1
166382+1 records in
166382+1 records out
10648477 bytes (11 MB) copied, 1.36686 s, 7.8 MB/s
root@vl:/mnt/share/src/linux-2.6.31.8# gunzip initrd.gz
root@vl:/mnt/share/src/linux-2.6.31.8# mkdir /tmp/root
root@vl:/mnt/share/src/linux-2.6.31.8# mount -o loop initrd /tmp/root
root@vl:/mnt/share/src/linux-2.6.31.8# (cd binaries/; tar cf - lib)|(cd /tmp/root; tar xvf -)
lib/
lib/modules/
lib/modules/2.6.31.8-20120303-01/
lib/modules/2.6.31.8-20120303-01/kernel/
lib/modules/2.6.31.8-20120303-01/kernel/crypto/
lib/modules/2.6.31.8-20120303-01/kernel/crypto/authenc.ko
	:
	:
lib/modules/2.6.31.8-20120303-01/modules.softdep
lib/modules/2.6.31.8-20120303-01/modules.symbols
lib/modules/2.6.31.8-20120303-01/modules.symbols.bin
lib/modules/2.6.31.8-20120303-01/modules.devname
root@vl:/mnt/share/src/linux-2.6.31.8# umount /tmp/root
root@vl:/mnt/share/src/linux-2.6.31.8# gzip initrd
root@vl:/mnt/share/src/linux-2.6.31.8# mkimage -A ARM -O Linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initrd -d initrd.gz /boot/initrd.buffalo
Image Name:   initrd
Created:      Sat Mar  3 10:48:22 2012
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    11564379 Bytes = 11293.34 kB = 11.03 MB
Load Address: 0x00000000
Entry Point:  0x00000000
root@vl:/mnt/share/src/linux-2.6.31.8# ls -l /boot
total 27088
-rw-r--r-- 1 root root 11564443 Mar  3 10:48 initrd.buffalo
-rwxrwxrwx 1 root root 10648541 Nov 23 19:12 initrd.buffalo.orig
drwx------ 2 root root    16384 Nov 23 19:10 lost+found
-rw-r--r-- 1 root root  2734628 Mar  3 10:35 uImage.buffalo
-rw-r--r-- 1 root root  2724508 Jun  1  2011 uImage.buffalo.orig
root@vl:/mnt/share/src/linux-2.6.31.8#
さて、できたかな。

再起動

root@vl:/mnt/share/src/linux-2.6.31.8# shutdown -r now
じっと待つ。LED の青点滅が長い。。。

点灯!

telnetして確認


Linux 2.6.31.8-20120303-01 (x60l.yamasita.jp) (pts/0)

vl login: yasunari
Password:
Last login: Sat Mar  3 09:30:49 JST 2012 from x60l.yamasita.jp on pts/2
Linux vl 2.6.31.8-20120303-01 #2 Sat Mar 3 10:21:23 JST 2012 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
yasunari@vl:~$ uname -a
Linux vl 2.6.31.8-20120303-01 #2 Sat Mar 3 10:21:23 JST 2012 armv5tel GNU/Linux
yasunari@vl:~$
できた!

猫のクマさん、有益な情報を有難うございます!!



LS-VL

楽天市場
Amazon


ssh サーバのインストール
ハックの記録
LinkStation/玄箱 をハックしよう

カーネルのコンパイル(2)2.6.38

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