3G ril

飞思卡尔i.MX 6Quad Android 4.2.2的中兴和Ublox 3G驱动移植

返回脚本百事通

 

1      概述

平台:freescale i.MX 6Quad 4核开发板Sabre-sd(不带屏幕)

操作系统:Android 4.2.2_r1(代码补丁为android_jb4.2.2_1.1.0-ga_source)

内核:3.0.35

3G模块:中兴MG3732UbloxLISA-U130

 

2      中兴MG3732模块移植

2.1    准备

准备一张可用的联通3G卡,放入SIM卡卡槽,接着把中兴MG3732开发板通过usb连接到主板上。

 

2.2    移植步骤

1)  拷贝基于android4.2的libztewcdma-ril.so文件到 /system/lib目录下

2)  在/driver/usb/serial/option.c中添加pid,vid如下:

                  { USB_DEVICE(0x19d2, 0xffff) },
                   {USB_DEVICE(0x19d2, 0xfffe) },
                   {USB_DEVICE(0x19d2, 0xfffd) },
                   {USB_DEVICE(0x19d2, 0xfffc) },
                   {USB_DEVICE(0x19d2, 0xfffb) },
                   {USB_DEVICE(0x19d2, 0xfff1) },
                   {USB_DEVICE(0x19d2, 0xfff6) },
                   {USB_DEVICE(0x19d2, 0xfff7) },
                   {USB_DEVICE(0x19d2, 0xfff8) },
                   {USB_DEVICE(0x19d2, 0xfff9) },
                   {USB_DEVICE(0x19d2, 0xffee) },
                   {USB_DEVICE(0x19d2, 0xffed) },
                   {USB_DEVICE(0x19d2, 0xffeb) },
                   {USB_DEVICE(0x19d2, 0xffec) },


3)  拷贝chat, pppd到/system/bin目录下,确保/system/bin 目前下有pppd 和chat 两个程序,且可以运行

4)  添加ip-up到/system/ppp/目录下

5)  在init.rc文件中添加

 

chmod 0755  /system/lib/libztewcdma-ril.so
chown root  /system/bin/pppd
chmod 4755  /system/bin/pppd
 
service ril-daemon /system/bin/rild -l /system/lib/libztewcdma-ril.so -- -d  /dev/ttyUSB0
    class main
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    user root
    group radio cache inet misc

6)  配置menuconfig如下:

 

[*] Network device support  --->
        <*>   PPP (point-to-point protocol) support
        [*]     PPP multilink support (EXPERIMENTAL)
        [*]     PPP filtering
        <*>     PPP support for async serial ports
        <*>     PPP support for sync tty ports
        <*>     PPP Deflate compression
        <*>     PPP BSD-Compress compression
        <*>     PPP MPPE compression (encryption)(EXPERIMENTAL)
        <*>     PPP over Ethernet (EXPERIMENTAL)
        <*>     PPP over L2TP (EXPERIMENTAL)

2.3    调试过程

1、  进入android系统后,首先查看模块的端口是否识别,如果能正确识别的话,可以看到以下4个端口:

/dev/ttyUSB0
/dev/ttyUSB1
/dev/ttyUSB2
/dev/ttyUSB3
 

在调试过程中,发现Log出现此句错误:

usb1-1: device v19d2 pffeb is not supported

 说明modem模块没有被识别到,但此时已在option.c中添加了这个设备属性:

{ USB_DEVICE(0x19d2, 0xffeb) }

所以怀疑可能是usb的问题。

因sabre-sd开发板只有1个usb-otg接口,没有普通的usb口,我尝试用飞线重新飞了一个普通usb口出来,把中兴3G模块接到这个普通的usb口上,这句错误log就没有再出现了。

 

2、  在系统启动后,发现log打印:

I/RIL     ( 2308): 3G modemmonitor thread is start
I/RIL     ( 2308): Opening ttydevice /dev/ttyUSB0
I/RIL     ( 2308): Runtime 3Gcan't find supported modem
E/RILC    ( 2308):RIL_register: RIL version 7
E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...
E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...
E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...

这些log信息是在libreference-ril.so中打印的,说明系统没有调用到libztewcdma-ril.so文件。

后查看hardware/ril/rild/rild.c文件的源码,发现问题出现在main函数的switch(modem_type)语句段中。

解决方法是把switch(modem_type)语句段注释掉,重新编译rild可执行程序,即可正常地调用到libztewcdma-ril.so文件。

 

 

3、  注意设置ril-daemon的端口为/dev/ttyUSB0,否则rild进程无法启动,在

logcat –b radio中会显示以下错误:

I/RILJ   ( 2392): Couldn't find 'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout

4、  在调试过程中,模块可以拨打电话,但无法上网,用ps命令未发现pppd进程,log如下:

