找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 4718|回复: 29

求助!编译的时候改网口顺序

[复制链接]
发表于 2020-12-13 16:32 来自手机 | 显示全部楼层 |阅读模式
买了个定制的路由,主控9531的16+128,用的842nv3的固件,刷完后网口反序,正常是左到右wan lan1 lan2 lan3 lan4刷完固件网口反序了lan4成wan口了,lan3成lan1 wan口成lan4了网上查了好多资料都不能改变顺序,求高手指点下怎么改,

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
发表于 2020-12-13 16:44 | 显示全部楼层
可以采用842nv3的源代码修改来适配你的网口或者刷和你的网卡顺序一样的固件

点评

源代码修改哪里?我找了好多都不对,网上找不到和我网卡顺序一样的固件。。。  详情 回复 发表于 2020-12-13 16:49
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-13 16:49 | 显示全部楼层
afeng11 发表于 2020-12-13 16:44
可以采用842nv3的源代码修改来适配你的网口或者刷和你的网卡顺序一样的固件

源代码修改哪里?我找了好多都不对,网上找不到和我网卡顺序一样的固件。。。

点评

找一个match开头的c文件,大致是mach-tl-wr842n.c  详情 回复 发表于 2020-12-13 17:18
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-13 16:51 | 显示全部楼层
我的是9531的主控用的842NV3 打开mach-tl-wr841n-v9.c文件网口配置不一样
我的是
* LAN */
        ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
        ath79_eth1_data.duplex = DUPLEX_FULL;
        ath79_switch_data.phy_poll_mask |= BIT(4);
        ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
        ath79_register_eth(1);

        /* WAN */
        ath79_switch_data.phy4_mii_en = 1;
        ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
        ath79_eth0_data.duplex = DUPLEX_FULL;
        ath79_eth0_data.speed = SPEED_100;
        ath79_eth0_data.phy_mask = BIT(4);
        ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
        ath79_register_eth(0);

        ath79_init_mac(tmpmac, mac, 0);
        ath79_register_wmac(ee, tmpmac);我改这里不行

点评

我遇到过一样的情况,把 ath79_eth0_data.phy_mask = BIT(4); 和 ath79_switch_data.phy_poll_mask |= BIT(4); 改成 ath79_eth0_data.phy_mask = BIT(0); 和 ath79_switch_data.phy_poll_mask |= BIT(0); 试试。  详情 回复 发表于 2020-12-16 11:00
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-13 17:18 | 显示全部楼层
fangjie88366 发表于 2020-12-13 16:49
源代码修改哪里?我找了好多都不对,网上找不到和我网卡顺序一样的固件。。。

找一个match开头的c文件,大致是mach-tl-wr842n.c

点评

没有842n的,就841nv9的里面有842nv3的定义,就我4楼发的那个  详情 回复 发表于 2020-12-13 18:01
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-13 18:01 | 显示全部楼层
afeng11 发表于 2020-12-13 17:18
找一个match开头的c文件,大致是mach-tl-wr842n.c

没有842n的,就841nv9的里面有842nv3的定义,就我4楼发的那个
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-13 19:25 | 显示全部楼层
本帖最后由 rtlhq 于 2020-12-13 19:27 编辑

在首次启动中,生成的/etc/config/network文件,网口的定义由
/etc/board.d/02_network
决定

点评

#!/bin/sh # # Copyright (C) 2011-2015 OpenWrt.org # . /lib/functions/system.sh . /lib/functions/uci-defaults.sh ar71xx_setup_interfaces() { local board="$1" case "$board" in airgate  详情 回复 发表于 2020-12-16 17:50
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-16 11:00 | 显示全部楼层
fangjie88366 发表于 2020-12-13 16:51
我的是9531的主控用的842NV3 打开mach-tl-wr841n-v9.c文件网口配置不一样
我的是
* LAN */

我遇到过一样的情况,把 ath79_eth0_data.phy_mask = BIT(4); 和 ath79_switch_data.phy_poll_mask |= BIT(4); 改成 ath79_eth0_data.phy_mask = BIT(0); 和 ath79_switch_data.phy_poll_mask |= BIT(0); 试试。

点评

试过了改那个没用的  详情 回复 发表于 2020-12-16 17:48
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-16 12:10 | 显示全部楼层
7 楼正解
对于 ar71xx/ath79 swconfig,改 dts/mach.c 顶多能把 WAN 改对,LAN 还是反的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-16 17:48 | 显示全部楼层
无名游客 发表于 2020-12-16 11:00
我遇到过一样的情况,把 ath79_eth0_data.phy_mask = BIT(4); 和 ath79_switch_data.phy_poll_mask |= BI ...

试过了改那个没用的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-16 17:50 | 显示全部楼层
本帖最后由 fangjie88366 于 2020-12-16 17:54 编辑
rtlhq 发表于 2020-12-13 19:25
在首次启动中,生成的/etc/config/network文件,网口的定义由
/etc/board.d/02_network
决定

