TP-Link Archer C2 V1 8MB to 32MB Flash

Hi, All!
I have a TP-Link Archer C2 AC750 v.1.
I replaced flash memory on N25Q256A13 (32 MB).
I flashing OpenWRT and do not see the entire amount of flash memory.
After that, I change part of the file /home/alexander/openwrt/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts

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

			partition@20000 {
				compatible = "tplink,firmware";
				label = "firmware";
				reg = <0x20000 0x1fa0000>;
			};

			partition@1fc0000 {
				label = "config";
				reg = <0x1fc0000 0x10000>;
				read-only;
			};

			rom: partition@1fd0000 {
				label = "rom";
				reg = <0x1fd0000 0x10000>;
				read-only;
			};

			partition@1fe0000 {
				label = "romfile";
				reg = <0x1fe0000 0x10000>;
				read-only;
			};

			radio: partition@1ff0000 {
				label = "radio";
				reg = <0x1ff0000 0x10000>;
				read-only;
			};
			partition@0 {
				label = "u-boot";
				reg = <0x0 0x20000>;
				read-only;
			};

			partition@20000 {
				compatible = "tplink,firmware";
				label = "firmware";
				reg = <0x20000 0x7a0000>;
			};

			partition@7c0000 {
				label = "config";
				reg = <0x7c0000 0x10000>;
				read-only;
			};

			rom: partition@7d0000 {
				label = "rom";
				reg = <0x7d0000 0x10000>;
				read-only;
			};

			partition@7e0000 {
				label = "romfile";
				reg = <0x7e0000 0x10000>;
				read-only;
			};

			radio: partition@7f0000 {
				label = "radio";
				reg = <0x7f0000 0x10000>;
				read-only;
			};

I flash new firmware image via web luci (openwrt-ramips-mt7620-tplink_archer-c2-v1-squashfs-sysupgrade.bin), and get the same result.
What am I doing wrong?

1 Like

I don't think sysupgrade touch read-only partitions but just writes to already exist firmware partition. try flash it by tftp?

Have you changed in this file yet /target/linux/ramips/image/mt7620.mk ?

define Device/tplink_c2-v1
    $(Device/Archer)
    DTS := ArcherC2-v1
    TPLINK_FLASHLAYOUT := 8Mmtk

Yes

define Device/tplink_archer-c2-v1
  $(Device/tplink-v2)
  SOC := mt7620a
  IMAGE_SIZE := 32384k
  SUPPORTED_DEVICES += tplink,c2-v1
  TPLINK_FLASHLAYOUT := 32Mmtk
  TPLINK_HWID := 0xc7500001
  TPLINK_HWREV := 50
  IMAGES := sysupgrade.bin
  DEVICE_MODEL := Archer C2
  DEVICE_VARIANT := v1
  DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci \
	kmod-usb-ledtrig-usbport kmod-switch-rtl8366-smi kmod-switch-rtl8367b
endef
TARGET_DEVICES += tplink_archer-c2-v1

And have, afte make V=s

[mktplinkfw2] *** error: unknown flash layout "32Mmtk"

Probably need to fix another file tools/firmware-utils/src/mktplinkfw2.c

Everything is working!

git clone https://git.openwrt.org/openwrt/openwrt.git/ myrepack
cd myrepack
git checkout openwrt-19.07
./scripts/feeds update -a
./scripts/feeds install -a

/myrepack/target/linux/ramips/image/mt7620.mk

define Device/tplink_c2-v1
  $(Device/Archer)
  DTS := ArcherC2-v1
  TPLINK_FLASHLAYOUT := 32Mmtk
  TPLINK_HWID := 0xc7500001
  TPLINK_HWREV := 50
  DEVICE_TITLE := TP-Link Archer C2 v1
  DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-switch-rtl8366-smi kmod-switch-rtl8367b
endef
TARGET_DEVICES += tplink_c2-v1

/myrepack/tools/firmware-utils/src/mktplinkfw2.c

		.kernel_ep	= 0x80000000,
		.rootfs_ofs	= 0x140000,
	}, {
		.id		= "32Mmtk",
		.fw_max_len	= 0x1e80000,
		.kernel_la	= 0x80000000,
		.kernel_ep	= 0x80000000,
		.rootfs_ofs	= 0x140000,
	}, {
		.id		= "8MSUmtk", /* Split U-Boot OS */
		.fw_max_len	= 0x770000,
		.kernel_la	= 0x80000000,

/myrepack/target/linux/ramips/dts/ArcherC2-v1.dts

&spi0 {
	status = "okay";

	m25p80@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 0x20000>;
				read-only;
			};

			partition@20000 {
				compatible = "tplink,firmware";
				label = "firmware";
				reg = <0x20000 0x1fa0000>;
			};

			partition@1fc0000 {
				label = "config";
				reg = <0x1fc0000 0x10000>;
				read-only;
			};

			rom: partition@1fd0000 {
				label = "rom";
				reg = <0x1fd0000 0x10000>;
				read-only;
			};

			partition@1fe0000 {
				label = "romfile";
				reg = <0x1fe0000 0x10000>;
				read-only;
			};

			radio: partition@1ff0000 {
				label = "radio";
				reg = <0x1ff0000 0x10000>;
				read-only;
			};
		};
	};
};
dd if=c2v1_stock_firmware.bin of=c2v1_uboot.bin bs=1 skip=512 count=131072
cat c2v1_uboot.bin openwrt-ramips-mt7620-tplink_c2-v1-squashfs-sysupgrade.bin > ArcherC2V1_tp_recovery.bin

Thanks a lot, everyone!

1 Like

I have some problems:

  1. After reboot the router, wireless network does not up automatically, forgets the previously set settings and password.
  2. Do not work soft reset.

I suppose it is related:

  1. The config, rom, romfile, and radio sections are not visible during boot. Since they are at the end of the memory.
  2. This is due to switching memory addressing.

did you manage to solve it @Sagittarius

I have the same router but I replaced it with a 16MB chip.

After make I have tons of bin's, now, how can I make a 16MB file out of it for flashing it with flashrom?

what router same like me or op(author)

can u share the .config file,please? thank you verymuch