Flash layout is unchangable?

I have a wavlink WN530HG4, which I found out is the same hardware as the already supported PHICOMM K2G.

But before I found that out I flashed a couple of images, and when I finally flashed Phicomm K2G I get a error when loading MTD.

I managed to fix it so that it loads again, but I'm unsure if this is something that needs to be always like that, or just a by product of my trials that should be corrected.

In other words I want to know if I can fix my device to use the Phicomm K2G image, of if I need to submit a new target just for the different flash layout.

Original firmware:

[    6.236000] Creating 5 MTD partitions on "raspi":
[    6.244000] 0x000000000000-0x000000800000 : "ALL"
[    6.256000] 0x000000000000-0x000000030000 : "Bootloader"
[    6.268000] 0x000000030000-0x000000040000 : "Config"
[    6.276000] 0x000000040000-0x000000050000 : "Factory"
[    6.288000] 0x000000050000-0x000000800000 : "Kernel"

Phicomm K2G that fails to load flash:

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

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

			partition@0 {
				reg = <0x0 0x30000>;
				label = "u-boot";
				read-only;
			};

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

			factory: partition@40000 {
				reg = <0x40000 0x10000>;
				label = "factory";
				read-only;
			};

			partition@50000 {
				reg = <0x50000 0x50000>;
				label = "permanent_config";
				read-only;
			};

			partition@a0000 {
				compatible = "denx,uimage";
				reg = <0xa0000 0x760000>;
				label = "firmware";
			};
		};
	};

Configuration that works for my device:

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

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

			partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "u-boot-env";
				reg = <0x30000 0x1000>;
				read-only;
			};

			partition@31000 {
				label = "config";
				reg = <0x31000 0xf000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0x7b0000>;
			};
		};
	};

If you want to add support for your device to OpenWrt, you need to follow the OEM partitioning (OpenWrt should be installable from the OEM firmware, reverting to the OEM firmware should remain possible using the OEM firmware alone; there are exceptions to this rule of thumb). For your own personal builds, the sky (and the abilities of the OEM bootloader) is the limit, but if you break it, you get to keep both pieces (this is heavily device specific, it's impossible to answer this for you).

1 Like

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