#!/bin/sh
#
# Copyright (C) 2011-2015 OpenWrt.org
#

. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh

ar71xx_setup_interfaces()
{
        local board="$1"

        case "$board" in
        airgatewaypro)
                ucidef_add_switch "switch0" \
                        "0@eth0" "4:lan" "5:wan"
                ;;
        airrouter|\
        ap121|\
        ap121-mini|\
        ap96|\
        dir-600-a1|\
        dir-615-c1|\
        dir-615-e1|\
        dir-615-e4|\
        hiwifi-hc6361|\
        ja76pf|\
        mc-mac1200r|\
        minibox-v1|\
        mynet-n600|\
        oolite-v1|\
        oolite-v5.2|\
        oolite-v5.2-dev|\
        qihoo-c301|\
        r602n|\
        rb-750|\
        rb-751|\
        som9331|\
        t830|\
        tew-632brp|\
        tew-712br|\
        tew-732br|\
        tl-mr3220|\
        tl-mr3420|\
        tl-wdr3320-v2|\
        tl-wdr3500|\
        tl-wr740n-v6|\
        tl-wr840n-v2|\
        tl-wr840n-v3|\
        tl-wr841n-v11|\
        tl-wr841n-v9|\
        tl-wr842n-v3|\
        whr-g301n|\
        whr-hp-g300n|\
        whr-hp-gn|\
        wzr-hp-ag300h|\
        zbt-we1526)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
                ;;
帮忙看下我的02_network文件是这个,我改过0@eth0改成4,把1:lan4改成0不行

点评

你的 mach-xxx.c中 /* LAN */ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; ath79_eth1_data.duplex = DUPLEX_FULL; ath79_switch_data.phy_poll_mask |= BIT(4);  详情 回复 发表于 2020-12-16 20:14
结合上面的mach-xx.c你写反 * LAN */ 是 ath79_eth1 /* WAN */ 是 ath79_eth0 都与 02_network 中定义的 lan switch0是 eth0 对不上  发表于 2020-12-16 20:05
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-16 20:14 | 显示全部楼层
本帖最后由 rtlhq 于 2020-12-16 20:38 编辑
fangjie88366 发表于 2020-12-16 17:50
#!/bin/sh
#
# Copyright (C) 2011-2015 OpenWrt.org

你的 mach-xxx.c 内核中
/* LAN */
        ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;      <<==== 一般switch是这个的 这里没错
        ath79_eth1_data.duplex = DUPLEX_FULL;
        ath79_switch_data.phy_poll_mask |= BIT(4);
        ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
        ath79_register_eth(1);                                          <<==== Lan 口定义为eth1

        /* WAN */
        ath79_switch_data.phy4_mii_en = 1;
        ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;   <<==== 一般百兆wan口是这个的 这里没错
        ath79_eth0_data.duplex = DUPLEX_FULL;
        ath79_eth0_data.speed = SPEED_100;
        ath79_eth0_data.phy_mask = BIT(4);
        ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
        ath79_register_eth(0);                                    <<==== wan 口定义为 eth0

        ath79_init_mac(tmpmac, mac, 0);
        ath79_register_wmac(ee, tmpmac);

以上内核定义在Qca9531中没问题


02_network
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"       <<====eth0 口定义为 LAN . eth1  口定义为 WAN
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"   <<==== 将内核中的 wan口定义为switch0

因此所得的结果 与你1楼的相符

PS:842nv3是AR9130,842nv3.1是AR9341,与Qca9531 的 02_network中wan lan对应的 eth0 eth1 值定义是不同的


点评

哪我怎么改才能让网口顺序正常呢? "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4""4@eth0"这样改对吗?  详情 回复 发表于 2020-12-16 20:37
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-16 20:37 | 显示全部楼层
rtlhq 发表于 2020-12-16 20:14
你的 mach-xxx.c 内核中
/* LAN */
        ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;  ...

哪我怎么改才能让网口顺序正常呢?
"0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4""4@eth0"这样改对吗?

点评

ucidef_set_interfaces_lan_wan "eth1.1" "eth0" ucidef_add_switch "switch0" \ "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"  详情 回复 发表于 2020-12-16 20:39
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-16 20:39 | 显示全部楼层
fangjie88366 发表于 2020-12-16 20:37
哪我怎么改才能让网口顺序正常呢?
"0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4""4@eth0"这样改对吗?

ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
                ucidef_add_switch "switch0" \
                        "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"

点评

好的我试试。感谢  详情 回复 发表于 2020-12-16 20:40
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-16 20:40 | 显示全部楼层
rtlhq 发表于 2020-12-16 20:39
ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
                ucidef_add_switch "switch0" \
     ...

好的我试试。感谢

点评

根据你发的改了下,从新编译了固件刷完,网口位置没变,lan口获取不了IP了,WiFi能获取IP  详情 回复 发表于 2020-12-16 23:38
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-26 19:46

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表