imx6 yocto 3g模块移植

来源:互联网 发布:手机车牌识别软件 编辑:程序博客网 时间:2024/04/30 17:20

1.配置内核:

[*] Network device support  --->

       <*>   PPP (point-to-point protocol) support

       <*>     PPP BSD-Compress compression

        <*>     PPP Deflate compression

       [*]     PPP filtering

       <*>     PPP MPPE compression (encryption)

       [*]     PPP multilink support

       <*>     PPP over Ethernet

       <*>     PPP support for async serial ports

       <*>     PPP support for sync tty ports

 

[*] USB support  --->

       <*>     USB Modem (CDC ACM) support

 

[*] USB support  --->

    <*>   USB Serial Converter support  --->

              <*>   USB driver for GSM and CDMA modems

2.修改配置文件

vi <build-directory>/conf/local.conf

添加:

IMAGE_INSTALL_append += "ppp"


3.编译,烧写。


4.在/etc/新建文件ppp-on-dialer

写入内容:

TIMEOUT 5 '' AT OK AT+CGDCONT=1,"IP","CMNET" OK AT OK ATE0V1 OK AT OK
ATS0=0 OK AT OK ATE0V1 OK AT OK ATDT*99***1# CONNECT ''


5.创建sh脚本 3g.sh#!/bin/sh
#Closed other network
ifconfig eth0 down
ifconfig wlan0 down
pppd /dev/ttyUSB2 connect "chat -v -f /etc/ppp-on-dialer"
time=0
echo "Connected to 3G network"
dev=`ifconfig |grep "ppp0" |busybox cut -d: -f0 |busybox cut -d" " -f1`
while [ "$dev" != "ppp0" ] && [ $time -lt 10 ]
do
sleep 1
time=`expr $time + 1`
dev=`ifconfig |grep "ppp0" |busybox cut -d: -f0 |busybox cut -d" " -f1`
done
 
if  [ "$dev" == "ppp0" ]
then echo "Connection successful"
route add default gw 10.64.64.64 dev ppp0
ifconfig ppp0
else
echo "Connection failed,Please try again"
fi


6.插入3g模块


7.执行3g.sh脚本


8.修改dns,配置文件位置:/etc/resolv.conf,写入内容

nameserver 202.106.0.20


9,测试网络,ping www.baidu.com



0 0
原创粉丝点击