Accessing U-Boot Command Line on TP-Link Deco M4R


I'm currently working on a port for the TP-Link Deco M4R. And I'm slowly making my way to the point where I would be able to compile my first custom firmware.

But in order to test the firmware I need access to the U-Boot command line so that I can load a ramfs image and try it out.

And I can't seem to access the command line.

Here is what I get over the serial connection:

I've tried repeatedly pressing ~, 2, 4, ESC, Enter and just generally smashing around on the keyboard. Nothing seems to work.

The Uart RX of the SoC is working because once the kernel starts and tells me that I can press f and Enter then I can do that and enter the failsafe console where I can type stuff in just fine.

Any suggestions?

You usually need to interrupt TP-Link's u-boot, by pressing tpl quickly at the right moment (waiting for autoboot). TP-Link also likes to cripple the serial console, often by removing a (often 0-ohm) resistor in the traces leading towards the serial console (its rx pin in particular), or dragging it down to GND.

Yes, pressing tpl worked!

I've been googling and searching here on the forum for days. Should have asked sooner.

Thank you very much!

TP-Link also likes to cripple the serial console, often by removing a (often 0-ohm) resistor in the traces leading towards the serial console (its rx pin in particular), or dragging it down to GND.

I've already been playing with the console of TP-Link's version of OpenWrt that came with the router, so the RX seems to be fine.

Now I just need a few more infos to finish the modification. For instance I've got no clue about the partitions in the .dts file. But I guess that is going to be a new question with an appropriate title.

At least now I know that I can test my modifications without having to hope that I don't brick the device.

dmesg and/ or cat /proc/mtd should answer (most of-) that question (maybe ubinfo -a as well)

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

			info: partition@20000 {
				label = "info";
				reg = <0x020000 0x010000>;

			partition@30000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x030000 0x7a0000>;

			partition@7d0000 {
				label = "tplink";
				reg = <0x7d0000 0x020000>;

			art: partition@7f0000 {
				label = "art";
				reg = <0x7f0000 0x010000>;

And this is from the Deco:


[    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/ (the questionmarks):

define Device/tplink_deco-m4r-v2
  SOC := qca9563
  IMAGE_SIZE := ?????k
  DEVICE_MODEL := Deco M4R ???
  DEVICE_VARIANT := v2 ???
  TPLINK_BOARD_ID := ????????
  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
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 =
		.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",

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