找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 4593|回复: 21

e8820v2适配lede的dts

[复制链接]
本帖最后由 nmpjg 于 2023-12-21 23:55 编辑

第一次编译,可能有错误之处,多多包涵。

参考了https://www.right.com.cn/forum/f ... B%E7%BC%96%E8%AF%91,从这里起步开始了解云编译的步骤,期间对比了多个dts文件,终于把e8820v2的dts适配好了,编译lede目前看来比较完美。将dts加入到/target/linux/ramips/dts内,也可直接我仓库内的dts


// SPDX-License-Identifier: GPL-2.0-or-later OR MIT


#include "mt7621.dtsi"


#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>


/ {
        compatible = "zte,e8820v2", "mediatek,mt7621-soc";
        model = "ZTE E8820V2";


        aliases {
                led-boot = &led_sys;
                led-failsafe = &led_sys;
                led-running = &led_sys;
                led-upgrade = &led_sys;
                label-mac-device = &gmac0;
        };


        chosen {
                bootargs = "console=ttyS0,115200";
        };


        leds {
                compatible = "gpio-leds";


                led_sys: sys {
                        label = "white:sys";
                        gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
                };


                power {
                        label = "white:power";
                        gpios = <&gpio 31 GPIO_ACTIVE_LOW>;
                };
        };


        keys {
                compatible = "gpio-keys";


                reset {
                        label = "reset";
                        gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_RESTART>;
                };


                wps {
                        label = "wps";
                        gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WPS_BUTTON>;
                };
        };
};


# 以上定义led和按键的gpio


&spi0 {
        status = "okay";


        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <25000000>;
                broken-flash-reset;
                m25p,fast-read;


                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;


                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x30000>;
                                read-only;
                        };


                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
                                read-only;
                        };


                        factory: partition@40000 {
                                label = "factory";
                                reg = <0x40000 0x10000>;
                                read-only;
                        };


                        partition@50000 {
                                compatible = "denx,uimage";
                                label = "firmware";
                                reg = <0x50000 0xfb0000>;
                        };
                };
        };
};


# 以上定义rom分区


&pcie {
        status = "okay";
        reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>,
                                  <&gpio 4 GPIO_ACTIVE_LOW>;
};


&pcie0 {
        wifi@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x0000>;
                mtd-mac-address = <&factory 0xe000>;


                led {
                        led-active-low;
                };
        };


};


&pcie1 {
        wifi@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                mtd-mac-address = <&factory 0xe006>;
                ieee80211-freq-limit = <5000000 6000000>;


                led {
                        led-sources = <2>;
                        led-active-low;
                };
        };


};


# 以上定义pcie连接的无线部分


&gmac0 {
        mtd-mac-address = <&factory 0xe000>;
};


&gsw {
        mediatek,portmap = "llllw";
        status = "okay";
};


&hnat {
        mtketh-wan = "eth0.2";
        mtketh-ppd = "eth0.1";
        mtketh-lan = "eth0";
        mtketh-max-gmac = <1>;
        /delete-property/ mtkdsa-wan-port;
};


&switch0 {
        status = "disabled";
};


# 以上定义交换机,经过测试e8820v2只支持一个gmac,不知是驱动问题还是硬件限制,目前lede库内d2也只支持一个gmac,但恩山论坛有人给到开源hwnat可以让d2支持两个gmac。不知道谁能解决这个问题。


&state_default {
        gpio {
                groups = "i2c", "uart2", "uart3", "wdt";
                function = "gpio";
        };
};

led、usb正常驱动,开启了交换机(虽然只有一个gmac,推测跟newifi3 d2一样需要去掉一个电容)。

然后在/target/linux/ramips/image下的mt7621.mk中添加机型,如下:

define Device/zte_e8820v2
  $(Device/dsa-migration)
  $(Device/uimage-lzma-loader)
  IMAGE_SIZE := 16064k
  DEVICE_VENDOR := ZTE
  DEVICE_MODEL := E8820V2
  DEVICE_COMPAT_VERSION := 2.0
  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb2 \
          kmod-usb-ledtrig-usbport kmod-cfg80211 kmod-mac80211
TARGET_DEVICES += zte_e8820v2


32m需要将IMAGE_SIZE的值修改为32448k

开启交换机需要编辑/target/linux/ramips/mt7621/base-files/etc/board.d/02_network,添加如下内容:


ramips_setup_interfaces()
......
        zte,e8820v2)
                ucidef_add_switch "switch0" \
                        "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
                ;;
......
ramips_setup_macs()
......
        zte,e8820v2)
                lan_mac=$(cat /sys/class/net/eth0/address)
                wan_mac=$(mtd_get_mac_binary factory 0xe006)
                ;;
......

我的github库是https://github.com/NoopLoop00/lede,云编译库是https://github.com/NoopLoop00/Actions-OpenWrt,需要文件可以自取。

目前根据自身需要编译了一个固件,需要32m的rom,集成的功能如图,另外添加了对rndis网卡的支持。


说下个人的疑惑,这货明明只是个usb2口,为什么不选usb3它就没办法使用usb口了?
附上固件地址
链接: https://pan.baidu.com/s/11iEUdTKL2CjUuUTrthGjxw 提取码: sewh 复制这段内容后打开百度网盘手机App,操作更方便哦





本帖子中包含更多资源

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

×
来自手机 | 显示全部楼层
小内存,mt7621时代过了,玩wifi6硬件吧
回复

使用道具 举报

8 8 2 0 v 2
回复

使用道具 举报

E8820S  的出一个吧
回复

使用道具 举报

哇,找了好久
回复

使用道具 举报

刷进去了 ,不过电脑网卡无法获取到IP地址。是不是内存不够,启动不了
回复

使用道具 举报

 楼主| | 显示全部楼层
myleon 发表于 2023-12-28 18:01
刷进去了 ,不过电脑网卡无法获取到IP地址。是不是内存不够,启动不了

内存不够,要改128m
回复

使用道具 举报

 楼主| | 显示全部楼层

8820s lede就有,直接编译就行了
回复

使用道具 举报

好好好谢谢分享
回复

使用道具 举报

d'ddddddddddddddddddddddddddddddd
回复

使用道具 举报

来自手机 | 显示全部楼层
看起来很好用的固件
回复

使用道具 举报

&gmac0 {         mtd-mac-address = <&factory 0xe000>; };  &gmac1 {         label = "wan";         phy-handle = <&ethphy4>;         mtd-mac-address = <&factory 0xe006>;         status = "okay"; };  &mdio {         ethphy4: ethernet-phy@4 {                 reg = <4>;         }; };  &switch0 {         ports {                 port@0 {                         status = "okay";                         label = "lan1";                 };                  port@1 {                         status = "okay";                         label = "lan2";                 };                  port@2 {                         status = "okay";                         label = "lan3";                 };                  port@3 {                         status = "okay";                         label = "lan4";                 };         }; }; 交换机这里这样写就可以启用两个gmac了
回复

使用道具 举报

很老的机型了,哈哈
回复

使用道具 举报

新消息思考思考
回复

使用道具 举报

很牛逼了,谢谢楼主
回复

使用道具 举报

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

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

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

GMT+8, 2024-5-14 05:53

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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