Merge branch 'main' of github.com:FUjr/gl-infra-builder into main

This commit is contained in:
fujr 2023-06-25 11:01:21 +08:00
commit a5c9c6e1ee
9 changed files with 745 additions and 148 deletions

View File

@ -124,7 +124,53 @@ X3000
# Example compile firmware # Example compile firmware
## 1. Compile MT2500(2023.03.17) ## 1. Compile MT2500(2023.03.17)
## 0.Compile 360T72023.2.27
0.0
with gl-inet package installed,original partition is not big enough,you should flash the bl blow.
https://github.com/hanwckf/bl-mt798x
1.1 Compile 360t7-108M OpenWrt firmware(No GL.iNet packages)
```
git clone https://github.com/gl-inet/gl-infra-builder.git && cd gl-infra-builder
```
```
python3 setup.py -c configs/config-mt798x-7.6.6.1.yml && cd mt7981
```
```
./scripts/gen_config.py target_mt7981_360t7-108M luci
```
1.2 Compile 360t7-108M GL.iNet standard firmware
```
git clone https://github.com/gl-inet/glinet4.x.git
```
```
cp ./glinet4.x/pkg_config/gl_pkg_config_mt7981_mt3000.mk ./glinet4.x/mt7981/gl_pkg_config.mk
```
```
./scripts/gen_config.py target_mt7981_360t7-108M glinet_depends
```
```
make V=s -j5 GL_PKGDIR=`pwd`/glinet4.x/mt7981/
```
##
## 1. Compile MT2500(2023.02.22)
1.1 Compile MT2500 OpenWrt firmware(No GL.iNet packages) 1.1 Compile MT2500 OpenWrt firmware(No GL.iNet packages)
``` ```
@ -142,6 +188,7 @@ make V=s -j5
1.2 Compile MT2500 GL.iNet standard firmware 1.2 Compile MT2500 GL.iNet standard firmware
``` ```
git clone https://github.com/gl-inet/glinet4.x.git git clone https://github.com/gl-inet/glinet4.x.git
``` ```

View File

