linux下GPRS模块ppp拨号上网
来源:互联网 发布:数据库模型图多对多 编辑:程序博客网 时间:2024/05/17 07:30
交叉编译器:arm-linux-gcc-4.5.4
Linux内核版本:Linux-3.0
主机操作系统:Centos 6.5
开发板:FL2440
GPRS:SIM900A
在开发SIM900模块之前,开发板已经加载了linux内核以及文件系统,并且开发板串口已经使能。并且一定要注意的是:要有一张没有欠费的电话卡!不要笑,这是个很严肃的问题!
------------------------------------------------------------------------------------------------------------------------------
所需源码:
ppp-2.4.4.tar.gz http://download.chinaunix.net/download.php?id=35208&ResourceID=8334
注:个人觉得这是一个比较典型又比较简单的移植问题。
大体步骤:添加内核ppp上网的支持-->编译ppp-2.4.4生成一些可执行文件(pppd, chat, pppdump, pppstats)放到开发板的/usr/sbin/目录下-->将可执行脚本放在开发板的指定位置(/etc/ppp/peers/gprs, /etc/ppp/chat-gprs-connect),并执行pppd命令。
一、添加内核支持
Linux-3.0以上的版本中,rt3070的驱动已经加入了内核源码中去了,本篇用的是Linux-3.0的内核,只需要在内核的make menuconfig中选择ppp上网的支持就可以了。
修改如下:
Device Drivers --->
[*] Network device support --->
<*> PPP (point-to-point protocol) support
[*] PPP multilink support (EXPERIMENTAL)
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
<*> SLIP (serial line) support
[*] CSLIP compressed headers
二、编译ppp-2.4.4
# tar -xzf ppp-2.4.4.tar.gz
# ./configure
# make CC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc (交叉编译器)
如果编译成功,则会在pppd, chat, pppdump, pppstats下分别生成可执行程序pppd, chat, pppdump, pppstats。将其拷贝到开发板的/usr/sbin目录下。
三、开发板的配置
# vi /etc/ppp/peers/gprs
1 # Usage: root>pppd call gprs 2 3 #set seriral 4 /dev/ttyS1 5 6 # set baudrate 7 115200 8 9 # set flowdate10 nocrtscts11 12 connect '/usr/sbin/chat -v -f /etc/ppp/gprs-connect-chat'13 14 #set debug ,send message to /var/log/messages15 debug16 17 #To keep pppd on the terminal18 nodetach19 20 #hide-password21 22 # Accept the peer's idea of our local IP address23 ipcp-accept-local24 # Accept the peer's idea of its (remote) IP address25 ipcp-accept-remote26 27 #dial up connetion as the default route28 defaultroute29 30 usepeerdns
# vi /etc/ppp/chat-gprs-connect
1 #Copyright (c) 2016 guanlei 995318056@qq.com 2 # This is second part of the ppp dial script. It will perform the connection 3 # 4 ABORT 'BUSY' 5 ABORT 'NO ANSWER' 6 ABORT 'NO CARRIER' 7 ABORT 'NO DIALTONE' 8 ABORT 'ERROR' 9 ABORT '\nRING\r\n\r\nRING\r'10 TIMEOUT 2011 '' \rAT12 #set apn13 OK AT+CGDCONT=1,"IP","cmnet"14 # ............15 OK ATDT*99***1# //这里要改成相应的运行商的设置16 SAY " + requesting data connection\n"17 CONNECT ''18 SAY " + connected\n"
使能pppd:
# pppd call gprs & (&表示后台运行)
配置完就可以了,现在可以测试一下上网功能了:
# ping www.baidu.com
PING www.baidu.com (103.235.46.39): 56 data bytes
64 bytes from 103.235.46.39: seq=0 ttl=48 time=555.719 ms
64 bytes from 103.235.46.39: seq=1 ttl=48 time=273.481 ms
--- www.baidu.com ping statistics ---
3 packets transmitted, 2 packets received, 33% packet loss
round-trip min/avg/max = 273.481/414.600/555.719 ms
# ifconfig
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.110.1.110 P-t-P:192.200.1.21 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:686 (686.0 B) TX bytes:557 (557.0 B)
- gprs模块在linux下ppp拨号上网
- linux下GPRS模块ppp拨号上网
- linux gprs模块 sim900芯片 ppp拨号上网
- linux gprs模块 sim800a 芯片 ppp拨号上网
- linux gprs模块 sim800a 芯片 ppp拨号上网
- arm9+linux fl2440 GPRS SIM卡 模块 ppp拨号上网
- Linux下利用ppp-on脚本进行GPRS拨号上网
- Linux下利用ppp-on脚本进行GPRS拨号上网
- Linux下利用ppp-on脚本进行GPRS拨号上网
- sim900芯片—GPRS模块ppp拨号上网
- sim900芯片—GPRS模块ppp拨号上网
- sim900芯片—GPRS模块ppp拨号上网
- linux GPRS模块拨号上网
- GPRS模块在Linux平台上ppp拨号上网总结与心得
- GPRS模块在Linux平台上ppp拨号上网总结与心得
- GPRS模块在Linux平台上ppp拨号上网总结与心得
- GPRS模块在Linux平台上ppp拨号上网总结与心得
- GPRS模块在Linux平台上ppp拨号上网总结与心得
- 限制篇(5.2)-06. 为视频会议保留带宽 ❀ 飞塔 (Fortinet) 防火墙
- android的activity之间传递数据
- Python练习实例12
- Fragment全解析系列(二):正确的使用姿势
- 矩阵乘法运算
- linux下GPRS模块ppp拨号上网
- Fragment之我的解决方案:Fragmentation
- 水平轮播
- python下的正则表达式学习
- 游戏开发中常用的对象池构建(含源码)
- HTML5到底是什么?为什么要用HTML5?
- java面试题汇总记录
- mosquitto中auth-plug的mysql认证与授权
- GRE语文数学考题分布详解