版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、嵌入式Linux 下3G 模块的驱动和应用1、开发资源、硬件资源:ZTE-mf637u中国联通ZTE-mu351中国移动、软件资源:、usb-modeswitch-1.1.3 libusb-0.1.12.tar.gzusb-modeswitch-1.1.3.tar.bz21.2.2、ppp-2.4.4 libpcap-0.9.8.tar.gzppp-2.4.4.tar.gz、wvdial、wvdial-1.54.0(arm-linux-gcc 3.4.1)zlib-1.2.5.tar.bz2openssl-0.9.7g.tar.gzopenssl-0.9.7g-fix_mans-1.patch
2、 wvstreams-4.0.1.tar.bz2wvstreams-4.0.1-tcl84-1.patch wvdial-1.54.0.tar.gz、wvdial_1.60.4(arm-linux-gcc 4.2.2)zlib-1.2.5.tar.bz2 openssl-0.9.8n.tar.gzopenssl-0.9.8n-fix_mans-1.patchwvstreams-4.6.1.tar.gzwvdial_1.60.4.tar.gz2、Linux 开发环境、主机环境linux系统Fedora Core 6、主机编译环境、gcc -v Using built-in specs.Targe
3、t: i386-redhat-linuxConfigured with: ./configure -prefix=/usr -mandir=/usr/share/man-infodir=/usr/share/info-enable-shared-enable-threads=posix-enable-checking=release -with-system-zlib -enable-cxa_atexit-disable-libunwind-exceptions-enable-libgcj-multifile-enable-languages=c,c+,objc,obj-c+,java,for
4、tran,ada -enable-java-awt=gtk-disable-dssi -enable-plugin -with-java-home=/usr/lib/jvm/java-1.4.2-gcj-/jre-with-cpu=generic -host=i386-redhat-linuxThread model: posixgccversion4.1.120221011(RedHat4.1.1-30)、/usr/local/arm/3.4.1/bin/arm-linux-gcc -vReading specs from /usr/local/arm/3.4.1/lib/gcc/arm-l
5、inux/3.4.1/specsConfigured with:/work/crosstool-0.27/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure-target=arm-linux -host=i686-host_pc-linux-gnu -prefix=/usr/local/arm/3.4.1-with-headers=/usr/local/arm/3.4.1/arm-linux/include-with-local-prefix=/usr/local/arm/3.4.1/arm-linux -disable-nls
6、-enable-threads=posix-enable-symvers=gnu -enable-cxa_atexit -enable-languages=c,c+ -enable-shared-enable-c99 -enable-long-longThread model: posixgcc version 3.4.1、/usr/local/arm/4.2.2/usr/bin/arm-linux-gccvUsing built-in specs.Target: arm-unknown-linux-gnueabiConfigured with:/home/scsuh/workplace/co
7、ffee/buildroot-20221011/toolchain_build_arm/gcc-4.2.2/configu re -prefix=/usr -build=i386-pc-linux-gnu -host=i386-pc-linux-gnu-target=arm-unknown-linux-gnueabi -enable-languages=c,c+-with-sysroot=/usr/local/arm/4.2.2-eabi/-with-build-time-tools=/usr/local/arm/4.2.2-eabi/usr/arm-unknown-linux-gnueabi
8、/bin-disable-cxa_atexit -enable-target-optspace -with-gnu-ld -enable-shared-with-gmp=/usr/local/arm/4.2.2-eabi/gmp-with-mpfr=/usr/local/arm/4.2.2-eabi/mpfr-disable-nls -enable-threads -disable-multilib -disable-largefile -with-arch=armv4t-with-float=soft -enable-cxx-flags=-msoft-floatThreadmodel:pos
9、ixgcc version 4.2.2、开发板环境、CES-6410开发平台Samsung S3C6410X, ARM1176JZF-S128MB,Mobile DDR SDRAMUSB HOSTUSB HOST 接口,USB2.0全速12Mbits/s3、Linux 应用软件的编译3.1、usb-modeswitch-1.1.3rootlocalhost cdma# tar xzf libusb-0.1.12.tar.gz rootlocalhost cdma# cp libusb-0.1.12 libusb-0.1.12-armrootlocalhostcdma#cdlibusb-0.1.
10、12-armrootlocalhost libusb-0.1.12-arm#./configure -prefix=/works/cdma/install-host=arm-linux CC=arm-linux-gcc CXX=arm-linux-g+rootlocalhost libusb-0.1.12-arm# make rootlocalhostlibusb-0.1.12-arm# make installrootlocalhost libusb-0.1.12-arm# cd .rootlocalhost cdma# tar xjf usb-modeswitch-1.1.3.tar.bz
11、2rootlocalhostcdma#cpusb-modeswitch-1.1.3usb-modeswitch-1.1.3-armrootlocalhost cdma# cd usb-modeswitch-1.1.3-armrootlocalhostusb-modeswitch-1.1.3-arm#修改 Makefile CC= gcc改为CC= arm-linux-gcc CFLAGS-Wall-lusb改为CFLAGS+= -Wall -l usb -I/works/cdma/install/include -L/works/cdma/install/lib修改 usb_modeswitc
12、h.c/readConfigFile(“/etc/usb_modeswitch.setup“);改为readConfigFile(“/etc/usb_modeswitch.setup“); rootlocalhost usb-modeswitch-1.1.3-arm# make rootlocalhost usb-modeswitch-1.1.3-arm# make install rootlocalhost usb-modeswitch-1.1.3-arm# cd . rootlocalhost cdma#3.2、ppp-2.4.4rootlocalhost cdma# tar xzf li
13、bpcap-0.9.8.tar.gz rootlocalhostcdma#cplibpcap-0.9.8libpcap-0.9.8-armrootlocalhost libpcap-0.9.8-arm# ./configure -prefix=/works/cdma/install-host=arm-linux-with-pcapmake:*Noruletomaketargetpcap-yes.o”,neededbylibpcap.a”.Stop.修改 MakefilePSRC =pcap-yes.c改为PSRC =pcap-linux.crootlocalhost libpcap-0.9.8
14、-arm# make libpcap-0.9.8-arm#makeinstallrootlocalhost libpcap-0.9.8-arm# cd .rootlocalhost cdma# tar xzvf ppp-2.4.4.tar.gzrootlocalhost cdma# cd ppp-2.4.4rootlocalhost ppp-2.4.4# ./configure -host=arm-linuxvi pppd/MakefileLIBS+=-lpcapCFLAGS+= -DPPP_FILTER改为LIBS+= -lpcap -L././libpcap-0.9.8CFLAGS+= -
15、DPPP_FILTER -I././libpcap-0.9.8rootlocalhost ppp-2.4.4# make CC=arm-linux-gcc、wvdial、wvdial-1.54.0rootlocalhostwvdial-1.54.0#exportPATH=/usr/local/arm/3.4.1/bin:$PATHrootlocalhostwvdial-1.54.0#tarxjfzlib-1.2.5.tar.bz2rootlocalhostwvdial-1.54.0#cdzlib-1.2.5rootlocalhost zlib-1.2.5#./configure -prefix
16、=/works/wvdial-1.54.0/installMakefileCC = arm-linux-gcc CPP=arm-linux-gcc -E AR=arm-linux-ar rc RANLIB=arm-linux-ranlibrootlocalhost zlib-1.2.5# make rootlocalhostzlib-1.2.5#makeinstallrootlocalhost wvdial-1.54.0# tar xzf openssl-0.9.7g.tar.gzrootlocalhost wvdial-1.54.0# cd openssl-0.9.7grootlocalho
17、st openssl-0.9.7g# patch -Np1-i ./openssl-0.9.7g-fix_mans-1.patchrootlocalhost openssl-0.9.7g#./Configure -prefix=/works/wvdial-1.54.0/installos/compiler:arm-linux-gccrootlocalhost openssl-0.9.7g# make rootlocalhost openssl-0.9.7g# make installrootlocalhost openssl-0.9.7g# cd .wvdial-1.54.0#tarxjfwv
18、streams-4.0.1.tar.bz2rootlocalhost wvdial-1.54.0# cd wvstreams-4.0.1rootlocalhostwvstreams-4.0.1#patch-Np1-i./wvstreams-4.0.1-tcl84-1.patch修改 configure with_openssl=no 改为with_openssl=yes有两处rootlocalhost wvstreams-4.0.1# ./configure -prefix=/works/wvdial-1.54.0/install-host=arm-linux CFLAGS=-I/works/
19、cdma/install/includeLDFLAGS=-L/works/cdma/install/lib/ -with-zlib=/works/cdma/zlib-1.2.5-with-openssl=/works/cdma/openssl-0.9.8n -without-dbus -with-pam=no -with-tcl=no-with-qt=norootlocalhostwvstreams-4.0.1#makelinking libwvutils.so./usr/lib/libz.so: could not read symbols: Invalid operationcollect
20、2: ld returned 1 exit statusmake: * libwvutils.so Error 1rootlocalhost wvstreams-4.0.1# arm-linux-gcc -L./xplc -L/works/cdma/install/lib/-L./xplc-L. -g-Wl,-soname,libwvutils.so.4.0 -shared -o libwvutils.so utils/strcrypt.o utils/verstring.o utils/wvaudioencoder.o utils/wvbase64.o utils/wvbdbhash.o u
21、tils/wvcrash.o utils/wvdiriter.o utils/wvgzip.o utils/wvhashtable.o utils/wvhex.o utils/wvmagiccircle.o utils/wvmatrix.o utils/wvqdbmhash.o utils/wvrateadjust.o utils/wvserialize.o utils/wvshmzone.o utils/wvstringtable.o utils/wvsubproc.o utils/wvtest.outils/wvwordwrap.o libwvbase.so-lsupc+ -lgcc_eh
22、rootlocalhost wvstreams-4.0.1# make wvstreams-4.0.1#viwvrules.mkXX_LIBS := $(XX_LIBS) $(shell $(CC) -lsupc+ -lgcc_eh 2&1 | grep -q “undefinedreference“ & echo “ -lsupc+ -lgcc_eh“)改为XX_LIBS := $(XX_LIBS) $(shell $(CC) -lsupc+ -lgcc_eh 2&1 | grep -q “undefinedreference“ & echo “ -lz -lcrypt -lsupc+ -l
23、gcc_eh“)rootlocalhostwvstreams-4.0.1#makecompiling crypto/wvtripledes.o.crypto/wvtripledes.cc: In member function virtual bool WvTripleDESEncoder:_encode(WvBuf&, WvBuf&, bool)”:crypto/wvtripledes.cc:108: error: cannot convert const unsigned char*” to unsigned char (*)8” for argument 1” to void DES_e
24、cb3_encrypt(unsigned char (*)8, unsigned char (*)8, DES_key_schedule*, DES_key_schedule*, DES_key_schedule*, int)”make: * crypto/wvtripledes.o Error 1解决方法: crypto/wvtripledes.cc修改#if OPENSSL_VERSION_NUMBER = 0 x0090705FL改为#if 0compilingcrypto/wvx509.o.crypto/wvx509.cc: In member function WvString Wv
25、X509Mgr:get_extension(int)”:crypto/wvx509.cc:1168:error:invalidconversionfromunsignedchar*”toconst unsigned char*”crypto/wvx509.cc:1171: error: invalid conversion from unsigned char*” to const unsigned char*”make: * crypto/wvx509.o Error 1解决方法:crypto/wvx509.ccif (method-it)ext_data = ASN1_item_d2i(N
26、ULL, &ext-value-data,ext-value-length, ASN1_ITEM_ptr(method-it);elseext_data = method-d2i(NULL, &ext-value-data,ext-value-length);改为if (method-it)ext_data=ASN1_item_d2i(NULL,(constunsignedchar*)&ext-value-data,ext-value-length, ASN1_ITEM_ptr(method-it);elseext_data = method-d2i(NULL, (const unsigned
27、 char*)&ext-value-data,ext-value-length);compilingstreams/wvpam.o.InmemberfunctionboolWvPam:authenticate(constWvFastString&, const WvFastString&, const WvFastString&)”:streams/wvpam.cc:71: error: fail” undeclared (first use this function) streams/wvpam.cc:71:error:(Eachundeclaredidentifierisreported
28、onlyoncefor each function it appears in.) make: * streams/wvpam.o Error 1解决方法:return fail;改为return false;rootlocalhostwvstreams-4.0.1# makeinstallrootlocalhost wvstreams-4.0.1# cp libwvutils.so ./install/lib/libwvutils.so.4.0 -arootlocalhost wvstreams-4.0.1# cd .rootlocalhostwvdial-1.54.0#tarxzfwvdi
29、al-1.54.0.tar.gzrootlocalhost wvdial-1.54.0# cd wvdial-1.54.0rootlocalhostwvdial-1.54.0#cp .rootlocalhost wvdial-1.54.0# vi Makefile PREFIX=/usr/local改为PREFIX=/works/wvdial-1.54.0/installPPPDIR=/etc/ppp/peers改为PPPDIR=$PREFIX/etc/ppp/peersXPATH=. ./wvstreams/include $(PKGINC)改为XPATH=/works/wvdial-1.5
30、4.0/install/include/wvstreamsLIBS+=-L./wvstreams-lwvutils-lwvstreams改为LIBS += -L/works/wvdial-1.54.0/install/lib -lwvutils -lwvstreams -lwvbase -lzrootlocalhost wvdial-1.54.0# vi wvrules.mk增加CC = arm-linux-g+ CXX = arm-linux-g+rootlocalhost wvdial-1.54.0# make rootlocalhost wvdial-1.54.0# make insta
31、ll、wvdial-1.60.4exportPATH=/usr/local/arm/4.2.2-eabi/usr/bin:$PATHtarxjf zlib-1.2.5.tar.bz2cd zlib-1.2.5./configure -prefix=/works/cdma/install-4.2.2修改 MakefileCC=arm-linux-gccCPP=arm-linux-gcc -EAR=arm-linux-arrc.RANLIB=arm-linux-ranlib makemake installopenssl-0.9.8npatch -N-p1-i./openssl-0.9.8n-fi
32、x_mans-1.patch./Configure -prefix=/works/cdma/install-4.2.2os/compiler:arm-linux-gcc makemake installwvstreams-4.6.1configurewith_zlib=no改为with_zlib=yes有两处with_openssl=no 改为with_openssl=yes有两处./configure -prefix=/works/cdma/install-4.2.2 -host=arm-linuxCPPFLAGS=-I/works/cdma/install-4.2.2/includeLDF
33、LAGS=-L/works/cdma/zlib-1.2.5-4.2.2 CFLAGS=-I/works/cdma/zlib-1.2.5-4.2.2-with-zlib=/works/cdma/zlib-1.2.5-4.2.2/-with-openssl=/works/cdma/openssl-0.9.8n-4.2.2 -without-dbus -with-pam=no-with-tcl=no -with-qt=no -without-valgrindmake假设消灭 undefined reference to“EVP_MD_size“错误将消灭错误的语句 return EVP_MD_siz
34、e(evp_md_st *)evpmd;改成 return(evp_md_st*)evpmd)-md_size;即可makeinstallwvdial-1.60.4 修改 Makefile prefix=/usr/local改为prefix=/works/cdma/install-4.2.2PPPDIR=/etc/ppp/peers改为PPPDIR=$prefix/etc/ppp/peersPC_CFLAGS=$(shell pkg-config -cflags libwvstreams)改为PC_CFLAGS=-I/works/cdma/install-4.2.2/include/wvstr
35、eamsPC_LIBS=$(shellpkg-config-libslibwvstreams)PC_LIBS=-L/works/cdma/install-4.2.2/lib -lwvstreams -lwvutils -lwvbase修改 wvrules.mk WVLINK_CC = gcc改为WVLINK_CC = arm-linux-g+CC=arm-linux-g+CXX=arm-linux-g+makemake install4、Linux 内核的配置与修改、linux 内核配置make menuconfig Device Drivers-* Network device suppor
36、t-PPP(point-to-pointprotocol)support*PPP multilink support (EXPERIMENTAL)*PPP filteringPPP support for async serial portsPPP support for sync tty portsPPPDeflatecompressionPPP MPPE compression (encryption) (EXPERIMENTAL)PPPoverEthernet(EXPERIMENTAL)* USB support-USBModem(CDCACM)supportUSBSerialConve
37、rtersupport-USB driver for GSM and CDMA modems、linux内核修改drivers/usb/serial/option.cstatic struct usb_device_id option_ids = ;在这个数组中添加两项 USB_DEVICE(0 x19d2, 0 x0031) , USB_DEVICE(0 x19d2, 0 x0034) ,、linux 内核编译make zImage make modules5、3G模块的使用、加载内核模块insmod option.ko insmod cdc-acm.koinsmod slhc.koinsm
38、od ppp_generic.ko insmod pppox.ko insmod pppoe.ko insmod ppp_synctty.ko insmod ppp_deflate.ko insmod crc-ccitt.ko insmod ppp_async.ko insmod sha1_generic.koinsmod ppp_mppe.koUSB文件系统mount -t usbfs usbfs /proc/bus/usb、ZTE-mf637u中国联通的使用、配置文件/etc/usb_modeswitch.setup#Configurationfortheusb-modeswitchpac
39、kage,amodeswitchingtoolfor# USB devices providing multiple states or modes# This file is evaluated by the wrapper script “usb_modeswitch“ in /lib/udev# To enable an option, set it to “1“, “yes“ or “true“ (case doesn”t matter)# Everything else counts as “disable“# Disable automatic mode switching glo
40、bally (e.g. to access the original# install storage)DisableSwitching=0# Enable logging (results in a extensive report file in /var/log, named# “usb_modeswitch_“EnableLogging=0# # ZTE MF622 (aka “Onda MDC502HS“)#ZTEMF626# ZTE MF628+ (tested version from Telia / Sweden)# ZTE MF633# ZTE MF636 (aka “Tel
41、stra / BigPond 7.2 Mobile Card“)# ZTE MF637# Contributor: Joakim Wennergren and othersDefaultVendor=0 x19d2DefaultProduct= 0 x2022TargetVendor=0 x19d2TargetProduct=0 x0031MessageContent=“5553424312345678000000000000061b0000000202200000000 00000000000“MessageContent2=“5553424312345678000000000000061b
42、000000030000000000 000000000000“NeedResponse=1、配置文件/etc/wvdial.confDialerDefaultsModem=/dev/ttyUSB2Init1=ATZInit3 = ATE0V1Init5 = ATS0=0Init6=AT+CGDCONT=1,“IP“,“uninet“Init7 = AT+CFUN=1ModemType=USBModemBaud = 460800New PPPD = yesISDN = 0Phone = *99*1#Password = anyUsername = anyStupidMode=1ZTE-mf63
43、7u中国联通的操作步骤、设置环境变量/works/wvdial-1.54.0/install/bin:/works/cdma/install/bin:$PATHexportLD_LIBRARY_PATH=/works/wvdial-1.54.0/install/lib:/works/cdma/install/lib:$LD_LIBRARY_PATH、插入ZTE-mf637u中国联通无线网卡5 秒钟左右、运行usb-modeswitch -W、运行wvdial- WvDial: Internet dialer version 1.54.0- Cannot open /dev/ttyUSB2: C
44、annot get information for serial port.- Cannot open /dev/ttyUSB2: Cannot get information for serial port.- Cannot open /dev/ttyUSB2: Cannot get information for serial port.解决:(两种方法)将 wvstreams-4.0.1/streams/wvmodem.cc#if HAVE_LINUX_SERIAL_H改为#if0.2. wvstreams-4.0.1 的配置命令增加ac_cv_header_linux_serial_h
45、=no即./configure -prefix=/works/wvdial-1.54.0/install -host=arm-linux CFLAGS=-I/works/cdma/install/include LDFLAGS=-L/works/cdma/install/lib/-with-zlib=/works/cdma/zlib-1.2.5 -with-openssl=/works/cdma/openssl-0.9.8n-without-dbus -with-pam=no -with-tcl=no -with-qt=no ac_cv_header_linux_serial_h=no重编译。
46、、ZTE-mu351中国移动的使用、配置文件/etc/wvdial.confModem/dev/ttyACM2Init1 = ATZ Init3=ATE0V1Init5=ATS0=0Init6=AT+CGDCONT=1,“IP“,“cmnet“Init7 = AT+CFUN=1Modem Type = USB ModemBaud=460800New PPPD = yesISDN = 0Phone = *99*1#Password = any Username = anyStupidMode=1、ZTE-mu351中国移动的操作步骤、设置环境变量export PATH=/root/cdma:$P
47、ATHexport LD_LIBRARY_PATH=/root/cdma:$LD_LIBRARY_PATH、插入ZTE-mu351中国移动无线网卡5 秒钟左右、运行eject /dev/sr0。 也可以使用此方法、运行wvdial- WvDial: Internet dialer version 1.54.0- Initializing modem.- Sending: ATZATZOK- Sending: ATE0V1ATE0V1OK- Sending: ATS0=0OK-Sending:AT+CGDCONT=1,“IP“,“cmnet“OK- Sending: AT+CFUN=1OK-Modeminitialized.- Sending: ATDT*
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年江西农商联合银行金融科技人才招聘25人笔试历年典型考题及考点剖析附带答案详解
- 地理模拟试题及答案
- 应力模拟测试题及答案
- “尚志赋能·强基领航”项目经理后备人才训练营培训考核测试卷及答案
- 2026电站知识考试题及答案大全
- 2026电梯证考试题库及答案
- 2026电石炉考试题及答案
- 2026电气系统笔试试题及答案
- 2026电路实操考试题及答案
- 2026电力竞聘考试题目及答案
- 骨关节炎康复课件
- 2025年高级经济师知识产权考试历年模拟试题及答案
- 2025年中国电力电子散热器市场调查研究报告
- 局中层干部考核管理办法
- 夏季养生健康知识讲座
- 2025年中国电源散热器配件市场调查研究报告
- 人教版六年级数学下册第四单元比例质量提升卷及答案
- 处方流转与电子处方管理制度
- 国家安全教育大学生读本-第一章完全准确领会总体国家安全观
- 《建筑施工土石方工程安全技术规范》JGJ180
- GB/T 19822-2024铝及铝合金硬质阳极氧化膜规范
评论
0/150
提交评论