Need help with partitions in .dts file


I'm at that point where I could build my custom firmware for the Deco M4R, but I just don't understand what partitions to put into the .dts file based on the information I've got.

I have tried looking at how it's been done for other devices and just don't see how they get to what they write in their .dts file.

For example the TP-Link RE455 v1: (.dts file is right at the beginning of the commit)

There are 7 partitions in the .dts.

If I open up the oem firmware .bin from tp-link with a text editor then I'm presented with this:

partition fs-uboot base 0x00000 size 0x20000
partition os-image base 0x20000 size 0xc0000
partition file-system base 0xe0000 size 0x520000
partition partition-table base 0x600000 size 0x02000
partition default-mac base 0x610000 size 0x00020
partition pin base 0x610100 size 0x00020
partition product-info base 0x611100 size 0x01000
partition soft-version base 0x620000 size 0x01000
partition support-list base 0x621000 size 0x01000
partition profile base 0x622000 size 0x08000
partition user-config base 0x630000 size 0x10000
partition default-config base 0x640000 size 0x10000
partition radio base 0x7f0000 size 0x10000

I can see that the first and last partition in the .dts and the .bin match, but apart from that I don't understand how he comes up with that "info" partition. And in the .bin there is no partition that starts at 0x050000, so I've got no clue how he found that out for the "firmware" partition. In the .bin the partition-table starts at 0x600000, but in the .dts it's at 0x022000. Basically everything that happens between the first and last partition is a mystery to me.

Am I missing something obvious here? Am I looking in the wrong places for the needed info?

For the RE455v1 was simple, it was a rebrand of RE450v3 so I've copied and checked the partition table from it.

if you check the partition table, the .dts is a rationalization of the partition.

{"fs-uboot", 0x00000, 0x20000}, is u-boot
{"default-mac", 0x20000, 0x00020},{"pin", 0x20020, 0x00020},{"product-info", 0x21000, 0x01000}, is info
{"partition-table", 0x22000, 0x02000}, is partition-table
{"soft-version", 0x24000, 0x01000},{"support-list", 0x25000, 0x01000},{"profile", 0x26000, 0x08000}, is info2
{"user-config", 0x2e000, 0x10000}, {"default-config", 0x3e000, 0x10000},{"config-info", 0x4e000, 0x00400}, is config
{"firmware", 0x50000, 0x7a0000}, is tplink,firmware
{"radio", 0x7f0000, 0x10000}, is art

they haven't a filesystem so is arranged to minimize the partition layout

I don't know your model but probably you can arrange it:

u-boot 0x00000 0x20000
firmware 0x20000 0xc0000
file-system 0xe0000 0x520000
partition-table 0x600000 0x02000
info 0x610000 0x20000
config 0x630000 0x20000
art 0x7f0000 0x10000

but don't know what inside os-image and file-system partition

I can't help more, I'm new to openwrt development

Thanks for replying. I have since figured out that openwrt doesn't really care what you set the partitions to as long as "kernel" und "rootfs" are there.

You could have boiled your partitions down to "u-boot", "firmware", "whatever" and "art" and it will likely work just fine. Not sure if openwrt even accesses the "art" partition.

But for someone with no clue this was super confusing. Especially when partitions don't end where the following partition starts and when you've got some of the original partitions in your dts and some you grouped together.

I also don't really get what you did with the macaddr_info_8. I would have just used mtd-mac-address = <&info2 0x8>; (which I did for my device). But if that works for you with the correct MAC address then that's of course fine too.

If I've understand correctly the partition table was also used to dump the mtd single partition.
art is read by wireless driver for load caldata.

for macaddress it start at 0x020008 so "&info 0x8" on my model is correct because info start at 0x020000

for yuor model I think it start at 0x610008 so if your info2 start at 0x610000 "&info2 0x8" is correct

I just checked and the confusion here stems from me using the firmware .bin file for the RE450 instead of your RE455 and that has the partition layout you can see in my first post. Not sure why I looked at the RE450 firmware.

In any case this problem was solved a few days after I opened this post. My three Deco M4Rs have been running on OpenWRT for 5 weeks now.

My main problem was that I couldn't access the bootloader prompt and couldn't test ramfs firmwares to not brick the device, so I wanted to really understand how the partitions worked. Shortly after I was told how to access the bootloader prompt and from then on I simply tried out different partition layouts in my .dts until it worked.

But I have to ask:

for macaddress it start at 0x020008 so "&info 0x8" on my model is correct because info start at 0x020000

Where in your .dts do you set this info?

You're only asking for it in the 11-ath10k-caldata file and that's solely for the 5GHz radio. So I'm guessing that you're not using the correct MAC for eth0 and the 2.4GHz radio but using an auto generated one instead. Is that correct?

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

here I set partition labeled "info" start at 0x020000 sized 0x002000.
now I can't check the eth0 macaddress because I broke my device tryng to revert to stock. some problem writing the flash with SPI.
I can't access uart, broke the line tryng to solder it.
Not very expert in soldering...
If (I hope) rescue it from brick, i check macaddress, otherwise I buy and flash a new one

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