|
本帖最后由 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口了?
附上固件地址
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|