カーネルソースの準備

SheevaPlug

Buffalo WLI-UC-GNP 用のドライバを コンパイルしようとしていて、カーネルソースが必要になった。
さて、何処まで準備が必要なのか?

とりあえず(?) http://sheeva.with-linux.com/sheeva/2.6.33.2/source/ の 全ファイルをダウンロード

root@debian:~/kernel/source# ls
UdlFb-0.2.3-2.6.30.2.patch          linux-2.6.32-sheeva-sata.patch  mvsdio-1-2.6.30.patch
linux-2.6.29-usb-serial-evdo.patch  linux-2.6.33.2.tar.bz2          mvsdio-2.patch
root@debian:~/kernel/source#
順に展開する。

linux-2.6.33.2.tar.bz2

root@debian:~/kernel/source# tar jxvf linux-2.6.33.2.tar.bz2
	:
	:

UdlFb-0.2.3-2.6.30.2.patch

root@debian:~/kernel/source# head UdlFb-0.2.3-2.6.30.2.patch
--- ./drivers/video/Kconfig.orig        2009-07-19 21:39:19.000000000 -0600
+++ ./drivers/video/Kconfig     2009-07-22 19:26:18.037723981 -0600
@@ -2074,6 +2074,13 @@ config FB_METRONOME
          controller. The pre-release name for this device was 8track
          and could also have been called by some vendors as PVI-nnnn.

+config FB_UDLFB
+       tristate "UDLFB support"
+       depends on FB
+       select FB_CFB_IMAGEBLIT
root@debian:~/kernel/source# cd linux-2.6.33.2
root@debian:~/kernel/source/linux-2.6.33.2# patch -p < ../UdlFb-0.2.3-2.6.30.2.patch
-bash: patch: command not found
root@debian:~/kernel/source/linux-2.6.33.2#

patch のインストール

root@debian:~/kernel/source/linux-2.6.33.2# apt-cache search patch
	:
	:
patch - Apply a diff file to an original
	:
	:
root@debian:~/kernel/source/linux-2.6.33.2# apt-get install patch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libtalloc1 libcap2 logrotate libcups2 update-inetd libwbclient0 ucf samba-common
Use 'apt-get autoremove' to remove them.
Suggested packages:
  ed diff-doc
The following NEW packages will be installed:
  patch
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 105kB of archives.
After this operation, 217kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com jaunty/main patch 2.5.9-5 [105kB]
Fetched 105kB in 1s (58.9kB/s)
Selecting previously deselected package patch.
(Reading database ... 15683 files and directories currently installed.)
Unpacking patch (from .../patch_2.5.9-5_armel.deb) ...
Processing triggers for man-db ...
Setting up patch (2.5.9-5) ...
root@debian:~/kernel/source/linux-2.6.33.2#

UdlFb-0.2.3-2.6.30.2.patch(再)

