Mkporayfw error: unknown flash layout on custom WT3020 build (ramips/mt7620)

I have a few WT3020 mini-routers, some of which I have upgraded the flash chips of to 16MB (see my archived thread from 2014 https://forum.archive.openwrt.org/viewtopic.php?id=54717&p=1 ) They have been running the image I compiled back then of a pre-15.05 snapshot. I've decided to upgrade them to 18.06.5 so I downloaded the current git tree and checked out 18.06.5, then proceeded to modify it to add support for the 16M flash chip. Been following the guide at https://openwrt.org/docs/guide-developer/adding_new_device to add a new variant WT3020-16M by making a variant of the existing WT3020-8M in the tree. Specifically the files I modified are:
grep -lri WT3020 target/
target/linux/ramips/dts/WT3020-4M.dts
target/linux/ramips/dts/WT3020-8M.dts
target/linux/ramips/dts/WT3020.dtsi
target/linux/ramips/dts/WT3020-16M.dts
target/linux/ramips/base-files/etc/diag.sh
target/linux/ramips/base-files/etc/board.d/02_network
target/linux/ramips/base-files/etc/board.d/01_leds
target/linux/ramips/base-files/lib/upgrade/platform.sh
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/image/mt7620.mk

Compiling images for the 8M devices works fine, both a factory and a sysupgrade firmware file are generated.

Compiling for the 16M variant I made does generate a sysupgrade file, but the factory image is not generated. Specifically mkporayfw complains of unknown flash layout.

/home/silviu/openwrt/git/openwrt/staging_dir/host/bin/mkporayfw -B WT3020 -F 16M -f /home/silviu/openwrt/git/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-wt3020-16M-squashfs-factory.bin -o /home/silviu/openwrt/git/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-wt3020-16M-squashfs-factory.bin.new
[mkporayfw] *** error: unknown flash layout "16M"

I'm not sure at this point what I have missed. Here is the contents of the WT3020-16M.dts that I made:

/dts-v1/;

#include "WT3020.dtsi"

/ {
compatible = "nexx,wt3020-16m", "nexx,wt3020", "ralink,mt7620n-soc";
model = "Nexx WT3020 (16M)";
};

&ehci {
status = "okay";
};

&ohci {
status = "okay";
};

&spi0 {
status = "okay";

m25p160@0 {
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "jedec,spi-nor";
	reg = <0>;
	spi-max-frequency = <10000000>;

	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>;
	};
};

};

Any help highly appreciated.
Is the sysupgrade file safe to use to try and upgrade my devices, given that the factory fails?

Ah I think I figured it out. I need to modify the firmware obfuscation tool tools/firmware-utils/src/mkporayfw.c to add an entry for the 16MB flash chips. The sysupgrade image should be fine, it's just the conversion to factory image that doesn't work due to lack of support of this tool for 16MB.

Let me make the change and see if it works. I'll post back.

Yes, with the modified mkporayfw the build completes successfully. I'd attach the modified source here but I can't figure out how to do it in this forum.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.