@ -1,144 +0,0 @@
From 140ddd19397760be888eb3aa0a977182a30e9f9e Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 19 Sep 2022 14:11:34 +0800
Subject: [PATCH] target/mediatek: mtk-eth poll gpy211 link state
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
.../net/ethernet/mediatek/mtk_eth_dbg.c | 8 ++--
.../net/ethernet/mediatek/mtk_eth_soc.c | 44 +++++++++++++++++--
.../drivers/net/ethernet/mediatek/mtk_sgmii.c | 5 ++-
3 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
index 0d5ca16e4f..8977afb21c 100755
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
@@ -417,7 +417,7 @@ void mii_mgr_read_combine(struct mtk_eth *eth, u32 phy_addr, u32 phy_register,
*read_data = mt7530_mdio_r32(eth, phy_register);
else
- *read_data = _mtk_mdio_read(eth, phy_addr, phy_register);
+ *read_data = mdiobus_read(eth->mii_bus, phy_addr, phy_register);
}
void mii_mgr_write_combine(struct mtk_eth *eth, u16 phy_addr, u16 phy_register,
@@ -427,17 +427,17 @@ void mii_mgr_write_combine(struct mtk_eth *eth, u16 phy_addr, u16 phy_register,
mt7530_mdio_w32(eth, phy_register, write_data);
else
- _mtk_mdio_write(eth, phy_addr, phy_register, write_data);
+ mdiobus_write(eth->mii_bus, phy_addr, phy_register, write_data);
}
static void mii_mgr_read_cl45(struct mtk_eth *eth, u16 port, u16 devad, u16 reg, u16 *data)
{
- *data = _mtk_mdio_read(eth, port, mdiobus_c45_addr(devad, reg));
+ *data = mdiobus_read(eth->mii_bus, port, mdiobus_c45_addr(devad, reg));
}
static void mii_mgr_write_cl45(struct mtk_eth *eth, u16 port, u16 devad, u16 reg, u16 data)
{
- _mtk_mdio_write(eth, port, mdiobus_c45_addr(devad, reg), data);
+ mdiobus_write(eth->mii_bus, port, mdiobus_c45_addr(devad, reg), data);
}
int mtk_do_priv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a05cd19df6..d97776ba00 100755
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2765,10 +2765,10 @@ static int mtk_open(struct net_device *dev)
*/
// clear interrupt source for gpy211
- _mtk_mdio_read(eth, phylink_priv->phyaddr, 0x1A);
+ mdiobus_read(eth->mii_bus, phylink_priv->phyaddr, 0x1A);
// enable link status change interrupt for gpy211
- _mtk_mdio_write(eth, phylink_priv->phyaddr, 0x19, 0x0001);
+ mdiobus_write(eth->mii_bus, phylink_priv->phyaddr, 0x19, 0x0001);
phylink_priv->dev = dev;
@@ -2828,9 +2828,9 @@ static int mtk_stop(struct net_device *dev)
phy_node = of_parse_phandle(mac->of_node, "phy-handle", 0);
if (phy_node) {
- val = _mtk_mdio_read(eth, 0, 0);
+ val = mdiobus_read(eth->mii_bus, 0, 0);
val |= BMCR_PDOWN;
- _mtk_mdio_write(eth, 0, 0, val);
+ mdiobus_write(eth->mii_bus, 0, 0, val);
} else if (eth->sgmii->regmap[mac->id]) {
regmap_read(eth->sgmii->regmap[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, &val);
val |= SGMII_PHYA_PWD;
@@ -3509,6 +3509,40 @@ static const struct net_device_ops mtk_netdev_ops = {
#endif
};
+static void phylink_fixed_state(struct net_device *dev,
+ struct phylink_link_state *state)
+{
+#define PHY_MIISTAT 0x18 /* MII state */
+#define PHY_MIISTAT_SPD_MASK GENMASK(2, 0)
+#define PHY_MIISTAT_DPX BIT(3)
+#define PHY_MIISTAT_LS BIT(10)
+#define PHY_MIISTAT_SPD_10 0
+#define PHY_MIISTAT_SPD_100 1
+#define PHY_MIISTAT_SPD_1000 2
+#define PHY_MIISTAT_SPD_2500 4
+
+ struct mtk_mac *mac = netdev_priv(dev);
+ u32 val = mdiobus_read(mac->hw->mii_bus, 0x05, PHY_MIISTAT);
+
+ state->link = (val & PHY_MIISTAT_LS) ? 1 : 0;
+ state->duplex = (val & PHY_MIISTAT_DPX) ? DUPLEX_FULL : DUPLEX_HALF;
+
+ switch (FIELD_GET(PHY_MIISTAT_SPD_MASK, val)) {
+ case PHY_MIISTAT_SPD_10:
+ state->speed = SPEED_10;
+ break;
+ case PHY_MIISTAT_SPD_100:
+ state->speed = SPEED_100;
+ break;
+ case PHY_MIISTAT_SPD_1000:
+ state->speed = SPEED_1000;
+ break;
+ case PHY_MIISTAT_SPD_2500:
+ state->speed = SPEED_2500;
+ break;
+ }
+}
+
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{
const __be32 *_id = of_get_property(np, "reg", NULL);
@@ -3590,6 +3624,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
fixed_node = fwnode_get_named_child_node(of_fwnode_handle(mac->of_node),
"fixed-link");
if (fixed_node) {
+ phylink_fixed_state_cb(phylink, phylink_fixed_state);
+
desc = fwnode_get_named_gpiod(fixed_node, "link-gpio",
0, GPIOD_IN, "?");
if (!IS_ERR(desc)) {
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
index 8198c7cb59..e0406e2b86 100755
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
@@ -111,7 +111,10 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, unsigned int id,
val |= SGMII_SPEED_10;
break;
case SPEED_100:
- val |= SGMII_SPEED_100;
+ if (state->interface == PHY_INTERFACE_MODE_2500BASEX)
+ val |= SGMII_SPEED_1000;
+ else
+ val |= SGMII_SPEED_100;
break;
case SPEED_2500:
case SPEED_1000:
--
2.25.1

View File

@ -0,0 +1,482 @@
From c96d75cce852adf3106112c33b920ed8e52baa35 Mon Sep 17 00:00:00 2001
From: fujr <fjrcn@outlook.com>
Date: Tue, 28 Feb 2023 05:22:15 +0800
Subject: [PATCH 2/2] Add support for qihoo 360T7
---
.../boot/dts/mediatek/mt7981-360-t7-108M.dts | 61 +++++
.../boot/dts/mediatek/mt7981-360-t7-base.dtsi | 242 ++++++++++++++++++
target/linux/mediatek/image/mt7981.mk | 35 +++
.../mt7981/base-files/etc/board.d/01_leds | 6 +
.../mt7981/base-files/etc/board.d/02_network | 59 +++++
5 files changed, 403 insertions(+)
create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-108M.dts
create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-base.dtsi
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-108M.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-108M.dts
new file mode 100644
index 0000000000..c1749442e3
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-108M.dts
@@ -0,0 +1,61 @@
+/dts-v1/;
+#include "mt7981-360-t7-base.dtsi"
+
+/ {
+ nmbm_spim_nand {
+ compatible = "generic,nmbm";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ lower-mtd-device = <&spi_nand>;
+ forced-create;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00 0x100000>;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x6c00000>;
+ };
+
+ partition@7180000 {
+ label = "stock-config";
+ reg = <0x7180000 0x100000>;
+ };
+
+ partition@7280000 {
+ label = "stock-factory";
+ reg = <0x7280000 0x80000>;
+ };
+
+ partition@7300000 {
+ label = "stock-log";
+ reg = <0x7300000 0x400000>;
+ };
+ };
+ };
+};
+
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-base.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-base.dtsi
new file mode 100644
index 0000000000..271dc68f57
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7-base.dtsi
@@ -0,0 +1,242 @@
+/dts-v1/;
+#include "mt7981.dtsi"
+
+/ {
+ model = "360 T7";
+ compatible = "360,t7", "mediatek,mt7981";
+
+ aliases {
+ led-boot = &red_led;
+ led-failsafe = &red_led;
+ led-running = &green_led;
+ led-upgrade = &green_led;
+ };
+
+
+ gl-hw {
+ compatible = "gl-hw-info";
+ model = "mt3000";
+ wan = "eth1";
+ lan = "eth0";
+ temperature = "/sys/devices/virtual/thermal/thermal_zone0/temp";
+ switch-button = "gpio-455";
+ reset-button = "gpio-456";
+ radio = "mt798111 mt798112";
+ cfg-partition = "/dev/mtd7";
+ flash_size = <128>;
+ dfs;
+ factory_data {
+ device_mac = "stock-factory", "0xb0";
+ device_ddns = "stock-factory", "0xc0";
+ device_sn_bak = "stock-factory", "0xd0";
+ device_sn = "stock-factory", "0xe0";
+ country_code = "stock-factory", "0x7a";
+ };
+ };
+
+
+ chosen {
+ bootargs = "console=ttyS0,115200n1 loglevel=8 \
+ earlycon=uart8250,mmio32,0x11002000";
+ };
+
+ memory {
+ reg = <0 0x40000000 0 0x10000000>;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ green_led: green {
+ label = "360t7:green";
+ gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ red_led: red {
+ label = "360t7:red";
+ gpios = <&pio 3 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ wps {
+ label = "wps";
+ linux,code = <KEY_WPS_BUTTON>;
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gsw: gsw@0 {
+ compatible = "mediatek,mt753x";
+ mediatek,ethsys = <&ethsys>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
+
+&eth {
+ status = "okay";
+
+ gmac0: mac@0 {
+ compatible = "mediatek,eth-mac";
+ reg = <0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+
+ gmac1: mac@1 {
+ compatible = "mediatek,eth-mac";
+ reg = <1>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+ mdio: mdio-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+
+};
+
+&gsw {
+ mediatek,mdio = <&mdio>;
+ mediatek,mdio_master_pinmux = <0>;
+ reset-gpios = <&pio 39 0>;
+ interrupt-parent = <&pio>;
+ interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
+ status = "okay";
+
+ port5: port@5 {
+ compatible = "mediatek,mt753x-port";
+ reg = <5>;
+ phy-mode = "sgmii";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ };
+ };
+
+ port6: port@6 {
+ compatible = "mediatek,mt753x-port";
+ mediatek,ssc-on;
+ reg = <6>;
+ phy-mode = "sgmii";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ };
+ };
+};
+
+&hnat {
+ mtketh-wan = "eth0";
+ mtketh-lan = "eth1";
+ mtketh-ppd = "eth1";
+ mtketh-max-gmac = <2>;
+ status = "okay";
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_flash_pins>;
+ status = "okay";
+
+ spi_nand: spi_nand@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+ spi-tx-buswidth = <4>;
+ spi-rx-buswidth = <4>;
+ spi-cal-enable;
+ spi-cal-mode = "read-data";
+ spi-cal-datalen = <7>;
+ spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; /* 'SPINAND' */
+ spi-cal-addrlen = <5>;
+ spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
+ };
+};
+
+&pio {
+ pwm0_pin: pwm0-pin-g0 {
+ mux {
+ function = "pwm";
+ groups = "pwm0_0";
+ };
+ };
+
+ pwm1_pin: pwm1-pin-g0 {
+ mux {
+ function = "pwm";
+ groups = "pwm1_0";
+ };
+ };
+
+ pwm2_pin: pwm2-pin {
+ mux {
+ function = "pwm";
+ groups = "pwm2";
+ };
+ };
+
+ spi0_flash_pins: spi0-pins {
+ mux {
+ function = "spi";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
+ };
+ };
+
+ uart1_pins: uart1-pins-g1 {
+ mux {
+ function = "uart";
+ groups = "uart1_1";
+ };
+ };
+
+ uart2_pins: uart2-pins-g1 {
+ mux {
+ function = "uart";
+ groups = "uart2_1";
+ };
+ };
+};
+
diff --git a/target/linux/mediatek/image/mt7981.mk b/target/linux/mediatek/image/mt7981.mk
index b7f1f6d437..7a436bb61d 100755
--- a/target/linux/mediatek/image/mt7981.mk
+++ b/target/linux/mediatek/image/mt7981.mk
@@ -222,3 +222,38 @@ define Device/glinet_gl-mt2500
IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
endef
TARGET_DEVICES += glinet_gl-mt2500
+
+define Device/mt7981-360-t7
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := 360 T7
+ DEVICE_DTS := mt7981-360-t7
+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
+ SUPPORTED_DEVICES := 360,t7
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ IMAGE_SIZE := 36864k
+ KERNEL_IN_UBI := 1
+ IMAGES += factory.bin
+ IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += mt7981-360-t7
+
+define Device/mt7981-360-t7-108M
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := 360 T7 (with 108M ubi)
+ DEVICE_DTS := mt7981-360-t7-108M
+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
+ SUPPORTED_DEVICES := 360,t7
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ IMAGE_SIZE := 110592k
+ KERNEL_IN_UBI := 1
+ IMAGES += factory.bin
+ IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += mt7981-360-t7-108M
+
diff --git a/target/linux/mediatek/mt7981/base-files/etc/board.d/01_leds b/target/linux/mediatek/mt7981/base-files/etc/board.d/01_leds
index 43905e604d..779ac123b1 100755
--- a/target/linux/mediatek/mt7981/base-files/etc/board.d/01_leds
+++ b/target/linux/mediatek/mt7981/base-files/etc/board.d/01_leds
@@ -13,6 +13,12 @@ glinet,x3000-emmc)
ucidef_set_led_default "power" "POWER" "power" "1"
;;
esac
+case "$(board_name)" in
+*360,t7*)
+ ucidef_set_led_default "green" "GREEN" "360t7:green" "1"
+ ucidef_set_led_default "red" "RED" "360t7:red" "0"
+ ;;
+esac
board_config_flush
diff --git a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
index c2a22e425b..936ea35aea 100755
--- a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network
@@ -28,18 +28,63 @@ mediatek_setup_interfaces()
*mt2500*)
ucidef_set_interfaces_lan_wan eth1 eth0
;;
+ *360,t7*)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" \
+ "0:lan" "1:lan" "2:lan" "3:wan" "6u@eth0" "5u@eth1"
+ ;;
*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1
;;
esac
}
+mtk_facrory_write_mac()
+{
+ local part_name=$1
+ local offset=$2
+ local macaddr=$3 #aa:bb:cc:dd:ee:ff
+ local data=""
+
+ part=$(find_mtd_part $part_name)
+ if [ -n "$part" ] && [ -n "$macaddr" ]; then
+ local i=1
+ for x in ${macaddr//:/ }; do
+ [ $i -gt 6 ] && break
+ data=${data}"\x${x}"
+ i=$((i+1))
+ done
+ dd if=$part of=/tmp/Factory.backup
+ printf "${data}" | dd conv=notrunc of=/tmp/Factory.backup bs=1 seek=$((${offset}))
+ mtd write /tmp/Factory.backup $part_name
+ rm -rf /tmp/Factory.backup
+ fi
+}
+
+mtk_factory_get_byte()
+{
+ local part_name=$1
+ local offset=$2
+ local len=$3
+
+ part=$(find_mtd_part $part_name)
+ if [ -n "$part" ]; then
+ hexdump -n $len -s $offset -e ''`expr ${len} - 1`'/1 "%02x-" "%02x"' $part
+ fi
+}
+
+
mediatek_setup_macs()
{
local board="$1"
local part_name="Factory"
local lan_mac=""
local wan_mac=""
+ local lan_mac_offset="0x2A"
+ local wan_mac_offset="0x24"
+
+ lan_mac=$(mtd_get_mac_binary $part_name $lan_mac_offset)
+ wan_mac=$(mtd_get_mac_binary $part_name $wan_mac_offset)
case $board in
*mt3000*)
@@ -55,6 +100,20 @@ mediatek_setup_macs()
wan_mac=$(get_mac_binary /dev/mmcblk0p3 0x0a)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
+ *360,t7*)
+ local part=$(find_mtd_part "stock-factory")
+ if [ -n "$part" ]; then
+ local factoryMac="$(dd if=$part bs=1 count=200 2>/dev/null |grep "^lanMac=")"
+ if [ -n "$factoryMac" ]; then
+ lan_mac="${factoryMac#lanMac=}"
+ wan_mac="$(macaddr_add $lan_mac 0x1)"
+ if [ "$(mtk_factory_get_byte "Factory" 4 2)" = "00-0c" ]; then
+ local wifi_mac="$(macaddr_add $lan_mac 0x2)"
+ mtk_facrory_write_mac "Factory" 4 $wifi_mac
+ fi
+ fi
+ fi
+ ;;
esac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
--
2.25.1

View File

@ -0,0 +1,90 @@
From 12c791651c6ff7117e9ef7b2751e96a04e579458 Mon Sep 17 00:00:00 2001
From: fujr <fjrcn@outlook.com>
Date: Thu, 2 Mar 2023 06:38:10 +0800
Subject: [PATCH] add support for origin uboot of 360t7(not recommmand)
---
.../arm64/boot/dts/mediatek/mt7981-360-t7.dts | 71 +++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7.dts
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7.dts
new file mode 100644
index 0000000000..8b1de92dfa
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-360-t7.dts
@@ -0,0 +1,71 @@
+/dts-v1/;
+#include "mt7981-360-t7-base.dtsi"
+
+/ {
+ nmbm_spim_nand {
+ compatible = "generic,nmbm";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ lower-mtd-device = <&spi_nand>;
+ forced-create;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00 0x100000>;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x2400000>;
+ };
+
+ partition@2980000 {
+ label = "firmware-1";
+ reg = <0x2980000 0x2400000>;
+ };
+
+ partition@4D80000 {
+ label = "plugin";
+ reg = <0x4d80000 0x2400000>;
+ };
+
+ partition@7180000 {
+ label = "stock-config";
+ reg = <0x7180000 0x100000>;
+ };
+
+ partition@7280000 {
+ label = "stock-factory";
+ reg = <0x7280000 0x80000>;
+ };
+
+ partition@7300000 {
+ label = "stock-log";
+ reg = <0x7300000 0x400000>;
+ };
+ };
+ };
+};
+
--
2.25.1

View File

@ -98,14 +98,19 @@ packages:
- tor - tor
- tor-geoip - tor-geoip
- swconfig - swconfig
- dhcpdiscover
- vsftpd-tls
- nfs-kernel-server - nfs-kernel-server
- nfs-kernel-server-utils - nfs-kernel-server-utils
- kmod-zram
- tailscale - tailscale
- tailscaled
- dhcpdiscover
- zram-swap
- zerotier - zerotier
- kmod-fs-nfs-v4
- kmod-fs-nfsd
- nfs-kernel-server
- nfs-utils-libs
- vsftpd-tls
diffconfig: | diffconfig: |
CONFIG_SIGNATURE_CHECK=n CONFIG_SIGNATURE_CHECK=n

View File

@ -0,0 +1,18 @@
---
description: Add the glinet dependencies for the GL.iNET MT3000
feeds:
- name: mt7981_private
uri: https://gitlab.com/gl.sdk4.0/gl.router/mt7981-feeds.git
revision: c4306a00ef9b5067e83e30378ddd6b5fdaf0ce84
- name: glinet
uri: https://gitlab.com/gl.sdk4.0/gl.router/gl-sdk4-collect.git
revision: 9f4a704d13a5e6d18f8f7daccdc26997688b023f
packages:
- gl-sdk4-led
- gl-sdk4-adguardhome
- gl-sdk4-timer
- gl-sdk4-igmp
- gl-sdk4-mwan3
- gl-sdk4-ui-hwnat

View File

@ -0,0 +1,18 @@
---
description: Add the glinet dependencies for the GL.iNET MT3000
feeds:
- name: mt7981_private
uri: https://gitlab.com/gl.sdk4.0/gl.router/mt7981-feeds.git
revision: c4306a00ef9b5067e83e30378ddd6b5fdaf0ce84
- name: glinet
uri: https://gitlab.com/gl.sdk4.0/gl.router/gl-sdk4-collect.git
revision: 9f4a704d13a5e6d18f8f7daccdc26997688b023f
packages:
- gl-sdk4-led
- gl-sdk4-adguardhome
- gl-sdk4-timer
- gl-sdk4-igmp
- gl-sdk4-mwan3
- gl-sdk4-ui-hwnat

View File

@ -0,0 +1,35 @@
---
profile: mt7981-360-t7-108M
target: mediatek
subtarget: mt7981
description: Build image for the GL.iNET 360T7 108M
feeds:
- name: gl_feed_common
uri: https://github.com/gl-inet/gl-feeds.git
revision: ac1ff5fb455c6d304aa435abb1c3eccf4878e28b
- name: gl_feed_21_02
uri: https://github.com/gl-inet/gl-feeds.git
revision: 581563a214d313c367d7ffe5a1e9038fc18292ed
- name: gl_feed_mtk
uri: https://github.com/gl-inet/gl-feeds.git
revision: 5e48f72b4020fca612bedc480231c9081a00efa4
packages:
- ethtool
- iwinfo
- wireless-tools
- gl-sdk4-mtk-wifi-v2
- kmod-conninfra-mt7981-ko
- kmod-mt-wifi-mt7981-ko
- kmod-warp-mt7981-ko
- kmod-mediatek_hnat
- kmod-gl-sdk4-fan
- mii_mgr
- mtkhnat_util
- regs
- luci
- 8021xd
- fwdd
- kmod-mtfwd
- kmod-mtqos

View File

@ -0,0 +1,46 @@
---
profile: mt7981-360-t7-108M
target: mediatek
subtarget: mt7981
description: Build image for the GL.iNET 360T7 108M
feeds:
- name: gl_feed_common
uri: https://github.com/gl-inet/gl-feeds.git
revision: ac1ff5fb455c6d304aa435abb1c3eccf4878e28b
- name: gl_feed_21_02
uri: https://github.com/gl-inet/gl-feeds.git
revision: 581563a214d313c367d7ffe5a1e9038fc18292ed
- name: gl_feed_mtk
uri: https://github.com/gl-inet/gl-feeds.git
revision: 5e48f72b4020fca612bedc480231c9081a00efa4
packages:
- ethtool
- iwinfo
- wireless-tools
- gl-sdk4-mtk-wifi-v2
- kmod-conninfra-mt7981-ko
- kmod-mt-wifi-mt7981-ko
- kmod-warp-mt7981-ko
- kmod-mediatek_hnat
- kmod-gl-sdk4-fan
- mii_mgr
- mtkhnat_util
- regs
- luci
- 8021xd
- fwdd
- kmod-mtfwd
- kmod-mtqos
- kmod-zram
- tailscale
- tailscaled
- dhcpdiscover
- zram-swap
- zerotier
- kmod-fs-nfs-v4
- kmod-fs-nfsd
- nfs-kernel-server
- nfs-utils-libs
- vsftpd-tls