D-link DIR-825 B1/B2 fat target

I can't get what the problem is. If you made a pull request from another repo, there is no problem to do a PR from this one.

1 Like

But you need also to increase image size. I built with your patch and it works.

1 Like

I don't think you can increase the image size
I guess this is the problem with concat
you can't make the image size bigger then the original
you risk overwriting the cal data
it only adds the extra room to store more in openwrt
the image limit is still limited to older images & boot loaders

I never used concat. I need to check it.

1 Like

I'm not very good with git & git hub I could not link a repository to openwrt
the same as the 1st fork i mage

You fork it once. The you can create as many branches as you like and do PRs from each of them.

1 Like

the image size limit is still only the original firmware size
after the 'config" up to the "caldata"
older openwrt's & the boot loader won't know to skip the caldata
if you could include the cal data in the image file well that would be ok but we can't
so it's only adding the unknown partition to room in rootfs
the flash able image is still limited to the OEM kernel & rootfs

If we are talking about a sysupgrade image, I am not sure of that. It has nothing to do with bootloader. The question is if sysupgrade can use it properly.

1 Like

even if it's sysupgrade work's ok
it's the sysupgrade in all the older versions you are upgrading it from that won't know
if they don't have the old image size limiting them in anyway now

I flashed my version
Performed reset
when to software
made it try to install samba4
room when from 2.3M to 356.4K
it failed after running out of room
so all of flash written to
powered off
hold reset down then plug in power wait for yellow flashing light
go to 192.168.0.1 & Firmware Upgrade System page comes up

ok never noticed but the "Firmware Upgrade System page"
is accessible while the yellow power light is flashing
for a little while then it turns blue & openwrt is up & working
that maybe normal but never looked

So it looks like the unknown partition is not useful at all.

1 Like

I just had a look at my backup's
where the last 64K are all 0xFF's and there is no cal data
I do see in one of mine what look's like a DD-wrt config
witch sounds right i did play with that at one point
there is data in there tho both unit had the same
what it is or if it's ever needed i don't know
I mush admit i have never thort of going back to OEM firmware
so didn't look much into it & having backups if i did
but the FAT openwrt image uses this area as well

I've just installed openwrt-21.02.0-ath79-generic-dlink_dir-825-b1-squashfs-sysupgrade.bin and this is the new flash layout:

dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "config"
mtd2: 00610000 00010000 "firmware"
mtd3: 001f3cf6 00010000 "kernel"
mtd4: 0041c30a 00010000 "rootfs"
mtd5: 00100000 00010000 "rootfs_data"
mtd6: 00010000 00010000 "caldata"
mtd7: 00190000 00010000 "unknown"

It's a different layout from 19.07 version:

Where is CALDATA_COPY?

I custom built a ath79 19.07 version of openwrt to flash to my routers. They were already flashed with an older fat version so all I needed to do was update the flash layout to match that of older fat images, being extra careful, and having a copy of the caldata saved in case of emergency. Debricking this router is a pain at least for me because the backup loader is super picky.
it worked great. That was a while ago.
There is nothing special to the "unknown" partition. It makes no sense to have the caldata where it is in the standard layout.
I'll give it a try with the new release. Just need to remember what I did.
I tried to create a new "fat" device but it was too complicated for me. I tried to replicate what the ar71 target does for this router in sysupgrade (like moving the caldata around) but didn't quite manage.

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.

Not too sure... I also made this work by setting the MAC addresses in config/network.

The commit to add this router to ath79 is here.

In theory the MAC addresses are picked up by target/linux/ath79/base-files/etc/board.d/02_network based on caldata offsets but it didn't work for me.

I'm poking at it as time allows...

1 Like

dts with concat

That is fantastic. Thank you. Much nicer than moving the caldata around.
Problem I have is my routers already have the caldata moved to the end of the flash. One of them in particular is not accessible and only reachable via WiFi so I have to be extra careful on what I do to it. Maybe I'll bite the bullet of flashing it a few times as to move the caldata to where it should be and then use an image with the unused space concatenated.

if you can get to the web inter face you can still save it now just in case
I have not lost caldata flashing but have had to recover so it's not all smooth sailing

Thank you for the suggestion. I forget you can do that from luci now. I'm used to dd and scp the caldata out.

I ended up building my own images. Vanilla image for 21.02.0 is over 5MB so the packages I need no longer fit. Only way was to put most stuff in squashfs. Took the opportunity to remove what I don't use. Using the standard image was nice while it lasted.

Ended up building "fat" images as all the routers have the caldata at the end. They are never going back to stock so don't care that much. Only two small changes are needed as @bolvan posted. Everything works great. Here for reference:

diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
index f2809f0549..89fce38207 100644
--- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
+++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
@@ -191,19 +191,17 @@
                        partition@50000 {
                                compatible = "denx,uimage";
                                label = "firmware";
-                               reg = <0x050000 0x610000>;
+                               reg = <0x050000 0x7A0000>;
                        };
 
-                       partition@660000 {
+                       partition@7F0000 {
                                label = "caldata";
-                               reg = <0x660000 0x010000>;
-                               read-only;
+                               reg = <0x7F0000 0x010000>;
                        };
 
-                       partition@670000 {
-                               label = "unknown";
-                               reg = <0x670000 0x190000>;
-                               read-only;
+                       partition@660000 {
+                               label = "caldata-backup";
+                               reg = <0x660000 0x010000>;
                        };
                };
        };
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 5ba64b9803..6d4b81b5bb 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -861,7 +861,10 @@ define Device/dlink_dir-825-b1
   DEVICE_VENDOR := D-Link
   DEVICE_MODEL := DIR-825
   DEVICE_VARIANT := B1
-  IMAGE_SIZE := 6208k
+  IMAGE_SIZE := 7808k
+  IMAGES := backup-loader.bin sysupgrade.bin
+  IMAGE/backup-loader.bin := append-kernel | append-rootfs | pad-rootfs | \
+       append-string 01AP94-AR7161-RT-080619-00 | check-size
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
        append-metadata | check-size
   DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \

I left the caldata unlocked in case I brave moving it back to where it should be. Easy to add read-only once I'm over it.

I hope the future of the router's image will be to concat the unused mtd area. The vanilla image barely fits in the 5.5MB space. Won't be long for future releases to blow over that. @Lucky1, thank you for posting about concat... you may have given this router a few more years life.

Thank you very much @Pilot for keeping this router alive. Much appreciated.

EDIT: Now using Lucky1 patch above for concatenating flash areas. Please check his pull request above.