近日收到两台路由,可以插minipcie(USB)接口的网卡,在openwrt上折腾了下,感觉很不方便,于是就利用周末,在padavan上折腾了。第一次玩这个系统,不熟悉,都是自己摸索的。
工具:
路由一台(配置7620A+7610E,16+128)
4G网卡两个,龙尚U8300C和EC20
串口小板,编程器,ubuntu服务器等
具体编译过程就不说了,直接参照wiki就可以了,注意的是代码默认是N56N,我这个硬件与AC51U比较一致,直接用AC51U编译了。
diff --git a/trunk/.config b/trunk/.config
index 17e5c5d..814f3f1 100644
--- a/trunk/.config
+++ b/trunk/.config
@@ -3,11 +3,11 @@ CONFIG_VENDOR=Ralink
CONFIG_PRODUCT=RT3883
### Target ProductID (board select, max 12 symbols)
-CONFIG_FIRMWARE_PRODUCT_ID="RT-N56U"
+CONFIG_FIRMWARE_PRODUCT_ID="RT-AC51U"
### Linux kernel and toolchain
CONFIG_LINUXDIR=linux-3.4.x
-CONFIG_TOOLCHAIN_DIR=/opt/rt-n56u/toolchain-mipsel
+CONFIG_TOOLCHAIN_DIR=/mnt/pdm/rt-n56u/toolchain-mipsel
############################################################
### Linux kernel configuration
@@ -22,7 +22,6 @@ CONFIG_TOOLCHAIN_DIR=/opt/rt-n56u/toolchain-mipsel
### 2.4 = RT3883/3662 v2.4.3.6
### 2.7 = RT3883/3662 v2.7.2.0
CONFIG_FIRMWARE_WIFI5_DRIVER=2.7
-
### Kernel driver select for WiFi AP 2.4GHz
### 2.4 = RT3092 v2.4.0.5
### 2.5 = RT3092 v2.5.0.11
添加4G网卡进来,这个与openwrt和Android一样的:
--- a/trunk/linux-3.4.x/drivers/usb/serial/option.c
+++ b/trunk/linux-3.4.x/drivers/usb/serial/option.c
@@ -237,8 +237,15 @@ static void option_instat_callback(struct urb *urb);
#define BANDRICH_PRODUCT_1012 0x1012
#define QUALCOMM_VENDOR_ID 0x05C6
+#define SIERRA_VENDOR_ID 0x1199
-#define SIERRA_VENDOR_ID 0x1199
+#define QUECTEL_VENDOR_ID 0x2c7c
+/* These Quectel products use Quectel's vendor ID */
+#define QUECTEL_PRODUCT_EC21 0x0121
+#define QUECTEL_PRODUCT_EC25 0x0125
+#define QUECTEL_PRODUCT_BG96 0x0296
+#define QUECTEL_PRODUCT_EP06 0x0306
+#define QUECTEL_PRODUCT_EM12 0x0512
#define CMOTECH_VENDOR_ID 0x16d8
#define CMOTECH_PRODUCT_6001 0x6001
@@ -369,6 +376,7 @@ static void option_instat_callback(struct urb *urb);
* Mobidata, etc sell under their own brand names.
*/
#define LONGCHEER_VENDOR_ID 0x1c9e
+#define LONGCHEER_U8300_PRODUCT_ID 0x9B05
/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
@@ -678,6 +686,7 @@ static const struct option_blacklist_info cinterion_rmnet2_blacklist = {
};
static const struct usb_device_id option_ids[] = {
+ { USB_DEVICE(0x1c9e, 0x9b05) },//u8300
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
@@ -1185,6 +1194,13 @@ static const struct usb_device_id option_ids[] = {
.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
{ USB_DEVICE_INTERFACE_CLASS(QUALCOMM_VENDOR_ID, 0x9201, 0xff),
.driver_info = (kernel_ulong_t)&net_intf3_blacklist }, /* TS-UM6602 */
+ /* Quectel products using Quectel vendor ID */
+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
{ USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff),
.driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */
{ USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x9041, 0xff),
@@ -57,6 +57,11 @@ struct qmi_wwan_state {
enum qmi_wwan_flags {
QMI_WWAN_FLAG_RAWIP = 1 << 0,
+ QMI_WWAN_FLAG_MUX = 1 << 1,
+};
+enum qmi_wwan_quirks {
+ QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */
+ QMI_WWAN_QUIRK_QUECTEL_DYNCFG = 1 << 1, /* check num. endpoints */
};
static void qmi_wwan_netdev_setup(struct net_device *net)
@@ -468,7 +473,8 @@ next_desc:
* MDM9x30 is the first QMI chipset with USB3 support. Abuse
* this fact to enable the quirk.
*/
- if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
+ if (dev->driver_info->data & QMI_WWAN_QUIRK_DTR ||
+ le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
qmi_wwan_manage_power(dev, 1);
qmi_wwan_change_dtr(dev, true);
}
@@ -581,6 +587,15 @@ static const struct driver_info qmi_wwan_info = {
.rx_fixup = qmi_wwan_rx_fixup,
};
+static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = {
+ .description = "WWAN/QMI device",
+ .flags = FLAG_WWAN | FLAG_SEND_ZLP,
+ .bind = qmi_wwan_bind,
+ .unbind = qmi_wwan_unbind,
+ .manage_power = qmi_wwan_manage_power,
+ .rx_fixup = qmi_wwan_rx_fixup,
+ .data = QMI_WWAN_QUIRK_DTR | QMI_WWAN_QUIRK_QUECTEL_DYNCFG,
+};
#define HUAWEI_VENDOR_ID 0x12D1
/* map QMI/wwan function by a fixed interface number */
@@ -596,6 +611,15 @@ static const struct driver_info qmi_wwan_info = {
#define QMI_GOBI_DEVICE(vend, prod) \
QMI_FIXED_INTF(vend, prod, 0)
+/* Quectel does not use fixed interface numbers on at least some of their
+ * devices. We need to check the number of endpoints to ensure that we bind to
+ * the correct interface.
+ */
+#define QMI_QUIRK_QUECTEL_DYNCFG(vend, prod) \
+ USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VENDOR_SPEC, \
+ USB_SUBCLASS_VENDOR_SPEC, 0xff), \
+ .driver_info = (unsigned long)&qmi_wwan_info_quirk_quectel_dyncfg
+
static const struct usb_device_id products[] = {
/* 1. CDC ECM like devices match on the control interface */
{ /* Huawei E392, E398 and possibly others sharing both device id and more... */
@@ -689,8 +713,12 @@ static const struct usb_device_id products[] = {
USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
.driver_info = (unsigned long)&qmi_wwan_info,
},
+ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
+ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */
+ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */
/* 3. Combined interface devices matching on interface number */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b05, 4)}, /*u8300 */
{QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
{QMI_FIXED_INTF(0x0408, 0xd00a, 2)}, /* Yota (Quanta 1QDLZZZ0ST2), FW 20120301 */
{QMI_FIXED_INTF(0x0408, 0xd009, 3)}, /* Yota (Quanta 1QDLZZZ0ST2), FW 20120412 */
@@ -951,6 +979,9 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
{QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
+// {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
+// {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
+// {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
{QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
/* 4. Gobi 1000 devices */
编译后烧录,可以正常拨号了:
image.png image.png其他问题:
lan和wan口顺序调整:
diff --git a/trunk/user/shared/netutils.h b/trunk/user/shared/netutils.h
old mode 100644
new mode 100755
index acaa989..097a1b0
--- a/trunk/user/shared/netutils.h
+++ b/trunk/user/shared/netutils.h
@@ -39,8 +39,8 @@
#define IFNAME_MAC "eth2"
#define IFNAME_MAC2 "eth3"
#if defined (USE_SINGLE_MAC)
-#define IFNAME_LAN "eth2.1"
-#define IFNAME_WAN "eth2.2"
+#define IFNAME_LAN "eth2.2"
+#define IFNAME_WAN "eth2.1"
#else
#define IFNAME_LAN IFNAME_MAC
#define IFNAME_WAN IFNAME_MAC2
烧录发现128M内存只识别了64M,更改config识别OK:
diff --git a/trunk/configs/boards/RT-AC51U/kernel-3.4.x.config b/trunk/configs/boards/RT-AC51U/kernel-3.4.x.config
old mode 100644
new mode 100755
index f6c61f6..47854b5
--- a/trunk/configs/boards/RT-AC51U/kernel-3.4.x.config
+++ b/trunk/configs/boards/RT-AC51U/kernel-3.4.x.config
@@ -54,8 +54,8 @@ CONFIG_MT7620_ASIC=y
# CONFIG_RALINK_CPUSLEEP is not set
# CONFIG_RT2880_DRAM_16M is not set
# CONFIG_RT2880_DRAM_32M is not set
-CONFIG_RT2880_DRAM_64M=y
-# CONFIG_RT2880_DRAM_128M is not set
+# CONFIG_RT2880_DRAM_64M=y
+CONFIG_RT2880_DRAM_128M=y
# CONFIG_RT2880_DRAM_256M is not set
CONFIG_RALINK_RAM_SIZE=64
# CONFIG_RT2880_UART_57600 is not set
其他坑:主板带了个硬件看门狗,刷非他们的系统会不断重启,拆了看门狗芯片,把供电线直接短接!
附件:
源码下载:https://gitee.com/hzexe/rt-n56u.git
官方WIKI:https://bitbucket.org/padavan/rt-n56u/wiki/EN/HowToMakeFirmware
网友评论