いちからやり直し、、、(11)カーネルモジュールの作成

Debian HS-DHGL KURO-RS

第三世代 LinkStation ハックキットで 「延長対応ハック de ダブルまる録!! 外部チューナコントロールつき」が まあまあ動くようになったが、 インストールに使ったファームウェア 1.20 では、 PC-MV5xDX/U2 が切り捨てられたことを思い出して いちからやり直し。

第三世代 LinkStation ハックキットのセットアップは 一通り終わったので、
次は、KURO-RS を用いた赤外線リモコンを実現する。

構想

この間は旧形 HS-DHGL で動作しているモジュールをコピーしたが、 同じことやってもおもしろくないので、 今回はカーネルソースからモジュール作り直す。
これとて 以前の繰り返しではある。

カーネルソースの入手

カーネルソースは、 Buffaloのページで公開されている。

wget で取得する。

yasunari@slam:~$ mkdir linux
yasunari@slam:~$ cd linux
yasunari@slam:~/linux$ wget http://buffalo.jp/php/los.php?to=gpl/storage/ls-gl/1
10/linux-2.6.16_lsp.1.7.8.tar.gz
--2009-07-05 08:21:49--  http://buffalo.jp/php/los.php?to=gpl/storage/ls-gl/110/linux-2.6.16_lsp.1.7.8.tar.gz
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-gl/110/linux-2.6.16_lsp.1.7.8.tar.gz [following]
--2009-07-05 08:21:49--  http://driver.opensource.buffalo.jp/buf-odrv/gpl/storage/ls-gl/110/linux-2.6.16_lsp.1.7.8.tar.gz
Resolving driver.opensource.buffalo.jp... 125.29.53.11
Connecting to driver.opensource.buffalo.jp|125.29.53.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 52811157 (50M) [application/x-gzip]
Saving to: `linux-2.6.16_lsp.1.7.8.tar.gz'

100%[======================================>] 52,811,157  4.30M/s   in 11s

2009-07-05 08:22:01 (4.40 MB/s) - `linux-2.6.16_lsp.1.7.8.tar.gz' saved [52811157/52811157]

yasunari@slam:~/linux$

カーネルソースの展開

yasunari@slam:~/linux$ ls
linux-2.6.16_lsp.1.7.8.tar.gz
yasunari@slam:~/linux$ tar ztvf linux-2.6.16_lsp.1.7.8.tar.gz  | head
drwxrwxrwx root/root         0 2007-06-14 14:18 ./linux-2.6.16_lsp.1.7.8/
drwxrwxrwx root/root         0 2007-06-14 14:18 ./linux-2.6.16_lsp.1.7.8/fs/
drwxrwxrwx root/root         0 2006-10-02 15:35 ./linux-2.6.16_lsp.1.7.8/fs/9p/
-rw-rw-rw- root/root      8919 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/9p.c
-rw-rw-rw- root/root      7036 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/9p.h
-rw-rw-rw- root/root       223 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/Makefile
-rw-rw-rw- root/root     18721 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/conv.c
-rw-rw-rw- root/root      2127 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/conv.h
-rw-rw-rw- root/root      2090 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/debug.h
-rw-rw-rw- root/root      2340 2006-05-11 19:00 ./linux-2.6.16_lsp.1.7.8/fs/9p/error.c
yasunari@slam:~/linux$ tar zxvf linux-2.6.16_lsp.1.7.8.tar.gz
	:
	:
./linux-2.6.16_lsp.1.7.8/usr/
./linux-2.6.16_lsp.1.7.8/usr/.gitignore
./linux-2.6.16_lsp.1.7.8/usr/Kconfig
./linux-2.6.16_lsp.1.7.8/usr/Makefile
./linux-2.6.16_lsp.1.7.8/usr/gen_init_cpio.c
./linux-2.6.16_lsp.1.7.8/usr/initramfs_data.S
./linux-2.6.16_lsp.1.7.8/md-061108-2.diff
yasunari@slam:~/linux$

パッチ

KURO-RS を認識するよう、 カーネルソースを修正する。
yasunari@slam:~/linux$ ls
linux-2.6.16_lsp.1.7.8  linux-2.6.16_lsp.1.7.8.tar.gz
yasunari@slam:~/linux$ cd linux-2.6.16_lsp.1.7.8
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ cd drivers/usb/serial/
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ mv ftdi_sio.c{,.orig}
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ cp ftdi_sio.c{.orig,}
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ mv ftdi_sio.h{,.orig}
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ cp ftdi_sio.h{.orig,}
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ vi ftdi_sio.h
	:
	:
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ diff -c !${.orig,}
*** ftdi_sio.h.orig     Thu May 11 19:00:01 2006
--- ftdi_sio.h  Sun Jul  5 08:36:04 2009
***************
*** 392,397 ****
--- 392,403 ----
  #define FTDI_WESTREX_MODEL_777_PID    0xDC00  /* Model 777 */
  #define FTDI_WESTREX_MODEL_8900F_PID  0xDC01  /* Model 8900F */