root@debian:~/kernel/source/linux-2.6.33.2# !patch
patch -p < ../UdlFb-0.2.3-2.6.30.2.patch
patch: option requires an argument -- 'p'
patch: Try `patch --help' for more information.
root@debian:~/kernel/source/linux-2.6.33.2# patch -p1 < ../UdlFb-0.2.3-2.6.30.2.patch
patching file drivers/video/Kconfig
Hunk #1 succeeded at 2113 (offset 39 lines).
patching file drivers/video/Makefile
Hunk #1 succeeded at 128 with fuzz 2 (offset 4 lines).
patching file drivers/video/udlfb/Makefile
patching file drivers/video/udlfb/udlfb.c
patching file drivers/video/udlfb/udlfb.h
root@debian:~/kernel/source/linux-2.6.33.2#
いけたかな?

linux-2.6.29-usb-serial-evdo.patch

root@debian:~/kernel/source/linux-2.6.33.2# head ../linux-2.6.29-usb-serial-evdo.patch
--- ./drivers/usb/serial/usb-serial.c.orig      2009-04-02 14:55:27.000000000 -0600
+++ ./drivers/usb/serial/usb-serial.c   2009-04-18 03:00:26.862440573 -0600
@@ -59,6 +59,9 @@ static struct usb_driver usb_serial_driv
    drivers depend on it.
 */

+static ushort maxRSize __read_mostly = 0;
+static ushort maxWSize __read_mostly = 0;
+static ushort maxISize __read_mostly = 0;
 static int debug;
root@debian:~/kernel/source/linux-2.6.33.2# patch -p1 < ../linux-2.6.29-usb-serial-evdo.patch
patching file drivers/usb/serial/usb-serial.c
Hunk #1 succeeded at 61 (offset 2 lines).
Hunk #2 succeeded at 918 (offset 74 lines).
Hunk #3 succeeded at 946 with fuzz 2 (offset 76 lines).
Hunk #4 succeeded at 974 (offset 76 lines).
Hunk #5 succeeded at 1007 (offset 76 lines).
Hunk #6 succeeded at 1367 (offset 87 lines).
root@debian:~/kernel/source/linux-2.6.33.2#

linux-2.6.32-sheeva-sata.patch

eSATA が使えるようになっている?
root@debian:~/kernel/source/linux-2.6.33.2# head ../linux-2.6.32-sheeva-sata.patch
--- ./arch/arm/mach-kirkwood/sheevaplug-setup.c.orig    2010-02-23 08:38:51.000000000 -0700
+++ ./arch/arm/mach-kirkwood/sheevaplug-setup.c 2010-03-02 12:17:26.190730237 -0700
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
root@debian:~/kernel/source/linux-2.6.33.2# patch -p1 < ../linux-2.6.32-sheeva-sata.patch
patching file arch/arm/mach-kirkwood/sheevaplug-setup.c
root@debian:~/kernel/source/linux-2.6.33.2#

mvsdio-1-2.6.30.patch

root@debian:~/kernel/source/linux-2.6.33.2# head ../mvsdio-1-2.6.30.patch
--- ./drivers/mmc/core/core.c.orig      2009-06-09 21:05:27.000000000 -0600
+++ ./drivers/mmc/core/core.c   2009-06-23 23:24:58.473855897 -0600
@@ -286,9 +286,9 @@ void mmc_set_data_timeout(struct mmc_dat
                         * The limit is really 250 ms, but that is
                         * insufficient for some crappy cards.
                         */
-                       limit_us = 300000;
+                       limit_us = 500000;
                else
-                       limit_us = 100000;
root@debian:~/kernel/source/linux-2.6.33.2# patch -p1 < ../mvsdio-1-2.6.30.patch
patching file drivers/mmc/core/core.c
Hunk #1 succeeded at 302 (offset 16 lines).
patching file drivers/mmc/host/mvsdio.c
root@debian:~/kernel/source/linux-2.6.33.2#

mvsdio-2.patch

root@debian:~/kernel/source/linux-2.6.33.2# head ../mvsdio-2.patch
From: Nicolas Pitre 
Date: Tue, 28 Apr 2009 02:38:12 +0000 (-0400)
Subject: [MMC] give Sandisk/Kingston SDHC cards some slack before the SWITCH command
X-Git-Url: http://git.marvell.com/?p=orion.git;a=commitdiff_plain;h=3ea638523747f6d312f11f643a3175c1a4661eec;hp=c0c3df02efed0e5dea9aa4d8313e06e1f68f2cb4

[MMC] give Sandisk/Kingston SDHC cards some slack before the SWITCH command

Without this delay, those cards simply won't work in high speed mode
as the SWITCH command does not succeeds.

root@debian:~/kernel/source/linux-2.6.33.2# grep '^diff' ../mvsdio-2.patch
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
root@debian:~/kernel/source/linux-2.6.33.2# patch -p1 < ../mvsdio-2.patch
patching file drivers/mmc/core/sd.c
root@debian:~/kernel/source/linux-2.6.33.2#
とりあえず、全部あたった。

.config

http://sheeva.with-linux.com/sheeva/2.6.33.2/sheeva-2.6.33.2.config が .config か?
root@debian:~/kernel/source/linux-2.6.33.2# wget http://sheeva.with-linux.com/sheeva/2.6.33.2/sheeva-2.6.33.2.config
--2010-04-18 21:30:55--  http://sheeva.with-linux.com/sheeva/2.6.33.2/sheeva-2.6.33.2.config
Resolving sheeva.with-linux.com... 216.146.103.100
Connecting to sheeva.with-linux.com|216.146.103.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 66548 (65K) [text/plain]
Saving to: `sheeva-2.6.33.2.config'

100%[========================================================================================================>] 66,548      46.2K/s   in 1.4s

2010-04-18 21:30:57 (46.2 KB/s) - `sheeva-2.6.33.2.config' saved [66548/66548]

root@debian:~/kernel/source/linux-2.6.33.2# head sheeva-2.6.33.2.config
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.33
# Tue Mar  2 14:14:59 2010
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
root@debian:~/kernel/source/linux-2.6.33.2#
それっぽい
root@debian:~/kernel/source/linux-2.6.33.2# mv sheeva-2.6.33.2.config ..
root@debian:~/kernel/source/linux-2.6.33.2# cp ../sheeva-2.6.33.2.config .config
root@debian:~/kernel/source/linux-2.6.33.2#
さて、これでドライバはコンパイルできるの???


←(前のページ)
カーネル 2.6.33.2 のインストール
当月のハックの記録
SheevaPlug/玄柴(KURO-SHEEVA)をハックしよう トップ
(次のページ)→
ドライバのコンパイル(2)

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