[OpenWrt-Devel] [PATCH] ramips: add support for Asus RT-AC65P

2019-09-24 Thread vargagab
From: Gabor Varga 

The Asus RT-AC65P router is identical with the RT-AC85P, but better to make 
separate images for it.

On both routers the installation can be done also via SSH:

Note: The user/password for SSH is identical with the one used in the
Web-interface.

1. Complete the initial setup wizard.
2. Activate SSH under "Administration" -> "System".
3. Transfer the OpenWrt factory image via scp:
 > scp openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin 
 > admin@192.168.50.1:/tmp
4. Connect via SSH to the router.
 > ssh admin@192.168.50.1
5. Write the OpenWrt image to flash.
 > mtd-write -i
/tmp/openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin -d linux
6. Reboot the router
 > reboot

Signed-off-by: Gabor Varga 
---
 .../ramips/base-files/etc/board.d/02_network  |   2 +
 .../ramips/base-files/lib/upgrade/platform.sh |   2 +
 .../linux/ramips/dts/mt7621_asus_rt-ac65p.dts |   9 +
 .../linux/ramips/dts/mt7621_asus_rt-ac85p.dts | 155 +
 .../ramips/dts/mt7621_asus_rt-ac[68]5p.dtsi   | 159 ++
 target/linux/ramips/image/mt7621.mk   |  16 ++
 6 files changed, 189 insertions(+), 154 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
 create mode 100644 target/linux/ramips/dts/mt7621_asus_rt-ac[68]5p.dtsi

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 63644331e5..f66b5742ec 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -233,6 +233,7 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
;;
+   asus,rt-ac65p|\
asus,rt-ac85p|\
dlink,dir-860l-b1|\
elecom,wrc-1167ghbk2-s|\
@@ -561,6 +562,7 @@ ramips_setup_macs()
zbtlink,zbt-we3526)
wan_mac=$(mtd_get_mac_binary factory 0xe006)
;;
+   asus,rt-ac65p|\
asus,rt-ac85p)
wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index a62ded4b9d..03e994dfa4 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -18,6 +18,7 @@ platform_do_upgrade() {
mikrotik,rbm33g)
[ -z "$(rootfs_type)" ] && mtd erase firmware
;;
+   asus,rt-ac65p|\
asus,rt-ac85p)
echo "Backing up firmware"
dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
@@ -27,6 +28,7 @@ platform_do_upgrade() {
esac
 
case "$board" in
+   asus,rt-ac65p|\
asus,rt-ac85p|\
hiwifi,hc5962|\
netgear,r6220|\
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts 
b/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
new file mode 100644
index 00..d952221b48
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_asus_rt-ac[68]5p.dtsi"
+
+/ {
+   compatible = "asus,rt-ac65p", "mediatek,mt7621-soc";
+   model = "ASUS RT-AC65P";
+};
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts 
b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
index 3ddbfcfb7c..b24bbc8d06 100644
--- a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
@@ -1,162 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "mt7621.dtsi"
-
-#include 
-#include 
+#include "mt7621_asus_rt-ac[68]5p.dtsi"
 
 / {
compatible = "asus,rt-ac85p", "mediatek,mt7621-soc";
model = "ASUS RT-AC85P";
-
-   aliases {
-   led-boot = &led_power;
-   led-failsafe = &led_power;
-   led-running = &led_power;
-   led-upgrade = &led_power;
-   };
-
-   chosen {
-   bootargs = "console=ttyS0,57600";
-   };
-
-   palmbus: palmbus@1E00 {
-   i2c@900 {
-   status = "okay";
-   };
-   };
-
-   keys {
-   compatible = "gpio-keys";
-
-   reset {
-   label = "reset";
-   gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-
-   wps {
-   label = "wps";
-   gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-   };
-
-   leds {
-   compatible = "gpio-leds";
-
-   led_power: power {
-   label = "rt-ac85p:blue:power";
-   gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
-   linux,

[OpenWrt-Devel] [PATCH v2] ramips: add support for Asus RT-AC65P

2019-10-10 Thread vargagab
From: Gabor Varga 

The Asus RT-AC65P router is identical with the RT-AC85P, but better to make 
separate images for it.

On both routers the installation can be done also via SSH:

Note: The user/password for SSH is identical with the one used in the
Web-interface.

1. Complete the initial setup wizard.
2. Activate SSH under "Administration" -> "System".
3. Transfer the OpenWrt factory image via scp:
 > scp openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin 
 > admin@192.168.50.1:/tmp
4. Connect via SSH to the router.
 > ssh admin@192.168.50.1
5. Write the OpenWrt image to flash.
 > mtd-write -i
/tmp/openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin -d linux
6. Reboot the router
 > reboot

Changelog:

v2: Rebased to latest master
v1: Initial release

Signed-off-by: Gabor Varga 
---
 .../ramips/base-files/etc/board.d/02_network  |   2 +
 .../ramips/base-files/lib/upgrade/platform.sh |   2 +
 .../linux/ramips/dts/mt7621_asus_rt-ac65p.dts |   9 +
 .../linux/ramips/dts/mt7621_asus_rt-ac85p.dts | 157 +
 .../ramips/dts/mt7621_asus_rt-ac[68]5p.dtsi   | 159 ++
 target/linux/ramips/image/mt7621.mk   |  16 ++
 6 files changed, 190 insertions(+), 155 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
 create mode 100644 target/linux/ramips/dts/mt7621_asus_rt-ac[68]5p.dtsi

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 25aa075093..f5b030c908 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -234,6 +234,7 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
;;
+   asus,rt-ac65p|\
asus,rt-ac85p|\
dlink,dir-860l-b1|\
elecom,wrc-1167ghbk2-s|\
@@ -562,6 +563,7 @@ ramips_setup_macs()
zbtlink,zbt-we3526)
wan_mac=$(mtd_get_mac_binary factory 0xe006)
;;
+   asus,rt-ac65p|\
asus,rt-ac85p)
wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index a62ded4b9d..03e994dfa4 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -18,6 +18,7 @@ platform_do_upgrade() {
mikrotik,rbm33g)
[ -z "$(rootfs_type)" ] && mtd erase firmware
;;
+   asus,rt-ac65p|\
asus,rt-ac85p)
echo "Backing up firmware"
dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
@@ -27,6 +28,7 @@ platform_do_upgrade() {
esac
 
case "$board" in
+   asus,rt-ac65p|\
asus,rt-ac85p|\
hiwifi,hc5962|\
netgear,r6220|\
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts 
b/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
new file mode 100644
index 00..261839a6ea
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_asus_rt-ac[68]5p.dtsi"
+
+/ {
+   compatible = "asus,rt-ac65p", "mediatek,mt7621-soc";
+   model = "ASUS RT-AC65P";
+};
\ No newline at end of file
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts 
b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
index 3ddbfcfb7c..35103a0c24 100644
--- a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
@@ -1,162 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "mt7621.dtsi"
-
-#include 
-#include 
+#include "mt7621_asus_rt-ac[68]5p.dtsi"
 
 / {
compatible = "asus,rt-ac85p", "mediatek,mt7621-soc";
model = "ASUS RT-AC85P";
-
-   aliases {
-   led-boot = &led_power;
-   led-failsafe = &led_power;
-   led-running = &led_power;
-   led-upgrade = &led_power;
-   };
-
-   chosen {
-   bootargs = "console=ttyS0,57600";
-   };
-
-   palmbus: palmbus@1E00 {
-   i2c@900 {
-   status = "okay";
-   };
-   };
-
-   keys {
-   compatible = "gpio-keys";
-
-   reset {
-   label = "reset";
-   gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-
-   wps {
-   label = "wps";
-   gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-   };
-
-   leds {
-   compatible = "gpio-leds";
-
-   led_power: power {
-   

[OpenWrt-Devel] [PATCH v3] ramips: add support for Asus RT-AC65P

2019-10-22 Thread vargagab
From: Gabor Varga 

The Asus RT-AC65P router is identical with the RT-AC85P, but better to make 
separate images for it.

On both routers the installation can be done also via SSH:

Note: The user/password for SSH is identical with the one used in the
Web-interface.

1. Complete the initial setup wizard.
2. Activate SSH under "Administration" -> "System".
3. Transfer the OpenWrt factory image via scp:
 > scp openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin 
 > admin@192.168.50.1:/tmp
4. Connect via SSH to the router.
 > ssh admin@192.168.50.1
5. Write the OpenWrt image to flash.
 > mtd-write -i
/tmp/openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin -d linux
6. Reboot the router
 > reboot

Changelog:

v3: removed [] from filename, rebased to latest master
v2: Rebased to latest master
v1: Initial release

Signed-off-by: Gabor Varga 
---
 .../ramips/base-files/etc/board.d/02_network  |   2 +
 .../ramips/base-files/lib/upgrade/platform.sh |   2 +
 .../linux/ramips/dts/mt7621_asus_rt-ac65p.dts |   9 +
 .../linux/ramips/dts/mt7621_asus_rt-ac85p.dts | 157 +
 .../ramips/dts/mt7621_asus_rt-acx5p.dtsi  | 159 ++
 target/linux/ramips/image/mt7621.mk   |  16 ++
 6 files changed, 190 insertions(+), 155 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
 create mode 100644 target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index b6c3ae42cb..3c73a63aae 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -234,6 +234,7 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
;;
+   asus,rt-ac65p|\
asus,rt-ac85p|\
dlink,dir-860l-b1|\
elecom,wrc-1167ghbk2-s|\
@@ -562,6 +563,7 @@ ramips_setup_macs()
zbtlink,zbt-we3526)
wan_mac=$(mtd_get_mac_binary factory 0xe006)
;;
+   asus,rt-ac65p|\
asus,rt-ac85p)
wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index a62ded4b9d..03e994dfa4 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -18,6 +18,7 @@ platform_do_upgrade() {
mikrotik,rbm33g)
[ -z "$(rootfs_type)" ] && mtd erase firmware
;;
+   asus,rt-ac65p|\
asus,rt-ac85p)
echo "Backing up firmware"
dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
@@ -27,6 +28,7 @@ platform_do_upgrade() {
esac
 
case "$board" in
+   asus,rt-ac65p|\
asus,rt-ac85p|\
hiwifi,hc5962|\
netgear,r6220|\
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts 
b/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
new file mode 100644
index 00..94540e08e5
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac65p.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_asus_rt-acx5p.dtsi"
+
+/ {
+   compatible = "asus,rt-ac65p", "mediatek,mt7621-soc";
+   model = "ASUS RT-AC65P";
+};
\ No newline at end of file
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts 
b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
index 3ddbfcfb7c..9f525d26ce 100644
--- a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
@@ -1,162 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "mt7621.dtsi"
-
-#include 
-#include 
+#include "mt7621_asus_rt-acx5p.dtsi"
 
 / {
compatible = "asus,rt-ac85p", "mediatek,mt7621-soc";
model = "ASUS RT-AC85P";
-
-   aliases {
-   led-boot = &led_power;
-   led-failsafe = &led_power;
-   led-running = &led_power;
-   led-upgrade = &led_power;
-   };
-
-   chosen {
-   bootargs = "console=ttyS0,57600";
-   };
-
-   palmbus: palmbus@1E00 {
-   i2c@900 {
-   status = "okay";
-   };
-   };
-
-   keys {
-   compatible = "gpio-keys";
-
-   reset {
-   label = "reset";
-   gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-
-   wps {
-   label = "wps";
-   gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-   };
-
-   leds {
-   compatible = "gpio-le

[OpenWrt-Devel] [PATCH] mtd_get_mac_ascii Return first occurence of $key.

2019-11-26 Thread vargagab
From: Gabor Varga 

 For example on Asus RT-AC65P router (and the identical Asus RT-AC85P)
 the et1macaddr string has multiple occurences in u-boot-env partition.
 So, the mtd_get_mac_ascii cannot determine the WAN MAC address
 (called from /etc/board.d/02_network script), and with default 
 configuration the WAN and LAN MAC addresses are swapped.

Signed-off-by: Gabor Varga 
---
 package/base-files/files/lib/functions/system.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions/system.sh 
b/package/base-files/files/lib/functions/system.sh
index c4dc3cc3a9..067157f53f 100644
--- a/package/base-files/files/lib/functions/system.sh
+++ b/package/base-files/files/lib/functions/system.sh
@@ -72,7 +72,7 @@ mtd_get_mac_ascii() {
return
fi
 
-   mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
+   mac_dirty=$(strings "$part" | sed -n '1,/'"$key"'=/s/^'"$key"'=//p')
 
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
-- 
2.24.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: fix switch port numbering for RT-AC65P/RT-AC85P

2019-12-09 Thread vargagab
From: Gabor Varga 

The switch LAN port numbers are in reversed order with original config.
With this patch they are fixed.

Signed-off-by: Gabor Varga 
---
 .../linux/ramips/mt7621/base-files/etc/board.d/02_network  | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network 
b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 420780a101..42cdb4d57f 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -37,6 +37,11 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;;
+   asus,rt-ac65p|\
+   asus,rt-ac85p)
+   ucidef_add_switch "switch0" \
+   "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "0:wan" "6@eth0"
+   ;;
alfa-network,quad-e4g|\
netgear,r6220|\
netgear,r6260|\
@@ -64,8 +69,6 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
-   asus,rt-ac65p|\
-   asus,rt-ac85p|\
dlink,dir-860l-b1|\
elecom,wrc-1167ghbk2-s|\
elecom,wrc-1900gst|\
-- 
2.24.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel