デスクトップとして使う(1)再度カーネル 2.6.31.8 コンパイル環境の準備

Debian LS-VL

というわけで、もう一度 カーネル 2.6.31.8 コンパイル環境を作る

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

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

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
(略)

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

root@vl:~# mkdir /mnt/src
root@vl:~# ln -s /mnt/src /usr/
ln: creating symbolic link `/usr/src': File exists
root@vl:~# ls /usr/src/
root@vl:~# ls -al /usr/src/
total 0
drwxr-xr-x  2 root root  6 Nov 13  2010 .
drwxr-xr-x 10 root root 97 Jan  3  2011 ..
root@vl:~# mv /usr/src{,.orig}
root@vl:~# !ln
ln -s /mnt/src /usr/
root@vl:~# chgrp yamasita /mnt/src
root@vl:~# chmod g+w /mnt/src
root@vl:~# ls -ld /mnt/src/
drwxrwxr-x 3 root yamasita 56 Mar 10 00:26 /mnt/src/
root@vl:~# exit
logout
yasunari@vl:~$ cd /mnt/src/
yasunari@vl:/mnt/src$ wget http://buffalo.jp/php/los.php?to=gpl/storage/ls-x/140/linux-2.6.31.8.tar.bz2
--2012-03-10 07:50:36--  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-10 07:50:36--  http://driver.opensource.buffalo.jp/buf-odrv/gpl/storage/ls-x/140/linux-2.6.31.8.tar.bz2
Resolving driver.opensource.buffalo.jp... 125.29.36.141
Connecting to driver.opensource.buffalo.jp|125.29.36.141|: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-10 07:50:47 (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/src$ ls
los.php?to=gpl%2Fstorage%2Fls-x%2F140%2Flinux-2.6.31.8.tar.bz2
yasunari@vl:/mnt/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/src$ ls
linux-2.6.31.8.tar.bz2
yasunari@vl:/mnt/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/drivers/idle/i7300_idle.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/src$ 

Makefile の修正

yasunari@vl:/mnt/src$ cd linux-2.6.31.8
yasunari@vl:/mnt/src/linux-2.6.31.8$ mv Makefile{,.orig}
yasunari@vl:/mnt/src/linux-2.6.31.8$ cp Makefile.orig Makefile
yasunari@vl:/mnt/src/linux-2.6.31.8$ vi Makefile
yasunari@vl:/mnt/src/linux-2.6.31.8$
	:
	:
yasunari@vl:/mnt/src/linux-2.6.31.8$ !cp:s/cp/diff -u/
diff -u Makefile.orig Makefile
--- Makefile.orig       2010-03-30 01:38:28.000000000 +0900
+++ Makefile    2012-03-10 07:59:21.898946482 +0900
@@ -181,7 +181,7 @@
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 export KBUILD_BUILDHOST := $(SUBARCH)
 ARCH           ?= arm
-CROSS_COMPILE  ?= arm-mv5sft-linux-gnueabi-
+CROSS_COMPILE  ?=

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

コンパイル

yasunari@vl:/mnt/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/src/linux-2.6.31.8$
.config をちょっと取っておく
yasunari@vl:/mnt/src/linux-2.6.31.8$ cp .config .config_120310
yasunari@vl:/mnt/src/linux-2.6.31.8$
変更はしないが、menuconfig
yasunari@vl:/mnt/src/linux-2.6.31.8$ 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
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf arch/arm/Kconfig


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

yasunari@vl:/mnt/src/linux-2.6.31.8$
Exit しただけ
yasunari@vl:/mnt/src/linux-2.6.31.8$ diff -c .config_120310 .config
yasunari@vl:/mnt/src/linux-2.6.31.8$
make する
yasunari@vl:/mnt/src/linux-2.6.31.8$ make dep
scripts/kconfig/conf -s arch/arm/Kconfig
*** Warning: make dep is unnecessary now.
yasunari@vl:/mnt/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
	:
	:
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-2.6.31.8
Created:      Sat Mar 10 08:52:54 2012
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2734512 Bytes = 2670.42 kB = 2.61 MB
Load Address: 0x00008000
Entry Point:  0x00008000
  Image arch/arm/boot/uImage is ready
yasunari@vl:/mnt/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
<stdin>:1351:2: warning: #warning sysc
	:
	:
  CC      net/ipv4/xfrm4_mode_transport.mod.o
  LD [M]  net/ipv4/xfrm4_mode_transport.ko
  CC      net/ipv4/xfrm4_tunnel.mod.o
  LD [M]  net/ipv4/xfrm4_tunnel.ko
  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/src/linux-2.6.31.8$
インストールする
yasunari@vl:/mnt/src/linux-2.6.31.8$ su root
Password:
root@vl:/mnt/src/linux-2.6.31.8# pushd /lib/modules/
/lib/modules /mnt/src/linux-2.6.31.8
root@vl:/lib/modules# ls
2.6.31.8
root@vl:/lib/modules# mv 2.6.31.8 2.6.31.8.orig
root@vl:/lib/modules# popd
/mnt/src/linux-2.6.31.8
root@vl:/mnt/src/linux-2.6.31.8# pushd binaries/lib/modules/
/mnt/src/linux-2.6.31.8/binaries/lib/modules /mnt/src/linux-2.6.31.8
root@vl:/mnt/src/linux-2.6.31.8/binaries/lib/modules# ls
2.6.31.8
root@vl:/mnt/src/linux-2.6.31.8/binaries/lib/modules# tar cf - 2.6.31.8/|(cd /lib/modules/; tar xvf -)
2.6.31.8/
2.6.31.8/kernel/
2.6.31.8/kernel/crypto/
2.6.31.8/kernel/crypto/authenc.ko
	:
	:
root@vl:/mnt/src/linux-2.6.31.8/binaries/lib/modules# popd
/mnt/src/linux-2.6.31.8
root@vl:/mnt/src/linux-2.6.31.8# pushd /boot
/boot /mnt/src/linux-2.6.31.8
root@vl:/boot# pushd /boot
/boot /boot /mnt/src/linux-2.6.31.8
root@vl:/boot# ls -al
total 13108
drwxr-xr-x  3 root root     4096 Mar  9 22:06 .
drwxr-xr-x 21 root root     4096 Jan  3  2011 ..
-rwxrwxrwx  1 root root 10648542 Mar  9 22:06 initrd.buffalo
drwx------  2 root root    16384 Mar  9 22:04 lost+found
-rw-r--r--  1 root root  2724508 Jun  1  2011 uImage.buffalo
root@vl:/boot# mv uImage.buffalo uImage.buffalo.orig
root@vl:/boot# popd
/boot /mnt/src/linux-2.6.31.8
root@vl:/boot# popd
/mnt/src/linux-2.6.31.8
root@vl:/mnt/src/linux-2.6.31.8# cp arch/arm/boot/uImage /boot/uImage.buffalo
root@vl:/mnt/src/linux-2.6.31.8#

リブート

root@vl:/mnt/src/linux-2.6.31.8# reboot
LED が青点灯になった時点で、telnet
Linux 2.6.31.8 (x60l.yamasita.jp) (pts/0)

vl login: yasunari
Password:
Last login: Sat Mar 10 07:49:16 JST 2012 from x60l.yamasita.jp on pts/0
Linux vl 2.6.31.8 #1 Sat Mar 10 08:52:31 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 #1 Sat Mar 10 08:52:31 JST 2012 armv5tel GNU/Linux
yasunari@vl:~$
ようやく開始点に到達

LS-VL

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


次の目標
ハックの記録
LinkStation/玄箱 をハックしよう

デスクトップとして使う(2)udlfb モジュールのコンパイル

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