Wavlink WL-WN586X3 ver. a -- installation advice

These are cheap decent filogic routers for OpenWrt. There is however a bit of trouble getting it to load due to the fact that they were made with at least two 16MB spi-nor flash chips that I know of, maybe more. I have two of them, one has a Fudan Microelectronics FM25Q128 and the other has a Boya Microelectronics BY25Q128AS. The Fudan will identify properly as a generic spi-nor chip and the initial flash works without an issue. The Boya on the other hand does not identify as generic and no driver for it is included in OpenWrt. This one will not flash successfully. I have made a driver patch for the Boya chip. There is one for 24.10 and another for snapshot as the syntax is different.

The other issue is that the current sysupgrade.bin images will work fine for the initial flash for the Fudan (NOT the Boya due to the driver issue) using the original instructions but cannot be used for sysupgrades afterwards. I have made a new filogic.mk entry for this model that will now make a factory.bin file that can be used for the initial flash as well as a sysupgrade.bin file that can be used for subsequent upgrades. I have tested this on both chips using snapshot and 24.10 successfully.

Here is my Google Drive folder with the necessary files.

Also my Github (only for snapshot)

Updated instructions:

ssh Installation Method
--------------------------
1. Connect the PC to one of the lan ports
2. Navigate to http://192.168.10.1
3. Log into the Wavlink WebGUI. The default password is admin.
   Navigate to http://192.168.10.1/html/upgrade.html (skip all setup)
4. Use the WebGUI to upgrade the firmware to
   WAVLINK_WN586X3-A_M86X3A_V240113_WO-GDBYFM-modified.bin
   download from:
   https://github.com/themaverickdm/firmware-misc/tree/main/wavlink/wl-wn586x3
   (also included in my Google Drive folder)
5. Wait about 5 minutes (seriously!!), log into the router
   using ssh root@192.168.10.1 with admin123 as the password
6. scp the openwrt-mediatek-filogic-wavlink_wl-wn586x3-squashfs-sysupgrade.bin
   file onto the router, under /tmp
7. Using ssh flash the openwrt image file like so:
     mtd -r write \
     /tmp/openwrt-mediatek-filogic-wavlink_wl-wn586x3-squashfs-sysupgrade.bin \
     firmware
8. Wait about 5 minutes, log into the router at http://192.168.1.1 (no password)
9. Use Luci (or CLI) to upgrade using the sysupgrade.bin file,
   this will complete the install process

Updated filogic.mk entry

define Device/wavlink_wl-wn586x3
  DEVICE_VENDOR := WAVLINK
  DEVICE_MODEL := WL-WN586X3
  DEVICE_DTS := mt7981b-wavlink-wl-wn586x3
  DEVICE_DTS_DIR := ../dts
  DEVICE_DTS_LOADADDR := 0x47000000
  DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
  IMAGE_SIZE := 14336k
  IMAGES := sysupgrade.bin
  KERNEL := kernel-bin | lzma | \
	fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
  IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata
endef
TARGET_DEVICES += wavlink_wl-wn586x3

I have also made changes to the dts file for this model (this is for snapshot, the version for 24.10 is in my Google Drive)

// SPDX-License-Identifier: (GPL-2.0 OR MIT)

/dts-v1/;

#include <dt-bindings/pinctrl/mt65xx.h>

#include "mt7981b.dtsi"

/ {
	model = "WAVLINK WL-WN586X3";
	compatible = "wavlink,wl-wn586x3", "mediatek,mt7981";

	aliases {
		label-mac-device = &wifi;
		led-boot = &led_status_blue;
		led-failsafe = &led_status_blue;
		led-running = &led_status_blue;
		led-upgrade = &led_status_blue;
		serial0 = &uart0;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	gpio-keys {
		compatible = "gpio-keys";

		button-0 {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&pio 11 GPIO_ACTIVE_LOW>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led-0 {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_WAN;
			gpios = <&pio 5 GPIO_ACTIVE_LOW>;
		};

		led-1 {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_WLAN;
			gpios = <&pio 9 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy1tpt";
		};

		led_status_blue: led-2 {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&pio 10 GPIO_ACTIVE_LOW>;
		};

		led-3 {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_LAN;
			function-enumerator = <1>;
			gpios = <&pio 12 GPIO_ACTIVE_LOW>;
		};

		led-4 {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_LAN;
			function-enumerator = <2>;
			gpios = <&pio 13 GPIO_ACTIVE_LOW>;
		};

	};
};

&uart0 {
	status = "okay";
};

&watchdog {
	status = "okay";
};

&eth {
    pinctrl-names = "default";
	pinctrl-0 = <&mdio_pins>;

	status = "okay";

	gmac0: mac@0 {
		compatible = "mediatek,eth-mac";
		reg = <0>;
		phy-mode = "2500base-x";
		nvmem-cells = <&macaddr_hw_44e 0>;
		nvmem-cell-names = "mac-address";

		fixed-link {
			speed = <2500>;
			full-duplex;
			pause;
		};
	};

	gmac1: mac@1 {
		compatible = "mediatek,eth-mac";
		reg = <1>;
		phy-mode = "gmii";
		phy-handle = <&int_gbe_phy>;
		nvmem-cells = <&macaddr_hw_44e 1>;
		nvmem-cell-names = "mac-address";
	};
};

&mdio_bus {
	switch: switch@1f {
		compatible = "mediatek,mt7531";
		reg = <31>;
		reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
	};
};

&spi0 {
	status = "disabled";
};

&spi2 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi2_flash_pins>;
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;

		spi-max-frequency = <50000000>;
		
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "bl2";
				reg = <0x00000 0x40000>;
				read-only;
			};

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

			factory: partition@50000 {
				label = "factory";
				reg = <0x50000 0xb0000>;
				read-only;

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

					eeprom_factory_0: eeprom@0 {
						reg = <0x0 0x1000>;
					};
				};
			};

			partition@100000 {
				label = "fip";
				reg = <0x100000 0x80000>;
				read-only;
			};

			partition@f0000 {
                compatible = "denx,fit";
				label = "firmware";
				reg = <0x180000 0xe00000>;
			};

			partition@f80000 {
				label = "hw";
				reg = <0xf80000 0x80000>;

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

					macaddr_hw_44e: macaddr@44e {
						compatible = "mac-base";
						reg = <0x44e 0x11>;
						#nvmem-cell-cells = <1>;
					};
				};
			};
		};
	};
};

