KURO-RS ドライバ(2)ドライバのコンパイル

KURO-BOX/Pro KURO-RS

HS-DHGL に KURO-RS のドライバが入っていないので、 自力で何とかしようと試してみる。

ドライバ(カーネル)をコンパイルする環境ができたので、 次はソースを修正してコンパイルする。

ソースの修正

KURO-RS に付属する KURO-RS SDK CD-ROM の Linux/linux_readme.txt に従いソースを修正する。

drivers/usb/serial/ftdi_sio.h の修正

[root@junk linux-2.6.12_lsp.1.10.3]# cd drivers/usb/serial/
[root@junk serial]# mv ftdi_sio.h{,.orig}
[root@junk serial]# cp ftdi_sio.h{.orig,}
[root@junk serial]# vi ftdi_sio.h
	:
	:
[root@junk serial]# diff -c ftdi_sio.h.orig ftdi_sio.h
*** ftdi_sio.h.orig     Tue Aug 30 01:55:27 2005
--- ftdi_sio.h  Sun Sep 16 00:17:42 2007
***************
*** 793,795 ****
--- 793,801 ----
   *
   */

+ /*
+  * BUFFALO RemoteStation PC-OP-RS1
+  */
+ #define BUFFALO_VID             0x0411  /* BUFFALO Vendor ID                 */
+ #define BUFFALO_PCOPRS1_PID     0x00b3  /* RemoteStation PC-OP-RS1 ProductID */
+
[root@junk serial]#

drivers/usb/serial/ftdi_sio.c の修正

[root@junk serial]# mv ftdi_sio.c{,.orig}
[root@junk serial]# cp ftdi_sio.c{.orig,}
[root@junk serial]# vi ftdi_sio.c
	:
	:
[root@junk serial]# diff -c ftdi_sio.c.orig ftdi_sio.c
*** ftdi_sio.c.orig     Tue Aug 30 01:55:27 2005
--- ftdi_sio.c  Sun Sep 16 00:20:40 2007
***************
*** 2583,2585 ****
--- 2583,2599 ----
  module_param(debug, bool, S_IRUGO | S_IWUSR);
  MODULE_PARM_DESC(debug, "Debug enabled or not");

+ static struct usb_device_id id_table_8U232AM [] = {
+       { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
+       { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) },
+       { USB_DEVICE_VER(BUFFALO_VID, BUFFALO_PCOPRS1_PID, 0, 0x3ff) },
+       { }
+ };
+
+ static __devinitdata struct usb_device_id id_table_combined [] = {
+       { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
+       { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) },
+       { USB_DEVICE(BUFFALO_VID, BUFFALO_PCOPRS1_PID) },
+       { }
+ };
[root@junk serial]#

環境の初期化

[root@junk serial]# cd ..
[root@junk usb]# cd ..
[root@junk drivers]# cd ..
[root@junk linux-2.6.12_lsp.1.10.3]# make distclean
  CLEAN   arch/arm/boot/compressed
  CLEAN   arch/arm/boot
  CLEAN   arch/arm/kernel
  CLEAN   drivers/char
  CLEAN   drivers/pci
  CLEAN   init
  CLEAN   kernel
  CLEAN   lib
  CLEAN   usr
  CLEAN   .tmp_versions
  CLEAN   include/asm-arm/constants.h include/asm-arm/mach-types.h include/asm-arm/arch include/asm-arm/.arch vmlinux Syste
m.map .tmp_kallsyms1.S .tmp_kallsyms1.o .tmp_kallsyms2.S .tmp_kallsyms2.o .tmp_vmlinux1 .tmp_vmlinux2 .tmp_System.map
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts
  CLEAN   include/config
  CLEAN   .config .config.old include/asm .version include/linux/autoconf.h include/linux/version.h Module.symvers
[root@junk linux-2.6.12_lsp.1.10.3]#

モジュールを追加後に保存(わけわからんタイトルや)

[root@junk linux-2.6.12_lsp.1.10.3]# make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/split-include
  HOSTCC  scripts/basic/docproc
  SHIPPED scripts/kconfig/zconf.tab.h
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
  HOSTCC  scripts/lxdialog/checklist.o
