#.configure
#make CC=/Software/arm-jyxtec-linux-gnueabi/bin/arm-linux-gcc(指定交叉编译路径)
(4) 编译成功后,将PPP套件安装至嵌入式系统中。
cp $(ppp-2.4.7)/chat/chat /home/roofs/bin
cp $(ppp-2.4.7)/pppd/pppd /home/roofs/bin
cp $(ppp-2.4.7)/pppdump/pppdump /home/roofs/bin
cp $(ppp-2.4.7)/pppstats/pppstats /home/roofs/bin
(/home/roofs/bin为笔者的嵌入式根文件系统共享的NFS所在位置的bin目录)
(5) 在嵌入式文件系统的etc目录下创建ppp文件夹,并拷贝相关文件至此。
(/home/bruce/samba_share/etc)#mkdir ppp
(/home/bruce/samba_share/etc)#cp $(ppp-2.4.7)/etc.ppp/* /home/roofs/etc/ppp
#!/bin/sh
#define dial_on function
dial_on()
{
#test if pppd is running
pppd_stat=`ifconfig|grep ppp|wc -l|cut -b 7-7`
if [ $pppd_stat -gt 0 ]
then
echo "ppp connection's already started."
else
#close ethernet interface
ifconfig eth0 down
#ppp start
pppd modem /dev/ttySAC1 115200 nocrtscts lock connect "chat -v -f /etc/ppp/gprs-connect" user "" noauth debug defaultroute
# pppd配置说明:
# ttyS1:连接GPRS模块SIM900的串口
# 115200:GPRS的拨号速率
# nocrtscts:无流控
# lock:锁定设备
# connect “chat ???? ???? /etc/ppp/gprs-connect”:GPRS连接脚本文件
# user “”:用户名,这里是无
# noauth:无需认证
# debug:输出调试信息
# defaultroute:此拨号连接作为默认路由
echo "ppp is starting"
fi
}
#dial on gprs
dial_on
#wait for ppp's init
sleep 5
pppd_stat=`ifconfig|grep ppp|wc -l|cut -b 7-7`
if [ $pppd_stat -eq 0 ]
then
echo "trying 2nd time to call ppp"
dial_on
sleep 5
fi
pppd_stat=`ifconfig|grep ppp|wc -l|cut -b 7-7`
if [ $pppd_stat -eq 0 ]
then
echo "pppd error!"
echo "please check pppd's config files"
fi
#open ethernet interface
ifconfig eth0 up
#end
TIMEOUT 30
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO CARRIER"
'' AT
OK ATS0=0
OK ATE0V1
OK AT+CGDCONT=1,"IP","CMNET"
OK ATD*99***1#
CONNECT ''