华为3G网卡E1750在omap3530上移植.doc_第1页
华为3G网卡E1750在omap3530上移植.doc_第2页
华为3G网卡E1750在omap3530上移植.doc_第3页
华为3G网卡E1750在omap3530上移植.doc_第4页
华为3G网卡E1750在omap3530上移植.doc_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一、环境1、 开发板内核:linux-2.6.28-omap2、 3G卡片:华为E1750二、相关工具1 usb-modeswitch-1.0.2.tar.bz2usb_modeswitch这个工具来进行3G模式转换2 libusb-0.1.12.tar.gzlibusb提供给usb_modeswitch一套系统API三、交叉编译1交叉编译libusb解压并进入libusb-0.1.12目录,建立子目录install用于存放最后生存的库文件与头文件。rootlibusb-0.1.12# mkdir install配置并生成Makefile文件rootlibusb-0.1.12# ./configure -build=i686-linux -host=arm-none-linux-gnueabi -prefix=/home/libusb-0.1.12/install rootlibusb-0.1.12# make rootlibusb-0.1.12# make install(我的交叉编译器是arm-none-linux-gnueabi,你的可能是arm-linux)2. 交叉编译usb_modeswitch(1)修改Makefile文件 CC = arm-none-linux-gnueabi(2)将libusb里的库头文件拷到交叉编译器的include和lib目录下(3)make(4)修改usb_modeswitch-1.0.2目录下的usb_modeswitch.conf文件# Huawei E1750DefaultVendor= 0x12d1DefaultProduct= 0x1446TargetVendor= 0x12d1TargetProduct= 0x1001# only for reference and 0.x versionsMessageEndpoint=0x01MessageContent=55534243123456780000000000000011060000000000000000000000000000HuaweiMode=03. 将上面生成的libusb动态库拷贝到文件系统的库目录下,将上面生成的usb_modeswitch可执行程序和usb_modeswitch.setup拷贝到文件系统/usr/sbin和/etc目录下。四、交叉编译3G卡片驱动在2.6.28内核源码中驱动/driver/usb/serial/ option.c中加入3G卡片的ID信息:#define HUAWEI_PRODUCT_E1750 0x1446Make menuconfig 选上编译这个文件的选项修改文件drivers/usb/storage/unusual_devs.h,去掉对移植网卡ID的屏蔽,关于此官方是这样说的:Kernel related issuesIn some newer kernels, certain device families (some Option, some Huawei, some ZTE as mentioned above) get a special treatment in the usb-storage code to enable switching right away. You would not need USB_ModeSwitch anymore for these specific dvices; on the other hand you have no choice of accessing the CD-ROM part of your device. Plus, there were cases when the special treatment brought no results and furthermore prevented USB_ModeSwitch to work properly afterwards (happened with ZTE devices, error -2). In case of trouble, look into unusual_devs.h in the drivers/usb/storage folder of your kernel source. If your default ID (vendor and product ID of the storage part) can be found there and you get errors when running USB_ModeSwitch, try first to blacklist usb-storage.If that helps, you should consider rebuilding your kernel with the entry in unusual_devs.h deactivated. The only thing that will happen is that usb-storage works in the default way afterwards.I found a tip in the Russian Gentoo wiki to do exactly what I just suggested for the ZTE MF626. 修改完内核后执行make uImage生成内核镜像文件五、利用usb_modeswitch进行模式转换移植完usb_modeswitch,libusb,更新内核后执行命令进行模式转换# ./usb_modeswitch c usb_modeswitch.conf执行后正常的话在/dev下生成了ttyUSB0、ttyUSB1、ttyUSB2等节点。执行lsusb命令就可以发现ID由0x1446变为0x1001.六、交叉编译pppd拨号工具,并编写拨号脚本1. 移植pppd拨号工具,并在内核里将相关的选项选上。a) 下载编译ppp-2.4.5解压b) 进入chat目录, 编译chat: make f Makefile.linux -host=arm-none-linux-gnueabi,生成chatc) 进入pppd目录, 编译pppd: make f Makefile.linux -host=arm-none-linux-gnueabi,生成pppd,可能会出现找不到pcap.h需要交叉编译libpcap后面有说明d) 将chat、pppd拷贝到/usr/sbin/目录e) 当服务器要求pppd给出用户身份认证信息的时候,如果协商采用PAP认证方式,pppd将到/etc/ppp/pap-secrets文件中取得用户口令;如果协商采用CHAP认证方式,则pppd将到/etc/ppp/chap-secrets文件中取得用户口令。因此需要对/etc/ppp/pap-secrets和/etc/ppp/chap-secrets做修改,修改PAP认证所需要的用户名密码,在文件/etc/ppp/pap-secrets中添加card * card *修改CHAP认证协议所需的用户名和口令,在文件/etc/ppp/ chap-secrets中添加card * card *下面介绍拨号脚本的编写:wcdma:nodetach#lock/dev/ttyUSB0#115200460800#user card#password card#crtscts#show-password#usepeerdnsnoauthnoipdefaultnovjnovjccompnoccpdefaultrouteipcp-accept-localipcp-accept-remoteconnect /usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect #persist#disconnect /usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-disconnectchat-wcdma-connect:ABORT NO CARRIERABORT ERRORABORT NO DIALTONEABORT BUSYABORT NO ANSWER /rATOK /rATZOK /rAT+CGDCONT=1,IP,3gnet,0,0OK-AT-OK ATDT*99#CONNECT /d/c chat-wcdma-disconnect:ABORT ERRORABORT NO DIALTONESAY /nSending break to the modem/n /K +ATHSAY /nGoodbay/n将wcdma、chat-wcdma-connect、chat-wcdma-disconnect三个文件拷贝到/home/filesys/etc/ppp/peers 目录下,在/etc/resolv.conf中添加DNS号Nameserver 51修改/etc/network/interfacds文件,设置网卡的工作模式如下:Auto eeth0 iface eth0 inet static address 2 network netmask broadcast 55 gateway 开始拨号root:/opt/3g# pppd call wcdma&拨号成功后会获得自动分配的IP地址Serial connection established.usb 1-1: pppd timed out on ep0outUsing interface ppp0Connect: ppp0 /dev/ttyUSB0PAP authentication succeededCould not determine remote IP address: defaulting to 4Cannot determine ethernet address for proxy ARPlocal IP address 0remote IP address 4ping 如能ping通,则说明移植成功。root:/opt/3g# ping PING (3) 56(84) bytes of data.64 bytes from 3: icmp_seq=1 ttl=54 time=367 ms64 bytes from 3: icmp_seq=2 ttl=54 time=320 ms64 bytes from 3: icmp_seq=3 ttl=54 time=300 ms64 bytes from 3: icmp_seq=4 ttl=54 time=310 ms64 bytes from 3: icmp_seq=5 ttl=54 time=330 ms交叉编译libpcap-0.9.5.tar.gz1. 声明环境变量:export PATH=/usr/local/arm/2.95.3/bin:$PATH2. 解压libpcap-0.9.5.tar.gz,cd进入目录,修改confiugre文件,把下面两段注释掉 #if test -z $with_pcap & test $cross_compiling = yes; then # echo $as_me:$LINENO: error: pcap type not determined when cross-compiling; use -with-pcap=. &5 #echo $as_me: error: pcap type not determined when cross-compiling; use -with-pcap=. &2; # (exit 1); exit 1; ; # f i . # if test $ac_cv_linux_vers = unknown ; then # echo $as_me:$LINENO: error: cannot determine linux version when cross-compiling &5 # echo $as_me: error: cannot determine linux version when cross-compiling &2; # (exit 1); exit 1; ; # fi3. 执行./configure -host=arm-linux,这样就会使用arm-linux-gcc进行configure,生成Makefile4. 修改Makefile的prefix项为prefix=/usr/local/arm/2.95.3/arm-linux,同时注意查看Makefile中的CC项,已经为arm-linux-gcc了,呵呵。5. 接下来make,make install,完成了libpcap的编译和安装,查看/usr/local/arm/2.95.3/arm-linux/include,该目录下增加了三个pcap的文件库编译 usbutils-0.90.tar.gz (包含lsusb工具)下载usbutils-0.90.tar.gz解压进入./configure CC=arm-none-linux-gnueabi-gcc -host=arm-none-linux-gnueabi LIBUSB_CFLAGS=/home/libusb-0.1.12/install/include LIBUSB_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论