+ /*
+  * BUFFALO RemoteStation PC-OP-RS1
+  */
+ #define BUFFALO_VID             0x0411  /* BUFFALO Vendor ID                 */
+ #define BUFFALO_PCOPRS1_PID     0x00b3  /* RemoteStation PC-OP-RS1 ProductID */
+
  /* Commands */
  #define FTDI_SIO_RESET                0 /* Reset the port */
  #define FTDI_SIO_MODEM_CTRL   1 /* Set the modem control register */
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ vi ftdi_sio.c
	:
	:
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ diff -c !${.orig,}
diff -c ftdi_sio.c{.orig,}
*** ftdi_sio.c.orig     Thu May 11 19:00:01 2006
--- ftdi_sio.c  Sun Jul  5 08:39:50 2009
***************
*** 492,497 ****
--- 492,498 ----
        { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
+       { USB_DEVICE(BUFFALO_VID, BUFFALO_PCOPRS1_PID) },
        { },                                    /* Optional parameter entry */
        { }                                     /* Terminating entry */
  };
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$

.config のコピー

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial$ cd ../../..
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ ls
COPYING        Kbuild       README          block    drivers  init    lib               net       sound
CREDITS        MAINTAINERS  REPORTING-BUGS  buffalo  fs       ipc     md-061108-2.diff  scripts   usr
Documentation  Makefile     arch            crypto   include  kernel  mm                security
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ ls buffalo/
buffalo_lsgl_arm_100.config  buffalo_lsgl_hs_arm_100.config  marvell_config100.config
buffalo_lsgl_arm_101.config  buffalo_tshtgl_arm_100.config   marvell_lsgl_100.config
buffalo_lsgl_arm_102.config  buffalo_tshtgl_arm_110.config   marvell_tshtgl_100.config
buffalo_lsgl_arm_110.config  drivers
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ cp buffalo/buffalo_lsgl_hs_arm_100.config .config
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$

menuconfig

以前あきらめた menuconfig

コンパイルエラー

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ make menuconfig
  HOSTLD  scripts/kconfig/mconf
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:31:20: error: curses.h: No such file or directory
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:128: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'use_colors'
scripts/kconfig/lxdialog/dialog.h:129: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'use_shadow'
scripts/kconfig/lxdialog/dialog.h:131: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'attributes'
scripts/kconfig/lxdialog/dialog.h:143: error: expected ')' before '*' token
scripts/kconfig/lxdialog/dialog.h:146: error: expected ')' before '*' token
scripts/kconfig/lxdialog/dialog.h:147: error: expected ')' before '*' token
scripts/kconfig/lxdialog/dialog.h:148: error: expected ')' before '*' token
scripts/kconfig/lxdialog/dialog.h:149: error: expected ')' before '*' token
scripts/kconfig/lxdialog/dialog.h:151: error: expected ')' before '*' token
scripts/kconfig/lxdialog/checklist.c:31: error: expected ')' before '*' token
scripts/kconfig/lxdialog/checklist.c:59: error: expected ')' before '*' token
scripts/kconfig/lxdialog/checklist.c:95: error: expected ')' before '*' token
scripts/kconfig/lxdialog/checklist.c: In function 'dialog_checklist':
scripts/kconfig/lxdialog/checklist.c:117: error: 'WINDOW' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:117: error: (Each undeclared identifier is reported only once
scripts/kconfig/lxdialog/checklist.c:117: error: for each function it appears in.)
scripts/kconfig/lxdialog/checklist.c:117: error: 'dialog' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:117: error: 'list' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:117: warning: left-hand operand of comma expression has no effect
scripts/kconfig/lxdialog/checklist.c:121: warning: implicit declaration of function 'endwin'
scripts/kconfig/lxdialog/checklist.c:122: warning: implicit declaration of function 'fprintf'
scripts/kconfig/lxdialog/checklist.c:122: warning: incompatible implicit declaration of built-in function 'fprintf'
scripts/kconfig/lxdialog/checklist.c:122: error: 'stderr' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:140: error: 'COLS' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:141: error: 'LINES' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:143: warning: implicit declaration of function 'draw_shadow'
scripts/kconfig/lxdialog/checklist.c:143: error: 'stdscr' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:145: warning: implicit declaration of function 'newwin'
scripts/kconfig/lxdialog/checklist.c:146: warning: implicit declaration of function 'keypad'
scripts/kconfig/lxdialog/checklist.c:146: error: 'TRUE' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:148: warning: implicit declaration of function 'draw_box'
scripts/kconfig/lxdialog/checklist.c:148: error: 'attributes' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:149: warning: implicit declaration of function 'wattrset'
scripts/kconfig/lxdialog/checklist.c:150: warning: implicit declaration of function 'mvwaddch'
scripts/kconfig/lxdialog/checklist.c:152: warning: implicit declaration of function 'waddch'
scripts/kconfig/lxdialog/checklist.c:156: warning: implicit declaration of function 'print_title'
scripts/kconfig/lxdialog/checklist.c:159: warning: implicit declaration of function 'print_autowrap'
scripts/kconfig/lxdialog/checklist.c:166: warning: implicit declaration of function 'subwin'
scripts/kconfig/lxdialog/checklist.c:190: warning: implicit declaration of function 'print_item'
scripts/kconfig/lxdialog/checklist.c:194: warning: implicit declaration of function 'print_arrows'
scripts/kconfig/lxdialog/checklist.c:197: warning: implicit declaration of function 'print_buttons'
scripts/kconfig/lxdialog/checklist.c:199: warning: implicit declaration of function 'wnoutrefresh'
scripts/kconfig/lxdialog/checklist.c:201: warning: implicit declaration of function 'doupdate'
scripts/kconfig/lxdialog/checklist.c:204: warning: implicit declaration of function 'wgetch'
scripts/kconfig/lxdialog/checklist.c:211: error: 'KEY_UP' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:211: error: 'KEY_DOWN' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:221: error: 'FALSE' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:222: warning: implicit declaration of function 'scrollok'
scripts/kconfig/lxdialog/checklist.c:223: warning: implicit declaration of function 'wscrl'
scripts/kconfig/lxdialog/checklist.c:233: warning: implicit declaration of function 'wrefresh'
scripts/kconfig/lxdialog/checklist.c:283: warning: incompatible implicit declaration of built-in function 'fprintf'
scripts/kconfig/lxdialog/checklist.c:284: warning: implicit declaration of function 'delwin'
scripts/kconfig/lxdialog/checklist.c:288: error: 'KEY_LEFT' undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:289: error: 'KEY_RIGHT' undeclared (first use in this function)
make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$
curses.h とか WINDOW とか endwin, newwin とか、 curses の開発環境が足りない。