D/RILJ    ( 2369): 0: [77] SETUP_DATA_CALL 
E/RILD    ( 2135): get exit sig 17 
E/RILD    ( 2135): checkPPPConnection: pid_exit == 1 
E/RILD    ( 2135): checkPPPConnection: interface[ppp0]information is not found 
E/RILD    ( 2135): start_pppd:   failed to check PPP interfaceUP 
E/RILD    ( 2135): EVENT_PPPD_MANAGER_PPPD_EXIT 
E/RILD    ( 2135): pppd exit. status = 1024 
E/RILD    ( 2135): pppd exit . no restart pppd . 
E/RILD    ( 2135): SetupDefaultPDP failed. 

说明pppd进程启动失败。

后发现是pppd权限问题导致,解决方法如下:

启动系统后,在adb中执行以下命令修改pppd权限:

chown root  /system/bin/pppd
chmod 4755 /system/bin/pppd

若系统是只读属性,需用remount命令重新挂载文件系统:

mount –o remount,rw /dev/block/mmcblk0p5 /system/


3      ublox LISA-U130模块移植

3.1    准备

准备一张可用的联通3G卡,放入SIM卡卡槽,接着把ublox u130开发板通过usb连接到主板上。

3.2    移植步骤

1)  解压ublox提供的android4.2的3g驱动压缩文件如下:

RIL_sc_<version>.zip
ril_sc_<version>                                Sourceoverlay for Android Platform
       build/target/product                     Device configuration folder files
       external/ppp/                            Data connection files
       hardware/gsm0710muxd                     Channel multiplexer
       hardware/ril/ublox_ril/                  RIL core directory
       system/core/rootdir/Android.mk           Compilation script
       system/core/init/property_service.c      Set RIL services property
       system/core/liblog/logd_write.c          Log configuration files


 

2)  把相关文件拷贝到android源码中