In file included from scripts/lxdialog/checklist.c:24:
scripts/lxdialog/dialog.h:32:20: curses.h: No such file or directory
In file included from scripts/lxdialog/checklist.c:24:
scripts/lxdialog/dialog.h:130: error: syntax error before "use_colors"
scripts/lxdialog/dialog.h:130: warning: type defaults to `int' in declaration of `use_colors'
scripts/lxdialog/dialog.h:130: warning: data definition has no type or storage class
scripts/lxdialog/dialog.h:131: error: syntax error before "use_shadow"
scripts/lxdialog/dialog.h:131: warning: type defaults to `int' in declaration of `use_shadow'
scripts/lxdialog/dialog.h:131: warning: data definition has no type or storage class
scripts/lxdialog/dialog.h:133: error: syntax error before "attributes"
scripts/lxdialog/dialog.h:133: warning: type defaults to `int' in declaration of `attributes'
scripts/lxdialog/dialog.h:133: warning: data definition has no type or storage class
scripts/lxdialog/dialog.h:146: error: syntax error before '*' token
scripts/lxdialog/dialog.h:146: warning: function declaration isn't a prototype
scripts/lxdialog/dialog.h:149: error: syntax error before '*' token
scripts/lxdialog/dialog.h:149: warning: function declaration isn't a prototype
scripts/lxdialog/dialog.h:150: error: syntax error before '*' token
scripts/lxdialog/dialog.h:150: warning: function declaration isn't a prototype
scripts/lxdialog/dialog.h:151: error: syntax error before '*' token
scripts/lxdialog/dialog.h:152: warning: function declaration isn't a prototype
scripts/lxdialog/dialog.h:153: error: syntax error before '*' token
scripts/lxdialog/dialog.h:153: warning: function declaration isn't a prototype
scripts/lxdialog/checklist.c:32: error: syntax error before '*' token
scripts/lxdialog/checklist.c:34: warning: function declaration isn't a prototype
scripts/lxdialog/checklist.c: In function `print_item':
scripts/lxdialog/checklist.c:38: warning: implicit declaration of function `wattrset'
scripts/lxdialog/checklist.c:38: error: `win' undeclared (first use in this function)
scripts/lxdialog/checklist.c:38: error: (Each undeclared identifier is reported only once
scripts/lxdialog/checklist.c:38: error: for each function it appears in.)
scripts/lxdialog/checklist.c:39: warning: implicit declaration of function `wmove'
scripts/lxdialog/checklist.c:39: error: `choice' undeclared (first use in this function)
scripts/lxdialog/checklist.c:41: warning: implicit declaration of function `waddch'
scripts/lxdialog/checklist.c:44: error: `selected' undeclared (first use in this function)
scripts/lxdialog/checklist.c:46: warning: implicit declaration of function `wprintw'
scripts/lxdialog/checklist.c:46: error: `status' undeclared (first use in this function)
scripts/lxdialog/checklist.c:51: warning: implicit declaration of function `mvwaddch'
scripts/lxdialog/checklist.c:51: error: `item' undeclared (first use in this function)
scripts/lxdialog/checklist.c:53: warning: implicit declaration of function `waddstr'
scripts/lxdialog/checklist.c:56: warning: implicit declaration of function `wrefresh'
scripts/lxdialog/checklist.c: At top level:
scripts/lxdialog/checklist.c:64: error: syntax error before '*' token
scripts/lxdialog/checklist.c:66: warning: function declaration isn't a prototype
scripts/lxdialog/checklist.c: In function `print_arrows':
scripts/lxdialog/checklist.c:67: error: `win' undeclared (first use in this function)
scripts/lxdialog/checklist.c:67: error: `y' undeclared (first use in this function)
scripts/lxdialog/checklist.c:67: error: `x' undeclared (first use in this function)
scripts/lxdialog/checklist.c:69: error: `scroll' undeclared (first use in this function)
scripts/lxdialog/checklist.c:82: error: `height' undeclared (first use in this function)
scripts/lxdialog/checklist.c:85: error: `item_no' undeclared (first use in this function)
scripts/lxdialog/checklist.c:85: error: `choice' undeclared (first use in this function)
scripts/lxdialog/checklist.c: At top level:
scripts/lxdialog/checklist.c:103: error: syntax error before '*' token
scripts/lxdialog/checklist.c:104: warning: function declaration isn't a prototype
scripts/lxdialog/checklist.c: In function `print_buttons':
scripts/lxdialog/checklist.c:105: error: `width' undeclared (first use in this function)
scripts/lxdialog/checklist.c:106: error: `height' undeclared (first use in this function)
scripts/lxdialog/checklist.c:108: error: `dialog' undeclared (first use in this function)
scripts/lxdialog/checklist.c:108: error: `selected' undeclared (first use in this function)
scripts/lxdialog/checklist.c: In function `dialog_checklist':
scripts/lxdialog/checklist.c:126: error: `WINDOW' undeclared (first use in this function)
scripts/lxdialog/checklist.c:126: error: `dialog' undeclared (first use in this function)
scripts/lxdialog/checklist.c:126: error: `list' undeclared (first use in this function)
scripts/lxdialog/checklist.c:126: warning: left-hand operand of comma expression has no effect
scripts/lxdialog/checklist.c:132: warning: implicit declaration of function `endwin'
scripts/lxdialog/checklist.c:133: warning: implicit declaration of function `fprintf'
scripts/lxdialog/checklist.c:133: error: `stderr' undeclared (first use in this function)
scripts/lxdialog/checklist.c:150: error: `COLS' undeclared (first use in this function)
scripts/lxdialog/checklist.c:151: error: `LINES' undeclared (first use in this function)
scripts/lxdialog/checklist.c:153: error: `stdscr' undeclared (first use in this function)
scripts/lxdialog/checklist.c:155: warning: implicit declaration of function `newwin'
scripts/lxdialog/checklist.c:156: warning: implicit declaration of function `keypad'
scripts/lxdialog/checklist.c:156: error: `TRUE' undeclared (first use in this function)
scripts/lxdialog/checklist.c:189: warning: implicit declaration of function `subwin'
scripts/lxdialog/checklist.c:221: warning: implicit declaration of function `wnoutrefresh'
scripts/lxdialog/checklist.c:223: warning: implicit declaration of function `doupdate'
scripts/lxdialog/checklist.c:226: warning: implicit declaration of function `wgetch'
scripts/lxdialog/checklist.c:233: error: `KEY_UP' undeclared (first use in this function)
scripts/lxdialog/checklist.c:233: error: `KEY_DOWN' undeclared (first use in this function)
scripts/lxdialog/checklist.c:243: error: `FALSE' undeclared (first use in this function)
scripts/lxdialog/checklist.c:244: warning: implicit declaration of function `scrollok'
scripts/lxdialog/checklist.c:245: warning: implicit declaration of function `wscrl'
scripts/lxdialog/checklist.c:308: warning: implicit declaration of function `delwin'
scripts/lxdialog/checklist.c:312: error: `KEY_LEFT' undeclared (first use in this function)
scripts/lxdialog/checklist.c:313: error: `KEY_RIGHT' undeclared (first use in this function)
scripts/lxdialog/checklist.c: At top level:
scripts/lxdialog/dialog.h:133: warning: array `attributes' assumed to have one element
make[2]: *** [scripts/lxdialog/checklist.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2
[root@junk linux-2.6.12_lsp.1.10.3]#
curses が入っていないよう。入れる
[root@junk linux-2.6.12_lsp.1.10.3]# apt-cache search curses
ncurses - A CRT screen handling and optimization package.
python - An interpreted, interactive, object-oriented programming language.
libruby - Libraries necessary to run Ruby.
[root@junk linux-2.6.12_lsp.1.10.3]# apt-get install ncurses
Reading Package Lists... Done
Building Dependency Tree... Done
ncurses is already the newest version.
0 upgraded, 0 newly installed, 0 removed and 0 not upgraded.
[root@junk linux-2.6.12_lsp.1.10.3]# 
あれ?入っている。
仕方がないので、make oldconfig する
[root@junk linux-2.6.12_lsp.1.10.3]# cp buffalo/config_kurobox.conf .config
[root@junk linux-2.6.12_lsp.1.10.3]# vi .config
(CONFIG_USB_SERIAL=m にする)
[root@junk linux-2.6.12_lsp.1.10.3]# make oldconfig
scripts/kconfig/conf -o arch/arm/Kconfig
#
# using defaults found in .config
#
.config:92: trying to assign nonexistent symbol BUFFALO_PLATFORM
.config:97: trying to assign nonexistent symbol BUFFALO_KUROBOX
.config:98: trying to assign nonexistent symbol BUFFALO_SOFT_BOARDID
.config:99: trying to assign nonexistent symbol BUFFALO_KUROBOX_SOFT_BOARDID
.config:101: trying to assign nonexistent symbol BUFFALO_USE_MICON
*
	:
	:
*
* KUROBOX Feature
*
KUROBOX_PLATFORM (KUROBOX_PLATFORM) [N/y/?] (NEW) y
*
* KUROBOX Model Name
*
KUROBOX Model name
> 1. KURO-BOX (KUROBOX_KUROBOX) (NEW)
choice[1]: 1
USE SOFT BOARDID (KUROBOX_SOFT_BOARDID) [N/y] (NEW) y
KUROBOX Board Id
> 1. SOFT_BOARDID 0x16 (KUROBOX) (KUROBOX_KUROBOX_SOFT_BOARDID) (NEW)
choice[1]: 1
USE RTC chip RS5C372 (USE_RS5C372) [N/y/?] (NEW) y
USE MICON control (KUROBOX_USE_MICON) [N/y/?] (NEW) y
enable egiga debug (EGIGA_DEBUG) [N/y/?] (NEW) n
	:
	:
  *
  * USB port drivers
  *
  *
  * USB Serial Converter support
  *
  USB Serial Converter support (USB_SERIAL) [M/n/y/?] m
    USB Generic Serial Driver (USB_SERIAL_GENERIC) [N/y/?] (NEW) n
    USB AirPrime CDMA Wireless Driver (USB_SERIAL_AIRPRIME) [N/m/?] (NEW) n
    USB Belkin and Peracom Single Port Serial Driver (USB_SERIAL_BELKIN) [N/m/?] (NEW) n
    USB ConnectTech WhiteHEAT Serial Driver (USB_SERIAL_WHITEHEAT) [N/m/?] (NEW) n
    USB Digi International AccelePort USB Serial Driver (USB_SERIAL_DIGI_ACCELEPORT) [N/m/?] (NEW) n
    USB CP2101 UART Bridge Controller (USB_SERIAL_CP2101) [N/m/?] (NEW) n
    USB Cypress M8 USB Serial Driver (USB_SERIAL_CYPRESS_M8) [N/m/?] (NEW) n
    USB Empeg empeg-car Mark I/II Driver (USB_SERIAL_EMPEG) [N/m/?] (NEW) n
    USB FTDI Single Port Serial Driver (EXPERIMENTAL) (USB_SERIAL_FTDI_SIO) [N/m/?] (NEW) m
	:
	:
CRC-CCITT functions (CRC_CCITT) [N/m/y/?] n
CRC32 functions (CRC32) [Y/?] y
CRC32c (Castagnoli, et al) Cyclic Redundancy-Check (LIBCRC32C) [Y/n/m/?] y
[root@junk linux-2.6.12_lsp.1.10.3]#

モジュールの依存関係を初期化

[root@junk linux-2.6.12_lsp.1.10.3]# make dep
*** Warning: make dep is unnecessary now.
[root@junk linux-2.6.12_lsp.1.10.3]#

モジュールの作成、インストール

[root@junk linux-2.6.12_lsp.1.10.3]# make modules modules_install
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  SYMLINK include/asm -> include/asm-arm
  SPLIT   include/linux/autoconf.h -> include/config/*
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
	:
	:
  CC [M]  drivers/usb/serial/usb-serial.o
  CC [M]  drivers/usb/serial/generic.o
  CC [M]  drivers/usb/serial/bus.o
  LD [M]  drivers/usb/serial/usbserial.o
  CC [M]  drivers/usb/serial/ftdi_sio.o
drivers/usb/serial/ftdi_sio.c:2586: error: redefinition of 'id_table_8U232AM'
drivers/usb/serial/ftdi_sio.c:296: error: previous definition of 'id_table_8U232AM' was here
drivers/usb/serial/ftdi_sio.c:2593: error: redefinition of 'id_table_combined'
drivers/usb/serial/ftdi_sio.c:523: error: previous definition of 'id_table_combined' was here
drivers/usb/serial/ftdi_sio.c:2586: warning: 'id_table_8U232AM' defined but not used
make[3]: *** [drivers/usb/serial/ftdi_sio.o] Error 1
make[2]: *** [drivers/usb/serial] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
[root@junk linux-2.6.12_lsp.1.10.3]#
エラー終了。

ftdi_sio.c への追加の方法がまずいようだ。

drivers/usb/serial/ftdi_sio.c の再修正

追加分を元々の定義の中へ移動。
.orig が消されてしまって diff 取れず。

再:モジュールの作成、インストール

[root@junk linux-2.6.12_lsp.1.10.3]# make modules modules_install
	:
	:
  Building modules, stage 2.
  MODPOST
  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
Warning: you may need to install module-init-tools
See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt
  INSTALL drivers/usb/serial/ftdi_sio.ko
  INSTALL drivers/usb/serial/usbserial.ko
if [ -r System.map -a -x /sbin/depmod ]; then /sbin/depmod -ae -F System.map -b binaries -r 2.6.12.6-arm1; fi
[root@junk linux-2.6.12_lsp.1.10.3]#
できたみたい。


KURO-BOX/PRO
玄人志向
楽天市場
TSUKUMO ネットショップ
Yahoo!ショッピング
Sofmap
クレバリー
TwoTop

SCON-KIT/PRO
玄人志向
TSUKUMO ネットショップ
Yahoo! ショッピング
パソQ
ValuMore
uWorks

玄箱PROをハックしよう
ASCII
楽天ブックス
Amazon
cbook24
e-hon
JBook
BK1
livedoorブックス
紀伊國屋書店BookWeb
KURO-RS
楽天市場
Amazon
Yahoo!ショッピング
TSUKUMO
クレバリー


KURO-RS ドライバ(1)クロスコンパイル環境の構築
ハックの記録
LinkStation/玄箱 をハックしよう

KURO-RS ドライバ(3)ドライバのロード

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