必要なパッケージを探す

探す。
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ apt-cache search curses
	:
	:
libncurses5-dev - developer's libraries and docs for ncurses
	:
	:
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ 
多分これ。

libncurses5-dev のインストール

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ su - root
Password:
slam:~# 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 1546kB of archives.
After this operation, 6631kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org lenny/main libncurses5-dev 5.7+20081213-1 [1546kB]
Fetched 1546kB in 1s (1464kB/s)
Selecting previously deselected package libncurses5-dev.
(Reading database ... 11433 files and directories currently installed.)
Unpacking libncurses5-dev (from .../libncurses5-dev_5.7+20081213-1_armel.deb) ...
Processing triggers for man-db ...
Setting up libncurses5-dev (5.7+20081213-1) ...
slam:~# exit
logout
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$

make menuconfig

再度実行。
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ make menuconfig
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
	:
	:
 Linux Kernel v2.6.16.16-arm1 Configuration
 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq Linux Kernel Configuration qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted letters are hotkeys.     x
  x  Pressing <Y> includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to exit, <?> for   x
  x  Help, </> for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable           x
  x                                                                                                      x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x     Code maturity level options  --->                                                            x x
  x x     General setup  --->                                                                          x x
  x x     Loadable module support  --->                                                                x x
  x x     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     Floating point emulation  --->                                                               x x
  x x     Userspace binary formats  --->                                                               x x
  x x     Power management options  --->                                                               x x
  x x     Networking  --->                                                                             x x
  x x     Device Drivers  --->                                                                         x x
  x x     File systems  --->                                                                           x x
  x x     Profiling support  --->                                                                      x x
  x x     Kernel hacking  --->                                                                         x x
  x x     Security options  --->                                                                       x x
  x x     Cryptographic options  --->                                                                  x x
  x x     Library routines  --->                                                                       x x
  x x ---                                                                                              x x
  x x     Load an Alternate Configuration File                                                         x x
  x x     Save Configuration to an Alternate File                                                      x x
  x x                                                                                                  x x
  x x                                                                                                  x x
  x x                                                                                                  x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
  x                                   <Select>    < Exit >    < Help >                                   x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj


立ち上がってきた。ほんと、久しぶり。

コンフィギュレーション

まずは、CONFIG_USB_SERIAL=m 。どこだ、、、探す。
Device Drivers → USB support → USB Serial Converter support
 Linux Kernel v2.6.16.16-arm1 Configuration
 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq USB Serial Converter support qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted letters are  x
  x  hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes features.  Press         x
  x  <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend: [*] built-in  [ ] excluded   x
  x  <M> module  < > module capable                                                          x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x < > USB Serial Converter support                                                     x x
  x x                                                                                      x x
  x x                                                                                      x x
