[lingyun@localhost zhouyou]$ mkdir usbmode
[lingyun@localhost zhouyou]$ cd usbmode/
[lingyun@localhost usbmode]$ wget http://pkgs.fedoraproject.org/repo/pkgs/libusb1/libusb-1.0.0.tar.bz2/df2447c23750ef2b4a314200feacc2ee/libusb-1.0.0.tar.bz2
[lingyun@localhost usbmode]$ wget http://jaist.dl.sourceforge.net/project/libusb/libusb-compat-0.1/libusb-compat-0.1.5/libusb-compat-0.1.5.tar.bz2
[lingyun@localhost usbmode]$wget http://pkgs.fedoraproject.org/repo/pkgs/usb_modeswitch/usb-modeswitch-1.2.4.tar.bz2/dbd4ce7966d7b4a5a0604a8280f7164d/usb-modeswitch-1.2.4.tar.bz2
[lingyun@localhost usbmode]$ wget http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-20130607.tar.bz2
解压:
[lingyun@localhost usbmode]$ tar xjf libusb-1.0.0.tar.bz2
[lingyun@localhost usbmode]$ tar xjf libusb-compat-0.1.5.tar.bz2
[lingyun@localhost usbmode]$ tar xjf usb-modeswitch-1.2.4.tar.bz2
[lingyun@localhost usbmode]$ tar xjf usb-modeswitch-data-20130607.tar.bz2
编译libusb:
[lingyun@localhost usbmode]$ mkdir install
[lingyun@localhost usbmode]$ cd libusb-1.0.0
[lingyun@localhost libusb-1.0.0]$ ./configure --prefix=/home/lingyun/fulinux/usbmode/install/ --build=i686 --host=arm-linux --disable-shared --enable-static
[lingyun@localhost libusb-1.0.0]$ make
[lingyun@localhost libusb-1.0.0]$ make install
[lingyun@localhost libusb-1.0.0]$ ls ../install/
include lib
编译usb_modeswitch:
[lingyun@localhost usbmode]$ cd usb-modeswitch-1.2.6
[lingyun@localhost usb-modeswitch-1.2.6]$ ls
[lingyun@localhost usb-modeswitch-1.2.6]$ vim Makefile
CC ?=/opt/buildroot-2011.11/arm926t/usr/bin/arm-linux-gcc #addr fulinux
CFLAGS += -Wall -l ../install/include-static #add by fulinux
LIBS = -L ../install/lib/ -l usb -l usb-1.0-l pthread #add by fulinux
[lingyun@localhost libusb-1.0.0]$ cd ..
[lingyun@localhost usbmode]$ export PKG_CONFIG_PATH=/home/lingyun/fulinux/usbmode/install/lib/pkgconfig:$PKG_CONFIG_PATH
[lingyun@localhost usbmode]$ cd libusb-compat-0.1.5
[lingyun@localhost libusb-compat-0.1.5]$
[lingyun@localhost libusb-compat-0.1.5]$ ./configure --prefix=/home/lingyun/fulinux/usbmode/install/ --build=i686 --host=arm-linux --disable-shared --enable-static
[lingyun@localhost libusb-compat-0.1.5]$ make
[lingyun@localhost libusb-compat-0.1.5]$ make install
[lingyun@localhost libusb-compat-0.1.5]$ ls ../install/
bin include lib
[lingyun@localhost libusb-compat-0.1.5]$
编译usb_modeswitch:
[lingyun@localhost libusb-compat-0.1.5]$ cd ../usb-modeswitch-1.2.4
[lingyun@localhost usb-modeswitch-1.2.6]$ vim Makefile
CC = /opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc
CFLAGS += -Wall -I ../install/include -static
LIBS = -L ../install/lib -l usb -l usb-1.0 -l pthread
[lingyun@localhost usb-modeswitch-1.2.4]$ make
[lingyun@localhost usb-modeswitch-1.2.4]$ cp usb_modeswitch ../install/bin/
[lingyun@localhost usb-modeswitch-1.2.4]$ cp usb_modeswitch /tftp/
[lingyun@localhost usb-modeswitch-1.2.6]$ make cc -o usb_modeswitch usb_modeswitch.c -Wall -I../install/include -static -L /home/lingyun/fulinux/usbmode/install/lib -l usb -l usb-1.0 -l pthread
把usb-modeswitch-data-20130607下的usb_modeswitch.d中的所有文件都拷贝到开发板的etc/usb_modeswitch.d/目录:
[lingyun@localhost usbmode]$ cd usb-modeswitch-data-20130607
[lingyun@localhost usb-modeswitch-data-20130607]$ ls
40-usb_modeswitch.rules ChangeLog COPYING gen-rules.tcl Makefile README usb_modeswitch.d
[lingyun@localhost usb-modeswitch-data-20130607]$ tar cjf usb_modeswitch.d.tar.bz2 usb_modeswitch.d/
[lingyun@localhost usb-modeswitch-data-20130607]$ ls
40-usb_modeswitch.rules ChangeLog COPYING gen-rules.tcl Makefile README usb_modeswitch.d usb_modeswitch.d.tar.bz2
[lingyun@localhost usb-modeswitch-data-20130607]$ cp usb_modeswitch.d.tar.bz2 /tftp/
[lingyun@localhost usb-modeswitch-data-20130607]$