此种方法的好处是,openwrt的Linux内核过程文件是在build_dir目录下临时文件,这种编译就不会当心在执行make clean后内核在此修改的情况。
一、运行环境
1.qca-networking-2019-spf-11-0_qca_oem
2.IPQ4019
3.Linux4.4.60
4.USB2.0接口EC20PCIe拨号上网
二、移植步骤
1.首先内核Linux4.4.60无需增加EC20的关于USB 的PID VID等步骤;
2.内核添加USB网络配置选项:
总体来说是这几个驱动添加:
kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch
步骤:
1).顶层目录qsdk/ 下执行:
# make menuconfig
2).配置 kmod-usb-serial:
Kernel modules --->
USB Support --->
<*> kmod-usb-serial..................... Support for USB-to-Serial converters
3). 配置 kmod-usb-serial-option
Kernel modules --->
USB Support --->
<*> kmod-usb-serial-option................... Support for Option HSDPA modems
4). 配置 kmod-usb-serial-wwan
Kernel modules --->
USB Support --->
-*- kmod-usb-serial-wwan..................... Support for GSM and CDMA modems
5). 配置 kmod-usb-net
Kernel modules --->
USB Support --->
<*> kmod-usb-net............... Kernel modules for USB-to-Ethernet convertors
6). 配置 usb-modeswitch
Utilities --->
<*> usb-modeswitch................................ USB mode switching utility
7). 最后, 保存退出配置界面即可。
8).内核修改
# make kernel_menuconfig
Device Drivers --->
[*] USB support --->
<*> Support for Host-side USB
Device Drivers --->
[*] Network device support --->
<*> USB Network Adapters --->
<*> Multi-purpose USB Networking Framework
最后, 保存退出配置界面即可。
3.添加 GobiNet 驱动(非内核添加GobiNet 驱动,ipk方式),quectel_cm拨号
1).将GobiNet-drv.tar.gz https://download.csdn.net/download/weixin_41740391/12719339
解压至 qsdk/package/kernel/ 目录下
2).将 quectel_cm.tar.gz https://download.csdn.net/download/weixin_41740391/12719343
解压至 qsdk/package 目录下
3).顶层目录qsdk/ 下执行:
# make menuconfig
4).选择kmod-GobiNet-drv 驱动
Kernel modules --->
Other modules --->
<*> kmod-GobiNet-drv...................... GobiNet-drv-package-kmod-4g driver
5).选择quectel_cm 拨号
Base system --->
<*> quectel_cm.............................. quectel_cm communication utility
6).保存退出,顶层qsdk/ 下编译
make -j4(4代表使用4线程编译,速度将提高,) V=s
过程中出现
NOP USB Transceiver Driver (NOP_USB_XCEIV) [N/m/y/?] n
AM335x USB PHY Driver (AM335X_PHY_USB) [N/m/y/?] n
GPIO based peripheral-only VBUS sensing 'transceiver' (USB_GPIO_VBUS) [N/m/y/?] n
NXP ISP1301 USB transceiver support (USB_ISP1301) [N/m/y/?] n
Qualcomm on-chip USB OTG controller support (USB_MSM_OTG) [M/n/?] m
Qualcomm APQ8016/MSM8916 on-chip USB PHY controller support (USB_QCOM_8X16_PHY) [N/m/?] (NEW)
Qualcomm QUSB HS PHY driver support (USB_QCOM_QUSB_PHY) [N/m/y/?] n
Qualcomm QMP SS PHY support (USB_QCOM_QMP_PHY) [N/m/y/?] n
Generic ULPI Transceiver Driver (USB_ULPI) [N/y/?] n
*
* Hardware crypto devices
*
Hardware crypto devices (CRYPTO_HW) [Y/n/?] y
Driver HIFN 795x crypto accelerator chips (CRYPTO_DEV_HIFN_795X) [N/m/y/?] n
FIPS140-2 compliant build (FIPS_ENABLE) [N/y/?] n
OTA Crypto module (CRYPTO_DEV_OTA_CRYPTO) [N/m/y/?] n
QCEDEV Interface to CE module (CRYPTO_DEV_QCEDEV) [M/n/y/?] m
Inline Crypto Module (CRYPTO_DEV_QCOM_ICE) [N/m/y/?] (NEW)
直接Enter 就可以了。
等待编译完成,如果是首次编译建议采用(make -j1 V=s) -j4将会有某些编译顺序原因,会报错。
4.下载程序至target 板
set ipaddr 192.168.9.12
set serverip 192.168.9.10
ping ${serverip}
内核+dts+文件系统
tftpboot 0x84000000 ipq40xx-nornand-apps.img
imgaddr=0x84000000 && source $imgaddr:script
Flashing ubi: [ done ] 完成
5.查看驱动完成情况
root@OpenWrt:/# ls /dev/
出现这ttyUSBx qcqmiX 几个节点后,表示驱动正确安装并且模块正确链接启动。
6.建立网络链接
建立4G用网络节点 /etc/config/network
config interface '4G'
option proto 'dhcp'
option ifname 'eth2'
option dns '114.114.114.114'
防火墙开启网络链接 /etc/config/firewall
config zone
option name 'wan'
list network 'wan'
list network 'wan6'
list network '4G' #此处为添加部分
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
未拨号前
root@OpenWrt:/# ifconfig
eth2 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
UP BROADCAST NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
拨号:
root@OpenWrt:/# MobileNet &
拨号后:
root@OpenWrt:/# ifconfig
eth2 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:10.xx.3.xxx Bcast:10.xx.3.xxx Mask:255.255.255.xxx
inet6 addr: xxxx::e4f9:3fff:fe49:xxxx/64 Scope:Link
UP BROADCAST RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2681 (2.6 KiB) TX bytes:3044 (2.9 KiB)
root@OpenWrt:/# ping baidu.com
PING baidu.com (39.156.69.79): 56 data bytes
64 bytes from 39.156.69.79: seq=0 ttl=46 time=85.526 ms
64 bytes from 39.156.69.79: seq=1 ttl=46 time=77.523 ms
64 bytes from 39.156.69.79: seq=2 ttl=46 time=109.984 ms