I've been trying to use the TP-Link Archer C6 V2 as a starting point since that device has basically the same hardware. The Ram and Flash both are bigger, but Uboot tells me that it has 16MB Flash and 128MB RAM instead of the 128MB Flash and 1GB RAM the chips should have because of the IDs printed on them.
I've already checked the LEDs and the reset button with a multimeter and have come up with what looks to be right. And even if it isn't I can still test a ramfs image with those settings and change them if needed.
This is the unmodified partition part of the Archer C6 dts:
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x020000>;
read-only;
};
info: partition@20000 {
label = "info";
reg = <0x020000 0x010000>;
read-only;
};
partition@30000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x030000 0x7a0000>;
};
partition@7d0000 {
label = "tplink";
reg = <0x7d0000 0x020000>;
read-only;
};
art: partition@7f0000 {
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
};
};
};
};
And this is from the Deco:
Bootlog:
[ 0.450000] m25p80 spi0.0: found xmc25q128, expected m25p80
[ 0.460000] m25p80 spi0.0: xmc25q128 (16384 Kbytes)
[ 0.460000] 5 cmdlinepart partitions found on MTD device spi0.0
[ 0.470000] Creating 5 MTD partitions on "spi0.0":
[ 0.480000] 0x000000000000-0x000000080000 : "u-boot"
[ 0.480000] 0x000000080000-0x000000280000 : "kernel"
[ 0.490000] 0x000000280000-0x000000e80000 : "rootfs"
[ 0.490000] mtd: partition "rootfs" set to be root filesystem
[ 0.500000] 0x000000e80000-0x000000ff0000 : "config"
[ 0.510000] 0x000000ff0000-0x000001000000 : "art"
And from the oem firmware .bin:
partition fs-uboot base 0x00000 size 0x80000
partition os-image base 0x80000 size 0x200000
partition file-system base 0x280000 size 0xc00000
partition product-info base 0xe80000 size 0x05000
partition default-mac base 0xe85000 size 0x01000
partition device-id base 0xe86000 size 0x01000
partition support-list base 0xe87000 size 0x10000
partition user-config base 0xea7000 size 0x10000
partition device-config base 0xeb7000 size 0x10000
partition group-info base 0xec7000 size 0x10000
partition partition-table base 0xed7000 size 0x02000
partition soft-version base 0xed9000 size 0x10000
partition profile base 0xee9000 size 0x10000
partition default-config base 0xef9000 size 0x10000
partition url-sig base 0xfe0000 size 0x10000
partition radio base 0xff0000 size 0x10000
I can see that I need to adjust the "u-boot" partition and the "art" (=radio) partition, but apart from that I can't really match the other partitions so that anything makes sense to me.
Apart from that I'm not sure how to fill the device settings in target/linux/ath79/image/generic-tp-link.mk (the questionmarks):
define Device/tplink_deco-m4r-v2
$(Device/tplink-safeloader-uimage)
SOC := qca9563
IMAGE_SIZE := ?????k
DEVICE_MODEL := Deco M4R ???
DEVICE_VARIANT := v2 ???
TPLINK_BOARD_ID := ????????
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
endef
TARGET_DEVICES += tplink_deco-m4r-v2
And I'm not 100% sure what .id and .part_trail to use in tools/firmware-utils/src/tplink-safeloader.c (apart from the .id and .part-trail the rest should be okay. Comes directly from opening the OEM firmware .bin with a Texteditor):
/** Firmware layout for the Deco M4R v2 */
{
.id = "DECO-M4R-V2", // ?????????
.vendor = "",
.support_list =
"SupportList:\n"
"{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
"{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
"{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
"{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
"{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
"{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
"{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
"{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
"{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
"{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
"{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
"{product_name:M4R,product_ver:2.0.0,special_id:4B520000}",
.part_trail = 0x00, // ???????
.soft_ver = "soft_ver:1.4.3 Build 20200918 Rel. 74289\n",
.partitions = {
{"fs-uboot", 0x00000, 0x80000},
{"os-image", 0x80000, 0x200000},
{"file-system", 0x280000, 0xc00000},
{"product-info", 0xe80000, 0x05000},
{"default-mac", 0xe85000, 0x01000},
{"device-id", 0xe86000, 0x01000},
{"support-list", 0xe87000, 0x10000},
{"user-config", 0xea7000, 0x10000},
{"device-config", 0xeb7000, 0x10000},
{"group-info", 0xec7000, 0x10000},
{"partition-table", 0xed7000, 0x02000},
{"soft-version", 0xed9000, 0x10000},
{"profile", 0xee9000, 0x10000},
{"default-config", 0xef9000, 0x10000},
{"url-sig", 0xfe0000, 0x10000},
{"radio", 0xff0000, 0x10000},
{NULL, 0, 0}
},
.first_sysupgrade_partition = "os-image",
.last_sysupgrade_partition = "file-system",
},