找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2794|回复: 13

求ath79的网口顺序调整方法!

[复制链接]
发表于 2021-5-4 23:37 | 显示全部楼层 |阅读模式
将openwrt刷到基于ar9331 / ar9341主控的tplink路由器时,往往需要修改源码调整网口顺序才能正常使用。网上现有的教程都是基于老的ar71xx实现,OP官方自21.02版本起以新的target——ath79完全取代ar71xx,由于ath79是采用dts(设备树)的形式描述硬件的,原有的方法不再适用,对着电脑屏幕研究了半天也没搞懂该怎么改,有dalao知道该怎么办吗?

我的恩山、我的无线 The best wifi forum is right here.
发表于 2021-5-5 00:30 | 显示全部楼层
本帖最后由 rtlhq 于 2021-5-5 00:33 编辑

无论是ar71xx还是ath79,第1次启动时生成 /etc/config/network中网口定义的文件都是根据
/etc/board.d/02_network
文件从未变过

ath79位于
  1. target/linux/ath79/generic/base-files/etc/board.d/02_network
  2. target/linux/ath79/tiny/base-files/etc/board.d/02_network
  3. target/linux/ath79/nand/base-files/etc/board.d/02_network
复制代码


我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-5-5 09:19 | 显示全部楼层
楼上正解……
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-5-5 11:49 | 显示全部楼层
rtlhq 发表于 2021-5-5 00:30
无论是ar71xx还是ath79,第1次启动时生成 /etc/config/network中网口定义的文件都是根据
/etc/board.d/02_ ...

如果是19版本的目录结构,对应的文件是target/linux/ath79/base-files/etc/board.d/02_network?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-5-5 13:13 | 显示全部楼层
本帖最后由 rtlhq 于 2021-5-5 13:26 编辑
做t咖啡 发表于 2021-5-5 11:49
如果是19版本的目录结构,对应的文件是target/linux/ath79/base-files/etc/board.d/02_network?

正解

21版target/linux/ath79/base-files/etc/board.d/02_network这个进一步精简了,按设备类型的拆分为
target/linux/ath79/generic/base-files/etc/board.d/02_network     <====== 一般的spi flash设备
target/linux/ath79/tiny/base-files/etc/board.d/02_network           <====== 小容量的spi flash设备
target/linux/ath79/nand/base-files/etc/board.d/02_network         <======  使用nand flash的设备





以上




我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-5-11 16:44 | 显示全部楼层
rtlhq 发表于 2021-5-5 13:13
正解

21版target/linux/ath79/base-files/etc/board.d/02_network这个进一步精简了,按设备类型的拆分 ...

改了快一星期还是没改成功,大佬可以贴个patch出来吗?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-5-11 20:55 | 显示全部楼层
本帖最后由 rtlhq 于 2021-5-11 20:56 编辑
做t咖啡 发表于 2021-5-11 16:44
改了快一星期还是没改成功,大佬可以贴个patch出来吗?

1.先在 dts文件中定义好 eth0,eth1,并记下wan口, ”交换机“ 是eth0还是 eth1

2.    base-files/etc/board.d/02_network  文件根据实际情况的eth0或 eth1写入对应的配置段或添加新配置.

例如

ucidef_set_interface_lan "eth0"             <==== 只有单网口eth0

ucidef_set_interface_lan "eth0 eth1"     <==== 默认eth0 和 eth1桥接在1起

ucidef_add_switch "switch0" \              <==== eth0使用交换芯片(如ar8327) 第1-4端口是定义为lan,第5端口定义为wan
        "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"

ucidef_set_interface_wan "eth1"         <==== 默认eth1是wan口,eth0是交换机
ucidef_add_switch "switch0" \
        "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"




ucidef_set_interfaces_lan_wan "eth1" "eth0"   <==== 默认eth1是lan口 ,eth0是wan口


以上
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-5-12 13:39 | 显示全部楼层
rtlhq 发表于 2021-5-11 20:55
1.先在 dts文件中定义好 eth0,eth1,并记下wan口, ”交换机“ 是eth0还是 eth1

2.    base-files/et ...

结合了下这个帖子仔细研究了下,我感觉问题的关键还是在设备树里,一直没搞明白eth0、eth1对应的端口范围在设备树中是如何确定的?比如物理端口4为什么是怎么被标记到软件定义的eth0中而不是标记到eth1中?如下是19版本的设备树文件ar9330.dtsi中相关的代码段:
  1. e0 {
  2.         compatible = "qca,ar9330-eth", "syscon";

  3.         pll-data = <0x00110000 0x00001099 0x00991099>;

  4.         resets = <&rst 9>;
  5.         reset-names = "mac";
  6.         phy-mode = "mii";
  7.         phy-handle = <&swphy4>;
  8. };

  9. &mdio1 {
  10.         status = "okay";
  11.         compatible = "qca,ar9330-mdio";

  12.         resets = <&rst 23>;
  13.         reset-names = "mdio";
  14.         builtin-switch;

  15.         builtin_switch: switch0@1f {
  16.                 compatible = "qca,ar7240sw";
  17.                 reg = <0x1f>;
  18.                 resets = <&rst 8>;
  19.                 reset-names = "switch";
  20.                 qca,mib-poll-interval = <500>;

  21.                 mdio-bus {
  22.                         #address-cells = <1>;
  23.                         #size-cells = <0>;

  24.                         swphy4: ethernet-phy@4 {
  25.                                 reg = <4>;
  26.                                 phy-mode = "mii";
  27.                         };
  28.                 };
  29.         };
  30. };

  31. e1 {
  32.         compatible = "qca,ar9330-eth", "syscon";

  33.         pll-data = <0x00110000 0x00001099 0x00991099>;
  34.         phy-mode = "gmii";

  35.         resets = <&rst 13>;
  36.         reset-names = "mac";

  37.         fixed-link {
  38.                 speed = <1000>;
  39.                 full-duplex;
  40.         };
  41. };
复制代码


我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-5-12 15:17 | 显示全部楼层
做t咖啡 发表于 2021-5-12 13:39
结合了下这个帖子仔细研究了下,我感觉问题的关键还是在设备树里,一直没搞明白eth0、eth1对应的端口范围 ...

eth0,eth1不是依據ar9330.dtsi,這個只是ar933x芯片的默認配置
實際設備都是覆蓋這個文件的配置

實際的eth0,eth1以對應設備的dts配置文件為準
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-5-12 15:39 | 显示全部楼层
rtlhq 发表于 2021-5-12 15:17
eth0,eth1不是依據ar9330.dtsi,這個只是ar933x芯片的默認配置
實際設備都是覆蓋這個文件的配置

好吧,我再看看
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-5-14 00:53 | 显示全部楼层
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-9 11:57 | 显示全部楼层
你的问题搞定没,我也碰到同样的问题了tl-r473 v3  网口完全相反
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-10 16:38 来自手机 | 显示全部楼层
网口问题还能对付着用,我编的841n v8 无限重启,现在问题不知道出在哪!是不是新的内核已经不支持ar9341
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-9-20 15:58 | 显示全部楼层
你的问题搞定没  我也同样没搞定
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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