D-link DIR-825 B1/B2 fat target

DIR-825 has strange stock mtd layout.
It includes unused 1.5 Mb partition
Older releases supported -fat firmware. It deletes unused partition and moves caldata to the end of the flash.
Partition layout was defined in kernel-embedded command line.
ath79 target do not use this technique anymore and hardcodes mtd layout in device tree.
Its fine but fat support was dropped. Now only minimal flash size is available.

I fixed this myself. Edited ar7161_dlink_dir-825-b1.dts :

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

			partition@0 {
				label = "u-boot";
				reg = <0x000000 0x040000>;

			partition@40000 {
				label = "config";
				reg = <0x040000 0x010000>;

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x050000 0x7A0000>;

			partition@7F0000 {
				label = "caldata";
				reg = <0x7F0000 0x010000>;

and generic.mk :

define Device/dlink_dir-825-b1
  SOC := ar7161
  IMAGE_SIZE := 7808k
  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
	append-metadata | check-size
  DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
	kmod-leds-reset kmod-owl-loader
  SUPPORTED_DEVICES += dir-825-b1
TARGET_DEVICES += dlink_dir-825-b1

But this requires recompiling firmware.
It would be good to reenable fat target in official builds

Also to note.

  1. New kernel cant get ethernet MAC addresses from the flash. They must be specified in /etc/config/network. Why ?
  2. If country code is '00' then hostapd tends not to run (exit with error), especially if multiple SSIDs are configured. I spent some time to figure it out. Setting any valid country fixes this. '00' worked in earlier releases
1 Like

I'm not sure if this will work with around a non erasable partition but I did see something used here

about "mtd-concat " may not be able to make an image bigger then the 1st partition & problems recover page etc I don't know enough
but it may be what you are looking for to reclam space without moving the cal data

Moving caldata is not a problem.
If I understand correctly In ar71xx there was special script for DIR-825 that auto moved caldata during sysupgrade between standard and fat versions.
In ath79 this funcion was dropped leaving only standard layout option.

I would not say it was dropped but not yet re implemented
what I suggested above may work around the caldata you don't need to move it

This is correct. I added this device to ath79 target and didn't bother to implement the "fat" variant.

1 Like

This is because you need to update scripts too. See the initial commit for ath79 and you'll find what needs to be changed for the new layout.

1 Like

dts with concat


This will remove a copy of caldata that is located inside the "unknown" partition. I see no problem with that, especially if the data is backed up.

But there is an easier solution without using concat. The last 64 kB is a copy of caldata. That can be kept, but original caldata removed.

1 Like

none of my units have a 2nd copy to loose this is only added if you put it there or via BIG
& you run the risk of loosening it if something brakes & you have to recover
so it's just safer not to touch it

Stock layout has a copy of caldata at the end of flash. You can see it here. https://openwrt.org/toh/d-link/dir-825#flash_layout

My device actually has it. But as I wrote, one caldata is enough if there is a backup.

1 Like

for my 2 devices layer 1 is correct for the OEM layout
in my first backup's that I do you know "just in case"
& the full "mtd6 unkown 1600KiB" was blank in both

Well, it doesn't matter which way to do it really. I did a full dump of a stock firmware long ago, and the "unknown" wasn't empty. Your concat solution is good. It is worth making a PR.

1 Like

I have all but given up trying to put in pull requests
they just sit the for months & months
I did plan to after the current one but well that was 3 mouths ago
& it's still sitting there
so if someone want to do it go for it
I don't have a patience anymore

Please send this PR, I am a sort of maintainer of this device, because I added it to ath79, I will do a review.
The only question is to make another target, or update the main target.

Did you check if recovery works OK with an empty "unknown"? I will build and check too.

1 Like

I'm not sure how to with out braking the current one sitting there
something about only able to fork openwrt once
I did test upgrading from current ath97 & the older fat image
it all seemed to work & keep it's cal data
I think I installed samba & DLNA so should have written over cal data in the fat image but not 100%
last time I had to recover one it was a challenge
I think I needed windows XP with IE on it to work
but no I have not tested recovery

I never installed the "fat" image to the current device, so I have the original "unknown".
My only concern is that that the "unknown" has something to do with that recovery http server.

Yes, it needs XP to work properly, but there is a C program that can do it without any browser from any OS.

If you have you build installed now, can you check if you can get into the recovery web page? You don't need XP for that. Other browsers won't accept files, but you can still check if you can get there.

1 Like

What do you mean? You can add another device but with bigger flash and a new layout.

I'm not sure how to add a 2nd pull request
as there is still one there waiting

Is there a pull request for exactly this patch? Can you give a link?

1 Like

the PR it's for another device for something else
just the link I sent before witch is not on a fork
so there is no option for a pull request