Working on support for ASUS RT-N56U B1

I have an ASUS RT-N56U B1 around that I'm not using anymore because the stock firmware has not been updated for years, and I there are some issues with other alternative firmwares.

I like the hardware quite a lot though, so, I'm trying to get LEDE/OpenWrt to work on this device. As it is a MediaTek MT7621, this should not be too hard.

I've found pieces of the puzzle already in various places, but right now I'm struggling a bit with the flash layout. First of all, should the OpenWrt flash layout be the same as the layout of the stock firmware (in terms of partition sizes and locations)?

I've found the following on the stock partitions:
cat /proc/mtd

mtd0: 00030000 00010000 "Bootloader"
mtd1: 00010000 00010000 "nvram"
mtd2: 00010000 00010000 "Factory"
mtd3: 00eb0000 00010000 "linux"
mtd4: 00d7a500 00010000 "rootfs"
mtd5: 00100000 00010000 "jffs2"
mtd6: 01000000 00010000 "ALL"

And another alternative firmware (Padavan) is giving me this in the dmesg:

0x000000000000-0x000000030000 : "Bootloader"
0x000000030000-0x000000040000 : "Config"
0x000000040000-0x000000050000 : "Factory"
0x000000050000-0x000000181de0 : "Kernel"
0x000000181de0-0x000000fc0000 : "RootFS"
0x000000fc0000-0x000001000000 : "Storage"
0x000000050000-0x000000fc0000 : "Firmware_Stub"

How do I put this into the .dts device tree file? I guess it's the start and the size of the partitions? But what do I do with the 'ALL' partition which seems to span multiple other partitions? And do the partition labels matter for OpenWrt? Which labels are required?

partition@?{
            label = "nvram";
            reg = <??>;
            read-only;
        };

I'm trying to get OpenWRT/LEDE to get to work on my ASUS RT-N56U B1. I like the hardware, but I'm not satisfied with the firmware, nor with any alternative firmware.

I have been able to get a basic OpenWRT build running, but there are some problems. I've not been able to fix these with help on the OpenWRT forum, so maybe someone here can help me a little further?

When I run my build, there's no Switch menu and no connection between WAN and LAN. It seems that 02_network does not recognise my board name. Please refer to my post on the OpenWRT forum for my changes to the different files.

I hope someone can help me! Thanks!

Seems like your old posts is not available. If possible, could you report all relevant information here? (I am not developer, so I would not able to help you, but I guess without this info nobody will able to do so.)

Thanks for letting me know. I hadn't noticed the old forum has crashed.

I have made the changes below (diff in an image so that the search will not be filled with irrelevant device names. Also, I have added a .dts file as shown below. Is there any error to be seen?

As posted before, The device does boot, but there is no 'Switch' menu and the network interfaces are not available. It seems that 02_network does not recognise my board name.

Knipsel

/dts-v1/;

#include "mt7621.dtsi"

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

/ {
	compatible = "asus,rt-n56u-b1", "mediatek,mt7621-soc";
	model = "ASUS RT-N56UB1";
	
	memory@0 {
		device_type = "memory";
		reg = <0x0 0x8000000>;
	};
	
	chosen {
		bootargs = "console=ttyS0,115200";
	};
	
	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

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

	gpio-leds {
		compatible = "gpio-leds";

		power {
			label = "rt-n56u-b1:blue:power";
			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
		};

		lan {
			label = "rt-n56u-b1:blue:lan";
			gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
		};

		wan {
			label = "rt-n56u-b1:blue:wan";
			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
		};

		usb {
			label = "rt-n56u-b1:blue:usb";
			gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
		};
	};
};

&spi0 {
	status = "okay";

	mx25l12805d@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

		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 {
			label = "firmware";
			reg = <0x50000 0xfb0000>;
		};
	};
};

&pcie {
	status = "okay";

	pcie0 {
		mt76@0,0 {
			reg = <0x0000 0 0 0 0>;
			device_type = "pci";
			mediatek,mtd-eeprom = <&factory 0x8000>;
			ieee80211-freq-limit = <5000000 6000000>;
		};
	};

	pcie1 {
		mt76@1,0 {
			reg = <0x0000 0 0 0 0>;
			device_type = "pci";
			mediatek,mtd-eeprom = <&factory 0x0000>;
			ieee80211-freq-limit = <2400000 2500000>;
		};
	};
};

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

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "wdt", "rgmii2", "jtag", "mdio";
			ralink,function = "gpio";
		};
	};
};