通过配置 linux 内核驱动,在文件系统移植 ppp 拨号工具移植 EC20 到 Qt 系统和最小 linux 系统,移植中需要的软件包和文档在网盘资料“iTOP4418 开发板资料汇总(不含光盘内容)\09_iTOP-4418 开发板最小
linux_Qt_Ubuntu 扩展文档\23_章节_移植 EC20”下载。
EC20 模块封装成标准的 PCIe 接口,和开发板主要通过 usb 通讯。此次提供的文件有 pppd 源码、编译好的 chat 和 pppd 工具、wcdma,wcdma_back,wcdma-chatconnect、wcdma-chat-disconnect 以及要在文档最后使用的 pppd_conf.sh 脚本,如下图 所示

在进行编译之前要先修改编译器为 arm-2009q3 编译器,如何设置编译器参见手册 5.2.2“交叉编译工具的安装”。另外为了避免使用环境变量设置编译器而可能出现的问题,文档中大部分编译是使用编译器的绝对路径,用户也应先找到自己编译器的绝对路径待用。下图是本次编译使用的编译器以及编译器压缩包。

由上图可知该编译器的绝对路径为“/usr/local/arm/arm-2009q3/bin/ arm-nonelinux-gnueabi-gcc”。
63.1 驱动支持
首先需要对 Linux 内核驱动做一定的修改,使操作系统能够支持 EC20,首先增加 VID 和 PID,即 usb的厂商 ID 和设备 ID。在内核源码中的 kernel /drivers/usb/serial/option.c 文件里添加如下两项内容
#define EC20_VID 0x1E0E
#define EC20_PID 0x9001
如下图

然后搜索 option_ids,在 option_ids 列表中增加以下内容。
{ USB_DEVICE(EC20_VID, EC20_PID) },
如下图

回到 kernel 目录,配置 make menuconfig 以下两项。Device Drivers →USB Support →USB Serial Converter support →USB driver for GSM and CDMA modems

以及在 Device Drivers > Network device support 的<*> PPP***全部选中

然后编译内核,并烧写到开发板。
63.2 编译 ppp 拨号工具
将提供的源码解压到 Ubuntu,进入解压的文件夹,如下图所示。

使用“./configure”命令配置源码,如下图所示。

使用命令“make CC=/ usr/local/arm/arm-2009q3/bin/ arm-none-linux-gnueabigcc”编译源码,注意这里使用编译器的绝对路径。

编译到此完成,可以看到在 pppd 文件夹生成了 pppd 工具,在 chat 文件夹生成了 chat 工具,如下图所示。

63.3 拷贝工具
将上面步骤中生成的 pppd 和 chat 工具下载到开发板/usr/sbin/目录下。将压缩包提供的脚本 wcdma,
wcdma-chat-connect,wcdma-chat-disconnect 拷贝到开发板的/etc/ppp/peers/目录下。
63.4 测试
首先将天线安装到开发板上,如下图所示。

插入手机卡后重启开发板,并将脚本 pppd_conf.sh 拷贝到开发板,然后使用用命令“./pppd_conf.sh &”运行脚本,运行结果如下图所示。

使用命令“ping -c 4 www.baidu.com &”测试,可以看到连网成功(由于 4G 连接需要搜索信号,所以在信号较差的区域需等待一段时间,才能上网)

移植到此完成。

|