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成功即可聯網!
&n