&pio {
	spi0_flash_pins: spi0-pins {
		mux {
			function = "spi";
			groups = "spi0", "spi0_wp_hold";
		};
	};

	spi2_flash_pins: spi2-pins {
		mux {
			function = "spi";
			groups = "spi2", "spi2_wp_hold";
		};

		conf-pu {
			pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
			drive-strength = <MTK_DRIVE_8mA>;
			bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
		};

		conf-pd {
			pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
			drive-strength = <MTK_DRIVE_8mA>;
			bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
		};
	};
};

&switch {
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;
			label = "lan2";
		};

		port@2 {
			reg = <2>;
			label = "lan1";
		};

		port@6 {
			reg = <6>;
			ethernet = <&gmac0>;
			phy-mode = "2500base-x";

			fixed-link {
				speed = <2500>;
				full-duplex;
				pause;
			};
		};
	};
};

&wifi {
	status = "okay";
	nvmem-cells = <&eeprom_factory_0>;
	nvmem-cell-names = "eeprom";
};

Hopefully this can help others that run into these issues trying to get OpenWrt running on this router.

It warrants a note on the device page for starters. OpenWrt supports many more spi-nand chips than mainline, see eg https://github.com/openwrt/openwrt/blob/main/package/boot/uboot-mediatek/patches/100-20-mtd-spi-nand-add-support-for-FudanMicro-chips.patch
You need some detailed data sheet from manufacturer, like unimplemented commands, other specifics. Since it is not like high speed SSD if it works at all it can boot linux and save the few conf files user needs.

I have this version, but in step 3, I cannot skip setup, and in step 5, rather than getting anywhere with SSH after waiting the 5 minutes, I get “Unable to negotiate with 192.168.10.1 port 22: no matching host key type found. Their offer: ssh-rsa” and the router factory resets.

  1. I found my way to here, which led me to this post for installation, so I followed the instructions here.
  2. I’m wondering if I’m missing something with the github, filogic.mk and dts/if something is going over my head.

You need to enable older ssh algos.

-o HostKeyAlgorithms +ssh-rsa

If you can't skip the setup after logging in by entering this address http://192.168.10.1/html/upgrade.html
then just go through the setup process and continue with the install. It just saves a little time , not a big deal. As for the unable to negotiate issue , @frollic is correct.

For snapshot I was running into issues lately with the builds not flashing so I removed the Boya patch and changed the dts file so that it will see the Boya chip as generic. I did not change anything for 24.10 as I don't use that version.

I have made changes to the way that the images are built. This is due to the fact that the current method would not work well with kernel 6.18. If I flashed from 6.12 to 6.18 it would brick the device. So I changed it from using a UBI system to JFFS. From some reading it seems that jffs is possibly better for small spi-nor flash devices. After the change it is possible to go between 6.12 and 6.18 (and back to 6.12) without issue.

In order for this to work you have to flash the new file as if you are installing OpenWrt for the first time. You can force flash the stock firmware through the OpenWrt upgrade and then start the install of OpenWrt as you did the first time. Also, now there is only the sysupgrade.bin image. It works for the install as well as later upgrades. I have made the changes to my snapshot repo to accomplish these changes.

I am going to remove the old images from my Google Drive as well so there won't be any accidental device bricking happening.

Hello and first of all thank you very much.
I wanted to install on my Rev. A wit Boya Chip last month but stopped because of that chip... I have the ssh enabled modded oem firmware installed and running.
Is it now possible to just download tke kernel directly from the firmware selector or not?
I read that 25.12 detects it as generic and it works?

I am not sure if that will work. I make my own builds and use snapshot.

The filogic.mk definition for this device has not changed since "support" was started for this device. It did not work properly before when I tried it. Even if the boya chip issue is fixed the images that are made might not work. The issue was not the install but the upgrade afterwards which would fail and put the router in a boot loop. If you have serial access for recovery you could give it a try.

That's why I am asking. I can't fix it if I break it. Why does noone incoporate your fixes into the official images? Who maintains them?

I don't really have an answer. All I can say is that it's not a popular device. If it were an ASUS or Netgear it would probably have more traction. Everything here is community based, so even if changes are sent upstream without the interest the changes won't happen. I am just a novice here and this is mostly a hobby. I only mess around with my own home devices.

Hi, @dadogroove, thanks for your builds.

I have a wn586x3 with your old (UBI) openwrt snapshot 6.12

I read that you changed the flash layout from UBI to JFFS2. To upgrade from my current build to the new snapshot (kernel 6.18), do I need to go back to stock firmware first, then flash the modified original firmware to gain SSH access, and finally install your latest build via SSH?
Is this the correct path to upgrade safely?

Yes.

I've done this and it worked for me.