cp –pvRf  ril_sc_<version>/external/ppp/  <android_root>/external/ppp
cp –pvRf  ril_sc_<version>/hardware/ril/ublox_ril  <android_root>/hardware/ril/
cp –pvRf  ril_sc_<version>/system/*  <android_root>/system
cp –pvRf  ril_sc_<version>/build/*  <android_root>/build

3)  在device/fsl/imx6/AndroidProducts.mk中添加:

RIL_COM_INTERFACE := usb

4)  在init.rc文件中添加如下语句:

    

       # Changepermissions for modem
           chmod 0660 /dev/ttyACM0
           chown radio radio /dev/ttyACM0
           chmod 0660 /dev/ttyACM1
           chown radio radio /dev/ttyACM1
           chmod 0660 /dev/ttyACM2
           chown radio radio /dev/ttyACM2
 
      # Set permissions for u-blox RILRepository
           chown radio radio /system/etc/rril
           chmod 0770 /system/etc/rril
           chown radio radio/system/etc/rril/repository.txt
           chmod 0660 /system/etc/rril/repository.txt
 
      # Set u-blox RIL repository state
           setprop net.rril.repository notready
 
      # Prepare u-blox RIL repository
      service uril-repo /system/bin/uril-repo.sh
           user root
           group radio
           oneshot
 
      # Load u-blox RIL
      service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so -- -a /dev/ttyACM0 -n /dev/ttyACM1
           class main
           socket rild stream 660 root radio
           socket rild-debug stream 660 radiosystem
           user root
           group radio cache inet misc audio
 
      service pppd_data0/system/bin/init.gprs-pppd
           user root radio
           group radio cache inet misc
           disabled
           oneshot
 
      service pppd_data1/system/bin/init.gprs-pppd
           user root radio
           group radio cache inet misc
           disabled
           oneshot
 
      service pppd_term /system/bin/stop_pppd15
           class main
           disabled
           oneshot
 
      service pppd_kill /system/bin/stop_pppd 9
           class main
           disabled
            oneshot

5)  配置menuconfig如下:

DeviceDrivers
          USB Support
              <*>USB Modem (CDC ACM)support
 
DeviceDrivers
          Network device support
              <*>PPP (point-to-pointprotocol) support
              <*>PPP support for asyncserial ports
              <*>PPP support for sync ttyports
                     <*>PPP Deflate compression
 


6)  重新编译系统,确保生成以下文件

/system/lib/librapid-ril-core.so
/system/lib/librapid-ril-util.so
/system/lib/librapid-ril-oem.so
 
/system/bin/pppd
/system/bin/chat
 
/system/bin/init.gprs-pppd
/system/bin/ip-down
/system/bin/ip-up
/system/bin/stop_pppd
/system/bin/rril-repo.sh
 
/system/etc/uril/repository.txt
 
/system/etc/ppp/ chap-secrets
/system/etc/ppp/ chat-isp1
/system/etc/ppp/ chat-isp2
/system/etc/ppp/ ip-down-ppp0
/system/etc/ppp/ ip-up-ppp0
/system/etc/ppp/ ip-up-vpn
/system/etc/ppp/pap-secrets
 
/system/etc/ppp/peers/gprs1
/system/etc/ppp/peers/gprs2
 

3.3    调试过程

1、  启动系统后,确保3G模块端口可以被系统识别:

/dev/ttyACM0
/dev/ttyACM1
/dev/ttyACM2
/dev/ttyACM3
/dev/ttyACM4
/dev/ttyACM5
 

2、  用ps命令查看rild进程是否启动,如果已启动,此时一般拨打电话是没问题的。

3、  在调试过程中发现不能上网,用ps命令查看,发现pppd进程未启动。在adb中用logcat –b radio查看日志发现有两处错误:

 

第一处错误:

E/RILR    ( 2109):CRepository::OpenRepositoryFile() - ERROR: Could not open file"/data/rril/repository.txt" - No such file or directory


第二处错误:

I/pppd.gprs( 3262): Configure pppd securityoptions 
I/pppd.start( 3271): Starting pppd 
E/pppd    ( 3272): unrecognizedoption 'gprs1'
I/pppd.start( 3279): pppd exited with2 
 

第一处错误could not find /data/rril/repository.txt的原因是/system/bin/uril-repo.sh脚本未得到执行,解决方法是修改/system/bin/uril-repo.sh的权限,以及在init.rc中添加servicerril-repo的class属性:

# Prepare u-blox RIL repository
service uril-repo /system/bin/uril-repo.sh
class main
user root
group radio
oneshot

第二处错误unrecognizedoption 'gprs1'的原因是执行/system/bin/init.gprs-pppd脚本时出错,$ppp_usr为空字符串时,脚本执行以下语句:

----------------------------------------------------------------------

/system/bin/pppd user $ppp_usr call gprs$(( $ppp_if + 1 ))

=

/system/bin/pppd user call gprs1

 

----------------------------------------------------------------------

此语句执行失败,所以pppd进程无法启动。

 

修改后的正确的脚本为:

case $ppp_auth in 
0) 
/system/bin/log -t pppd.start "/system/bin/pppd call gprs$(( $ppp_if+ 1 ))"
/system/bin/pppd call gprs$(( $ppp_if + 1 )) 
;; 
*) 
 
if [ "$ppp_usr" = "" ];then
/system/bin/log -t pppd.start "/system/bin/pppd call gprs$(( $ppp_if+ 1 ))"
/system/bin/pppd call gprs$(( $ppp_if + 1 )) 
else
/system/bin/log -t pppd.start "/system/bin/pppd user $ppp_usr callgprs$(( $ppp_if + 1 ))"
/system/bin/pppd user $ppp_usr call gprs$(( $ppp_if + 1 )) 
fi
 

4、  在android 4.2上作了以上修改后,发现pppd进程还未能启动,经检测,发现/system/bin/init.gprs-pppd文件未能得到执行,相关的服务在init.rc中的:

service pppd_data0 /system/bin/init.gprs-pppd
           user root radio
           group radio cache inet misc
           disabled
           oneshot


Disabled表示服务暂停执行,等待property_set("ctl.start", "pppd_data0")的时候才执行,说明可能是初始化系统的时候出现了问题。

我重新编译system/core/init目录,发现不能编译通过,报错如下:

undefined reference to watchdogd_main

因/system/core/init/property_service.c和/system/core/init/Android.mk文件都是ublox驱动文件修改过的,所以我仔细查看这两个文件,发现是Android.mk文件出现问题,ublox提供的Android.mk文件是针对android 4.1的,并不是4.2,在LOCAL_SRC_FILES中缺少了watchdogd.c文件,修改Android.mk文件如下:

1)    在LOCAL_SRC_FILES中添加watchdogd.c

2)      在SYMLINKS中添加$(TARGET_ROOT_OUT)/sbin/watchdogd

然后重新编译system/core/init,生成root/init程序,pppd进程即可成功启动,并可使用3G网络。

#########








飞思卡尔i.MX 6Quad Android 4.2.2的中兴和Ublox 3G驱动移植

分类: Android 1102人阅读 评论(1) 收藏 举报

 

1      概述

平台:freescale i.MX 6Quad 4核开发板Sabre-sd(不带屏幕)

操作系统:Android 4.2.2_r1(代码补丁为android_jb4.2.2_1.1.0-ga_source)

内核:3.0.35

3G模块:中兴MG3732UbloxLISA-U130

 

2      中兴MG3732模块移植

2.1    准备

准备一张可用的联通3G卡,放入SIM卡卡槽,接着把中兴MG3732开发板通过usb连接到主板上。

 

2.2    移植步骤

1)  拷贝基于android4.2的libztewcdma-ril.so文件到 /system/lib目录下

2)  在/driver/usb/serial/option.c中添加pid,vid如下:

  1. { USB_DEVICE(0x19d2, 0xffff) },  
  2.  {USB_DEVICE(0x19d2, 0xfffe) },  
  3.  {USB_DEVICE(0x19d2, 0xfffd) },  
  4.  {USB_DEVICE(0x19d2, 0xfffc) },  
  5.  {USB_DEVICE(0x19d2, 0xfffb) },  
  6.  {USB_DEVICE(0x19d2, 0xfff1) },  
  7.  {USB_DEVICE(0x19d2, 0xfff6) },  
  8.  {USB_DEVICE(0x19d2, 0xfff7) },  
  9.  {USB_DEVICE(0x19d2, 0xfff8) },  
  10.  {USB_DEVICE(0x19d2, 0xfff9) },  
  11.  {USB_DEVICE(0x19d2, 0xffee) },  
  12.  {USB_DEVICE(0x19d2, 0xffed) },  
  13.  {USB_DEVICE(0x19d2, 0xffeb) },  
  14.  {USB_DEVICE(0x19d2, 0xffec) },  
                  { USB_DEVICE(0x19d2, 0xffff) },
                   {USB_DEVICE(0x19d2, 0xfffe) },
                   {USB_DEVICE(0x19d2, 0xfffd) },
                   {USB_DEVICE(0x19d2, 0xfffc) },
                   {USB_DEVICE(0x19d2, 0xfffb) },
                   {USB_DEVICE(0x19d2, 0xfff1) },
                   {USB_DEVICE(0x19d2, 0xfff6) },
                   {USB_DEVICE(0x19d2, 0xfff7) },
                   {USB_DEVICE(0x19d2, 0xfff8) },
                   {USB_DEVICE(0x19d2, 0xfff9) },
                   {USB_DEVICE(0x19d2, 0xffee) },
                   {USB_DEVICE(0x19d2, 0xffed) },
                   {USB_DEVICE(0x19d2, 0xffeb) },
                   {USB_DEVICE(0x19d2, 0xffec) },


3)  拷贝chat, pppd到/system/bin目录下,确保/system/bin 目前下有pppd 和chat 两个程序,且可以运行

4)  添加ip-up到/system/ppp/目录下

5)  在init.rc文件中添加

 

  1. chmod 0755  /system/lib/libztewcdma-ril.so  
  2. chown root  /system/bin/pppd  
  3. chmod 4755  /system/bin/pppd  
  4.    
  5. service ril-daemon /system/bin/rild -l /system/lib/libztewcdma-ril.so -- -d  /dev/ttyUSB0  
  6.     class main  
  7.     socket rild stream 660 root radio  
  8.     socket rild-debug stream 660 radio system  
  9.     user root  
  10.     group radio cache inet misc  
chmod 0755  /system/lib/libztewcdma-ril.so
chown root  /system/bin/pppd
chmod 4755  /system/bin/pppd
 
service ril-daemon /system/bin/rild -l /system/lib/libztewcdma-ril.so -- -d  /dev/ttyUSB0
    class main
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    user root
    group radio cache inet misc

6)  配置menuconfig如下:

 

  1. [*] Network device support  --->  
  2.         <*>   PPP (point-to-point protocol) support  
  3.         [*]     PPP multilink support (EXPERIMENTAL)  
  4.         [*]     PPP filtering  
  5.         <*>     PPP support for async serial ports  
  6.         <*>     PPP support for sync tty ports  
  7.         <*>     PPP Deflate compression  
  8.         <*>     PPP BSD-Compress compression  
  9.         <*>     PPP MPPE compression (encryption)(EXPERIMENTAL)  
  10.         <*>     PPP over Ethernet (EXPERIMENTAL)  
  11.         <*>     PPP over L2TP (EXPERIMENTAL)  
[*] Network device support  --->
        <*>   PPP (point-to-point protocol) support
        [*]     PPP multilink support (EXPERIMENTAL)
        [*]     PPP filtering
        <*>     PPP support for async serial ports
        <*>     PPP support for sync tty ports
        <*>     PPP Deflate compression
        <*>     PPP BSD-Compress compression
        <*>     PPP MPPE compression (encryption)(EXPERIMENTAL)
        <*>     PPP over Ethernet (EXPERIMENTAL)
        <*>     PPP over L2TP (EXPERIMENTAL)

2.3    调试过程

1、  进入android系统后,首先查看模块的端口是否识别,如果能正确识别的话,可以看到以下4个端口:

  1. /dev/ttyUSB0  
  2. /dev/ttyUSB1  
  3. /dev/ttyUSB2  
  4. /dev/ttyUSB3  
  5.    
/dev/ttyUSB0
/dev/ttyUSB1
/dev/ttyUSB2
/dev/ttyUSB3
 

在调试过程中,发现Log出现此句错误:

  1. usb1-1: device v19d2 pffeb is not supported  
usb1-1: device v19d2 pffeb is not supported

 说明modem模块没有被识别到,但此时已在option.c中添加了这个设备属性:

{ USB_DEVICE(0x19d2, 0xffeb) }

所以怀疑可能是usb的问题。

因sabre-sd开发板只有1个usb-otg接口,没有普通的usb口,我尝试用飞线重新飞了一个普通usb口出来,把中兴3G模块接到这个普通的usb口上,这句错误log就没有再出现了。

 

2、  在系统启动后,发现log打印:

  1. I/RIL     ( 2308): 3G modemmonitor thread is start  
  2. I/RIL     ( 2308): Opening ttydevice /dev/ttyUSB0  
  3. I/RIL     ( 2308): Runtime 3Gcan't find supported modem  
  4. E/RILC    ( 2308):RIL_register: RIL version 7  
  5. E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...  
  6. E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...  
  7. E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...  
I/RIL     ( 2308): 3G modemmonitor thread is start
I/RIL     ( 2308): Opening ttydevice /dev/ttyUSB0
I/RIL     ( 2308): Runtime 3Gcan't find supported modem
E/RILC    ( 2308):RIL_register: RIL version 7
E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...
E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...
E/RIL     ( 2308): openingdata channel device - /dev/ttyFAKEPort. retrying...

这些log信息是在libreference-ril.so中打印的,说明系统没有调用到libztewcdma-ril.so文件。

后查看hardware/ril/rild/rild.c文件的源码,发现问题出现在main函数的switch(modem_type)语句段中。

解决方法是把switch(modem_type)语句段注释掉,重新编译rild可执行程序,即可正常地调用到libztewcdma-ril.so文件。

 

 

3、  注意设置ril-daemon的端口为/dev/ttyUSB0,否则rild进程无法启动,在

logcat –b radio中会显示以下错误:

  1. I/RILJ   ( 2392): Couldn't find 'rild' socket; retrying after timeout  
  2. I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout  
  3. I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout  
  4. I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout  
  5. I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout  
I/RILJ   ( 2392): Couldn't find 'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout
I/RILJ    ( 2392): Couldn't find'rild' socket; retrying after timeout

4、  在调试过程中,模块可以拨打电话,但无法上网,用ps命令未发现pppd进程,log如下:

  1. D/RILJ    ( 2369): 0: [77] SETUP_DATA_CALL   
  2. E/RILD    ( 2135): get exit sig 17   
  3. E/RILD    ( 2135): checkPPPConnection: pid_exit == 1   
  4. E/RILD    ( 2135): checkPPPConnection: interface[ppp0]information is not found   
  5. E/RILD    ( 2135): start_pppd:   failed to check PPP interfaceUP   
  6. E/RILD    ( 2135): EVENT_PPPD_MANAGER_PPPD_EXIT   
  7. E/RILD    ( 2135): pppd exit. status = 1024   
  8. E/RILD    ( 2135): pppd exit . no restart pppd .   
  9. E/RILD    ( 2135): SetupDefaultPDP failed.   
D/RILJ    ( 2369): 0: [77] SETUP_DATA_CALL 
E/RILD    ( 2135): get exit sig 17 
E/RILD    ( 2135): checkPPPConnection: pid_exit == 1 
E/RILD    ( 2135): checkPPPConnection: interface[ppp0]information is not found 
E/RILD    ( 2135): start_pppd:   failed to check PPP interfaceUP 
E/RILD    ( 2135): EVENT_PPPD_MANAGER_PPPD_EXIT 
E/RILD    ( 2135): pppd exit. status = 1024 
E/RILD    ( 2135): pppd exit . no restart pppd . 
E/RILD    ( 2135): SetupDefaultPDP failed. 

说明pppd进程启动失败。

后发现是pppd权限问题导致,解决方法如下:

启动系统后,在adb中执行以下命令修改pppd权限:

  1. chown root  /system/bin/pppd  
  2. chmod 4755 /system/bin/pppd  
chown root  /system/bin/pppd
chmod 4755 /system/bin/pppd

若系统是只读属性,需用remount命令重新挂载文件系统:

  1. mount –o remount,rw /dev/block/mmcblk0p5 /system/  
mount –o remount,rw /dev/block/mmcblk0p5 /system/


3      ublox LISA-U130模块移植

3.1    准备

准备一张可用的联通3G卡,放入SIM卡卡槽,接着把ublox u130开发板通过usb连接到主板上。

3.2    移植步骤

1)  解压ublox提供的android4.2的3g驱动压缩文件如下:

  1. RIL_sc_<version>.zip  
  2. ril_sc_<version>                                Sourceoverlay for Android Platform  
  3.        build/target/product                     Device configuration folder files  
  4.        external/ppp/                            Data connection files  
  5.        hardware/gsm0710muxd                     Channel multiplexer  
  6.        hardware/ril/ublox_ril/                  RIL core directory  
  7.        system/core/rootdir/Android.mk           Compilation script  
  8.        system/core/init/property_service.c      Set RIL services property  
  9.        system/core/liblog/logd_write.c          Log configuration files  
RIL_sc_<version>.zip
ril_sc_<version>                                Sourceoverlay for Android Platform
       build/target/product                     Device configuration folder files
       external/ppp/                            Data connection files
       hardware/gsm0710muxd                     Channel multiplexer
       hardware/ril/ublox_ril/                  RIL core directory
       system/core/rootdir/Android.mk           Compilation script
       system/core/init/property_service.c      Set RIL services property
       system/core/liblog/logd_write.c          Log configuration files


 

2)  把相关文件拷贝到android源码中

  1. cp –pvRf  ril_sc_<version>/external/ppp/  <android_root>/external/ppp  
  2. cp –pvRf  ril_sc_<version>/hardware/ril/ublox_ril  <android_root>/hardware/ril/  
  3. cp –pvRf  ril_sc_<version>/system/*  <android_root>/system  
  4. cp –pvRf  ril_sc_<version>/build/*  <android_root>/build  
cp –pvRf  ril_sc_<version>/external/ppp/  <android_root>/external/ppp
cp –pvRf  ril_sc_<version>/hardware/ril/ublox_ril  <android_root>/hardware/ril/
cp –pvRf  ril_sc_<version>/system/*  <android_root>/system
cp –pvRf  ril_sc_<version>/build/*  <android_root>/build

3)  在device/fsl/imx6/AndroidProducts.mk中添加:

RIL_COM_INTERFACE := usb

4)  在init.rc文件中添加如下语句:

    

  1.  # Changepermissions for modem  
  2.      chmod 0660 /dev/ttyACM0  
  3.      chown radio radio /dev/ttyACM0  
  4.      chmod 0660 /dev/ttyACM1  
  5.      chown radio radio /dev/ttyACM1  
  6.      chmod 0660 /dev/ttyACM2  
  7.      chown radio radio /dev/ttyACM2  
  8.   
  9. # Set permissions for u-blox RILRepository  
  10.      chown radio radio /system/etc/rril  
  11.      chmod 0770 /system/etc/rril  
  12.      chown radio radio/system/etc/rril/repository.txt  
  13.      chmod 0660 /system/etc/rril/repository.txt  
  14.   
  15. # Set u-blox RIL repository state  
  16.      setprop net.rril.repository notready  
  17.   
  18. # Prepare u-blox RIL repository  
  19. service uril-repo /system/bin/uril-repo.sh  
  20.      user root  
  21.      group radio  
  22.      oneshot  
  23.   
  24. # Load u-blox RIL  
  25. service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so -- -a /dev/ttyACM0 -n /dev/ttyACM1  
  26.      class main  
  27.      socket rild stream 660 root radio  
  28.      socket rild-debug stream 660 radiosystem  
  29.      user root  
  30.      group radio cache inet misc audio  
  31.   
  32. service pppd_data0/system/bin/init.gprs-pppd  
  33.      user root radio  
  34.      group radio cache inet misc  
  35.      disabled  
  36.      oneshot  
  37.   
  38. service pppd_data1/system/bin/init.gprs-pppd  
  39.      user root radio  
  40.      group radio cache inet misc  
  41.      disabled  
  42.      oneshot  
  43.   
  44. service pppd_term /system/bin/stop_pppd15  
  45.      class main  
  46.      disabled  
  47.      oneshot  
  48.   
  49. service pppd_kill /system/bin/stop_pppd 9  
  50.      class main  
  51.      disabled  
  52.       oneshot  
       # Changepermissions for modem
           chmod 0660 /dev/ttyACM0
           chown radio radio /dev/ttyACM0
           chmod 0660 /dev/ttyACM1
           chown radio radio /dev/ttyACM1
           chmod 0660 /dev/ttyACM2
           chown radio radio /dev/ttyACM2
 
      # Set permissions for u-blox RILRepository
           chown radio radio /system/etc/rril
           chmod 0770 /system/etc/rril
           chown radio radio/system/etc/rril/repository.txt
           chmod 0660 /system/etc/rril/repository.txt
 
      # Set u-blox RIL repository state
           setprop net.rril.repository notready
 
      # Prepare u-blox RIL repository
      service uril-repo /system/bin/uril-repo.sh
           user root
           group radio
           oneshot
 
      # Load u-blox RIL
      service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so -- -a /dev/ttyACM0 -n /dev/ttyACM1
           class main
           socket rild stream 660 root radio
           socket rild-debug stream 660 radiosystem
           user root
           group radio cache inet misc audio
 
      service pppd_data0/system/bin/init.gprs-pppd
           user root radio
           group radio cache inet misc
           disabled
           oneshot
 
      service pppd_data1/system/bin/init.gprs-pppd
           user root radio
           group radio cache inet misc
           disabled
           oneshot
 
      service pppd_term /system/bin/stop_pppd15
           class main
           disabled
           oneshot
 
      service pppd_kill /system/bin/stop_pppd 9
           class main
           disabled
            oneshot

5)  配置menuconfig如下:

  1. DeviceDrivers  
  2.           USB Support  
  3.               <*>USB Modem (CDC ACM)support  
  4.    
  5. DeviceDrivers  
  6.           Network device support  
  7.               <*>PPP (point-to-pointprotocol) support  
  8.               <*>PPP support for asyncserial ports  
  9.               <*>PPP support for sync ttyports  
  10.                      <*>PPP Deflate compression  
  11.    
DeviceDrivers
          USB Support
              <*>USB Modem (CDC ACM)support
 
DeviceDrivers
          Network device support
              <*>PPP (point-to-pointprotocol) support
              <*>PPP support for asyncserial ports
              <*>PPP support for sync ttyports
                     <*>PPP Deflate compression
 


6)  重新编译系统,确保生成以下文件

  1. /system/lib/librapid-ril-core.so  
  2. /system/lib/librapid-ril-util.so  
  3. /system/lib/librapid-ril-oem.so  
  4.    
  5. /system/bin/pppd  
  6. /system/bin/chat  
  7.    
  8. /system/bin/init.gprs-pppd  
  9. /system/bin/ip-down  
  10. /system/bin/ip-up  
  11. /system/bin/stop_pppd  
  12. /system/bin/rril-repo.sh  
  13.    
  14. /system/etc/uril/repository.txt  
  15.    
  16. /system/etc/ppp/ chap-secrets  
  17. /system/etc/ppp/ chat-isp1  
  18. /system/etc/ppp/ chat-isp2  
  19. /system/etc/ppp/ ip-down-ppp0  
  20. /system/etc/ppp/ ip-up-ppp0  
  21. /system/etc/ppp/ ip-up-vpn  
  22. /system/etc/ppp/pap-secrets  
  23.    
  24. /system/etc/ppp/peers/gprs1  
  25. /system/etc/ppp/peers/gprs2  
  26.    
/system/lib/librapid-ril-core.so
/system/lib/librapid-ril-util.so
/system/lib/librapid-ril-oem.so
 
/system/bin/pppd
/system/bin/chat
 
/system/bin/init.gprs-pppd
/system/bin/ip-down
/system/bin/ip-up
/system/bin/stop_pppd
/system/bin/rril-repo.sh
 
/system/etc/uril/repository.txt
 
/system/etc/ppp/ chap-secrets
/system/etc/ppp/ chat-isp1
/system/etc/ppp/ chat-isp2
/system/etc/ppp/ ip-down-ppp0
/system/etc/ppp/ ip-up-ppp0
/system/etc/ppp/ ip-up-vpn
/system/etc/ppp/pap-secrets
 
/system/etc/ppp/peers/gprs1
/system/etc/ppp/peers/gprs2
 

3.3    调试过程

1、  启动系统后,确保3G模块端口可以被系统识别:

  1. /dev/ttyACM0  
  2. /dev/ttyACM1  
  3. /dev/ttyACM2  
  4. /dev/ttyACM3  
  5. /dev/ttyACM4  
  6. /dev/ttyACM5  
  7.    
/dev/ttyACM0
/dev/ttyACM1
/dev/ttyACM2
/dev/ttyACM3
/dev/ttyACM4
/dev/ttyACM5
 

2、  用ps命令查看rild进程是否启动,如果已启动,此时一般拨打电话是没问题的。

3、  在调试过程中发现不能上网,用ps命令查看,发现pppd进程未启动。在adb中用logcat –b radio查看日志发现有两处错误:

 

第一处错误:

  1. E/RILR    ( 2109):CRepository::OpenRepositoryFile() - ERROR: Could not open file"/data/rril/repository.txt" - No such file or directory  
E/RILR    ( 2109):CRepository::OpenRepositoryFile() - ERROR: Could not open file"/data/rril/repository.txt" - No such file or directory


第二处错误:

  1. I/pppd.gprs( 3262): Configure pppd securityoptions   
  2. I/pppd.start( 3271): Starting pppd   
  3. E/pppd    ( 3272): unrecognizedoption 'gprs1'  
  4. I/pppd.start( 3279): pppd exited with2   
  5.    
I/pppd.gprs( 3262): Configure pppd securityoptions 
I/pppd.start( 3271): Starting pppd 
E/pppd    ( 3272): unrecognizedoption 'gprs1'
I/pppd.start( 3279): pppd exited with2 
 

第一处错误could not find /data/rril/repository.txt的原因是/system/bin/uril-repo.sh脚本未得到执行,解决方法是修改/system/bin/uril-repo.sh的权限,以及在init.rc中添加servicerril-repo的class属性:

  1. # Prepare u-blox RIL repository  
  2. service uril-repo /system/bin/uril-repo.sh  
  3. class main  
  4. user root  
  5. group radio  
  6. oneshot  
# Prepare u-blox RIL repository
service uril-repo /system/bin/uril-repo.sh
class main
user root
group radio
oneshot

第二处错误unrecognizedoption 'gprs1'的原因是执行/system/bin/init.gprs-pppd脚本时出错,$ppp_usr为空字符串时,脚本执行以下语句:

----------------------------------------------------------------------

/system/bin/pppd user $ppp_usr call gprs$(( $ppp_if + 1 ))

=

/system/bin/pppd user call gprs1

 

----------------------------------------------------------------------

此语句执行失败,所以pppd进程无法启动。

 

修改后的正确的脚本为:

  1. case $ppp_auth in   
  2. 0)   
  3. /system/bin/log -t pppd.start "/system/bin/pppd call gprs$(( $ppp_if+ 1 ))"  
  4. /system/bin/pppd call gprs$(( $ppp_if + 1 ))   
  5. ;;   
  6. *)   
  7.    
  8. if [ "$ppp_usr" = "" ];then  
  9. /system/bin/log -t pppd.start "/system/bin/pppd call gprs$(( $ppp_if+ 1 ))"  
  10. /system/bin/pppd call gprs$(( $ppp_if + 1 ))   
  11. else  
  12. /system/bin/log -t pppd.start "/system/bin/pppd user $ppp_usr callgprs$(( $ppp_if + 1 ))"  
  13. /system/bin/pppd user $ppp_usr call gprs$(( $ppp_if + 1 ))   
  14. fi  
  15.    
case $ppp_auth in 
0) 
/system/bin/log -t pppd.start "/system/bin/pppd call gprs$(( $ppp_if+ 1 ))"
/system/bin/pppd call gprs$(( $ppp_if + 1 )) 
;; 
*) 
 
if [ "$ppp_usr" = "" ];then
/system/bin/log -t pppd.start "/system/bin/pppd call gprs$(( $ppp_if+ 1 ))"
/system/bin/pppd call gprs$(( $ppp_if + 1 )) 
else
/system/bin/log -t pppd.start "/system/bin/pppd user $ppp_usr callgprs$(( $ppp_if + 1 ))"
/system/bin/pppd user $ppp_usr call gprs$(( $ppp_if + 1 )) 
fi
 

4、  在android 4.2上作了以上修改后,发现pppd进程还未能启动,经检测,发现/system/bin/init.gprs-pppd文件未能得到执行,相关的服务在init.rc中的:

  1. service pppd_data0 /system/bin/init.gprs-pppd  
  2.            user root radio  
  3.            group radio cache inet misc  
  4.            disabled  
  5.            oneshot  
service pppd_data0 /system/bin/init.gprs-pppd
           user root radio
           group radio cache inet misc
           disabled
           oneshot


Disabled表示服务暂停执行,等待property_set("ctl.start", "pppd_data0")的时候才执行,说明可能是初始化系统的时候出现了问题。

我重新编译system/core/init目录,发现不能编译通过,报错如下:

  1. undefined reference to watchdogd_main  
undefined reference to watchdogd_main

因/system/core/init/property_service.c和/system/core/init/Android.mk文件都是ublox驱动文件修改过的,所以我仔细查看这两个文件,发现是Android.mk文件出现问题,ublox提供的Android.mk文件是针对android 4.1的,并不是4.2,在LOCAL_SRC_FILES中缺少了watchdogd.c文件,修改Android.mk文件如下:

1)    在LOCAL_SRC_FILES中添加watchdogd.c

2)      在SYMLINKS中添加$(TARGET_ROOT_OUT)/sbin/watchdogd

然后重新编译system/core/init,生成root/init程序,pppd进程即可成功启动,并可使用3G网络


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值