スペースを押して M にする。
続いて
  x x < >   USB FTDI Single Port Serial Driver (EXPERIMENTAL) (NEW)                        x x
ここも M にする。
保存して、終了。

                  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
                  x   Do you wish to save your new kernel configuration?     x
                  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                  x                   < Yes >      <  No  >                  x
                  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj




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

make[1]: arm-none-linux-gnueabi-gcc: Command not found
make[1]: arm-none-linux-gnueabi-gcc: Command not found
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$
arm-none-linux-gnueabi-gcc って、クロスコンパイルようになっているぅ。

確認

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ grep ONFIG_USB_SERIAL= .config
CONFIG_USB_SERIAL=m
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ grep USB_SERIAL_FTDI_SIO= .config
CONFIG_USB_SERIAL_FTDI_SIO=m
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$
OK.

セルフコンパイルに変更

気持ちが悪いので、Makefile を修正

って、 前回はクロスコンパイルしてたのか。

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ grep arm-none-linux-gnueabi *
Makefile:CROSS_COMPILE  ?= arm-none-linux-gnueabi-
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ mv Makefile{,.orig}
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ cp Makefile{.orig,}
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ vi Makefile
	:
	:
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ diff -c !${.orig,}
diff -c Makefile{.orig,}
*** Makefile.orig       Thu Dec 28 15:10:30 2006
--- Makefile    Sun Jul  5 09:14:40 2009
***************
*** 176,182 ****

  ARCH          ?= arm
  #CROSS_COMPILE        ?= arm-linux-
! CROSS_COMPILE ?= arm-none-linux-gnueabi-

  # Architecture as present in compile.h
  UTS_MACHINE := $(ARCH)
--- 176,182 ----

  ARCH          ?= arm
  #CROSS_COMPILE        ?= arm-linux-
! #CROSS_COMPILE        ?= arm-none-linux-gnueabi-

  # Architecture as present in compile.h
  UTS_MACHINE := $(ARCH)
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$

もう一回、make menuconfig

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ make menuconfig
	:
すぐメニューになるので、Exit
                  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
                  x   Do you wish to save your new kernel configuration?     x
                  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                  x                   < Yes >      <  No  >                  x
                  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj





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

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$

モジュールのコンパイル

yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ make clean
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ make modules
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
	:
	:
  CC      drivers/usb/serial/ftdi_sio.mod.o
  LD [M]  drivers/usb/serial/ftdi_sio.ko
  CC      drivers/usb/serial/usbserial.mod.o
  LD [M]  drivers/usb/serial/usbserial.ko
	:
	:
  CC      net/llc/llc.mod.o
  LD [M]  net/llc/llc.ko
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$
KURO-RS 関連のモジュール以外は何も変更なし、 コンパイル対象からもはずしていないので、 要らないモジュールもいっぱいコンパイルされる。

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

本来なら、make modules_install
でも、要らないモジュールもいっぱいコンパイルしたので、 変に上書きして動かなくなっても困る。
チキンに必要なモジュールだけを手動でコピーする。
yasunari@slam:~/linux/linux-2.6.16_lsp.1.7.8$ su
Password:
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8# mkdir /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/serial
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8# cd drivers/usb/serial/
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial# tar cf - usbserial.ko ftdi_sio.ko |(cd /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/serial/; tar xvf -)
usbserial.ko
ftdi_sio.ko
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial# ls -l /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/serial/
total 72
-rw-r--r-- 1 yasunari yamasita 40445 Jul  5 09:28 ftdi_sio.ko
-rw-r--r-- 1 yasunari yamasita 29386 Jul  5 09:28 usbserial.ko
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial#

モジュールのロード

手動でロードしてみる。
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial# insmod /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/serial/usbserial.ko
insmod: error inserting '/lib/modules/2.6.16.16-arm1/kernel/drivers/usb/serial/usbserial.ko': -1 Invalid module format
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial# insmod ./usbserial.ko
insmod: error inserting './usbserial.ko': -1 Invalid module format
slam:/home/yamasita/yasunari/linux/linux-2.6.16_lsp.1.7.8/drivers/usb/serial#
あかんやん。

やっぱり、餅屋にはなれなかった。。。。




HS-DHGL
バッファローダイレクト
楽天市場
Yahoo!ショッピング
ValuMore!
ムラウチドットコム
KURO-RS
バッファローダイレクト
楽天市場
Amazon


いちからやり直し、、、(10)開発環境のインストール
ハックの記録
LinkStation/玄箱 をハックしよう

オープンソースカンファレンス1日目

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