迅为IMX6UL驱动移植——移远EC20 GobiNet驱动移植
本文参考《Quectel_LTE&5G_Linux_USB_Driver_User_Guide_V2.0》进行操作,并进行了整理。但需注意的是,交叉编译工具应对应更换为自己所使用的。
第一步,修改内核文件
#if 1 //Added by Quectel
{ USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC20 R2.0/EC20 R2.1/EC25/EG25-G/EM05 */
{ USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21/EG21-G */
{ USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
{ USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
{ USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
{ USB_DEVICE(0x2C7C, 0x0512) }, /* Quectel EG12/EM12/EG18 */
{ USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */
{ USB_DEVICE(0x2C7C, 0x0700) }, /* Quectel BG95/BG77/BG600L-M3/BC69 */
{ USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */
{ USB_DEVICE(0x2C7C, 0x0415) }, /* Quectel AG15 */
{ USB_DEVICE(0x2C7C, 0x0452) }, /* Quectel AG520R */
{ USB_DEVICE(0x2C7C, 0x0455) }, /* Quectel AG550R */
{ USB_DEVICE(0x2C7C, 0x0620) }, /* Quectel EG20 */
{ USB_DEVICE(0x2C7C, 0x0800) }, /* Quectel RG500Q/RM500Q/RG510Q/RM510Q */
#endif
#if 1 //Added by Quectel for zero packet
if (dir == USB_DIR_OUT) {
struct usb_device_descriptor *desc = &serial->dev->descriptor;
if (desc->idVendor == cpu_to_le16(0x2C7C))
urb->transfer_flags |= URB_ZERO_PACKET;
}
#endif
#if 1 //Added by Quectel
.reset_resume = usb_wwan_resume,
#endif
#if 1 //Added by Quectel
//Quectel modules’s interface 4 can be used as USB network device
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
//some interfaces can be used as USB Network device (ecm, rndis, mbim)
if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF) {
return -ENODEV;
}
//interface 4 can be used as USB Network device (qmi)
else if (serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4) {
return -ENODEV;
}
}
#endif
第二步:修改内核配置
第三步:GobiNet驱动
注意3.3.1拷贝GobiNet驱动源码到 [KERNEL]/drivers/net/usb/是应拷贝所有的.c文件和.h文件:
将GobiNet添加到内核的menuconfig菜单中。在 drivers/net/usb/Kconfig 文件末尾加入以下内容:
config USB_GOBI_NET
tristate"Gobi USB Net driver for Quectel module"
help
Support Quectelmodule.
A modemmanager with support for GobiNet is recommended.
Tocompile this driver as a module, choose M here: the module will be calledGobiNet.
配置内核
配置完成后编译内核。并将内核镜像烧写至开发板。
启动开发板
查看设备节点
至此,移远EC20驱动修改完成,GobiNet驱动工作正常。
第四步:移植quectel-CM工具
从 busybox 官网 https://busybox.net/. 下载 最新的.tar.bz2源码文件,并解压:
tar -xjvf busybox-1.35.0.tar.bz2
把 [BUSYBOX]/examples/udhcp/simple.script 文件拷贝Linux开发板 (重命名为 /usr/share/udhcpc/default.script)。如果没有目录就创建一个,因为 udhcpc 需要需要用到这个脚本。
(busybox也支持make menuconfig,但此处不需要配置)
将移远提供的quectel-CM拷贝到Ubuntu下用交叉编译工具编译:
root@ubuntu:/home/samba/quectel-CM# make CROSS-COMPILE=arm-linux-gnueabihf-
将编译后的二进制文件quectel-CM拷贝到开发板中后台运行:
大功告成!