openwrt编译加载龙尚U9300模组上网

硬件平台:MT7628A

openwrt版本:MTK_SDK

1、添加模组信息

/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.180/drivers/usb/serial/option.c

在源码中找到option_ids数组, 添加模组VID、PID: 0x1c9e、 0x9b3c 

/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
 * It seems to contain a Qualcomm QSC6240/6290 chipset            */
#define FOUR_G_SYSTEMS_PRODUCT_W14        0x9603
#define FOUR_G_SYSTEMS_PRODUCT_W100        0x9b01

/* Fujisoft products */
#define FUJISOFT_PRODUCT_FS040U            0x9b02

/* iBall 3.5G connect wireless modem */
#define IBALL_3_5G_CONNECT            0x9605

/* Zoom */
#define ZOOM_PRODUCT_4597            0x9607

/* SpeedUp SU9800 usb 3g modem */
#define SPEEDUP_PRODUCT_SU9800            0x9800
/*U9300*/
#define LONGSUNG_VENDOR_ID            0x1c9e

#define LONGSUNG_U9300_PRODUCT_ID 0x9b3c

添加该id到数组,过滤 interface 4

{ USB_DEVICE_INTERFACE_CLASS(LONGSUNG_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
{ USB_DEVICE_INTERFACE_CLASS(LONGSUNG_VENDOR_ID, LONGSUNG_U9300_PRODUCT_ID, 0xff),
   .driver_info = RSVD(4) },
{ USB_DEVICE_INTERFACE_CLASS(LONGSUNG_VENDOR_ID, 0x9801, 0xff),

 

在 /drivers/network/usb/qmiw_wan.c文件添加 VID

2、编译

配置make menuconfig:

Base system --> udev
Kernel modules --> USB Support --> kmod-usb-acm kmod-usb-net kmod-usb-net kmod-usb-net kmod-usb-net-qmi-wwan kmod-usb-ohci kmod-usb-serial kmod-usb-serial-option
LuCI ---> Protocols ---> luci-proto-3g luci-proto-qmi
Network ---> uqmi
Utilities ---> usb-modeswitch usbutils

配置make kernel_menuconfig:

device drivers ---> usb support --->usb serial converter support--->USB driver for GSM and CDMA modems
device drivers--->Network device support--->usb Network Adapters--->Multi-purpose USB Networking Framework

修改 ENOMSG值改为42

build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.84/arch/mips/include/uapi/asm/errno.h

#define ENOMSG 42

 

编译后, 添加成功 及 驱动正常 会在 /dev/ 目录下生成 ttyUSB0 -- ttyUSB4   5个端口

 

3、编译龙尚gobinet驱动

将官方驱动解压到 package/gobinet/src/,在package/gobinet 目录下新建 makefile 文件,内容如下:

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
 
PKG_NAME:=gobinet
PKG_RELEASE:=1
 
include $(INCLUDE_DIR)/package.mk
 
define KernelPackage/gobinet
    SUBMENU:=Other modules
    TITLE:=Support Module for gobinet
    DEPENDS:=+kmod-usb-core +kmod-usb-net
    FILES:=$(PKG_BUILD_DIR)/GobiNet.ko
    AUTOLOAD:=$(call AutoLoad,81,GobiNet)
endef
 
define KernelPackage/gobinet/description
    This is a gobinet drivers
endef
 
MAKE_OPTS:=ARCH="$(LINUX_KARCH)" \
    CROSS_COMPILE="$(TARGET_CROSS)" \
    SUBDIRS="$(PKG_BUILD_DIR)"
    
define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)/
    $(CP) -R ./src/* $(PKG_BUILD_DIR)/
endef
 
define Build/Compile
    $(MAKE) -C "$(LINUX_DIR)" $(MAKE_OPTS) modules
endef
 
$(eval $(call KernelPackage,gobinet))

 

在menuconfig 中将该驱动编译进内核  kernel modules ->   Other modules ->  kmod-gobinet

编译刷机后查看是否出现新的网卡eth0或者eth1

 

4、查看模块状态,拨号上网(安装minicom,选择ttyUSB2)

minicom操作:

查询APN AT
+CGDCONT? 配置APN AT+CGDCONT=1,"IP","CTNET" CTNET(电信) CMNET(移动) 3GNET(联通) APN一般模块可以自动识别,无需配置
拨号上网 AT$QCRMCALL
=1,1 加入开机启动 rc.local,注意文件需要可执行权限 echo -e "at\$qcrmcall=1,1\r\n" >/dev/ttyUSB2 | cat /dev/ttyUSB2

 

修改路由配置文件vi /etc/config/network

config interface 'wan'
    option  device '/dev/cdc-wdm0'
    option proto 'qmi'
    option apn  'cnnet'
    option username 'card'
    option password 'card'
    option ifname 'wwan0'

 

WEB页面添加新的wan接口:

登录web页面,network ->  interfaces,点击 add new interfaces ,任意起个名字,DHCP CLIENT,  interface选择新的网口eth*,firewall  加入wan,刷新后看是否能够自动获取ip,获取ip成功即可联网!

 

posted @ 2021-02-27 20:44  凡尘夫子  阅读(1481)  评论(0编辑  收藏  举报