DGS-1210-28MP Unbrick

Base boot log here here and here

We can conclude that Flash is made like this:

Place MTD Size erasesize Name
0x00000000-0x00080000 mtd0 00080000 00010000 "u-boot"
0x00080000-0x000c0000 mtd1 00040000 00010000 "u-boot-env" (1)
0x000c0000-0x00100000 mtd2 00040000 00010000 "board-name"
0x00100000-0x00e80000
(encapsulated 4 and 5)
mtd3 00d80000 00010000 "firmware"
0x00100000-0x00280000 mtd4 00320000 00010000 "kernel"
0x00280000-0x00e80000 mtd5 00a60000 00010000 "rootfs"
0x005f0000-0x00d80000 mtd6 007b0000 00010000 "rootfs_data"
0x00e80000-0x01000000 mtd7 00180000 00010000 "kernel2"
0x01000000-0x01040000 mtd8 00040000 00010000 "sysinfo"
0x01040000-0x01c40000 mtd9 00c00000 00010000 "rootfs2"
0x01c40000-0x02000000 mtd10 003c0000 00010000 "jffs2"

So we can write RawMTD save directly to flash like this:

Firmware (mtd3 Firmware = mtd4 kernel + mtd5 Rootfs)

tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd3.bin
sf update 0x8f00000 100000 d80000

OR

tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd4.bin
sf update 0x8f00000 100000 0x320000
tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd5.bin
sf update 0x8f00000 280000 0xa60000

Firmware 2 ( mtd4 kernel2 + mtd5 Rootfs2)

tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd7.bin
sf update 0x8f00000 0xe80000 0x00180000
tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd9.bin
sf update 0x8f00000 1040000 0x00c00000

And you want both firmware equal

tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd3.bin
sf update 0x8f00000 0xe80000 0xd80000

MTD6 "rootfs_data"

tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd6.bin
sf update 0x8f00000 5f0000 0x7b0000

MTD10 "jffs2"

tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd10.bin
sf update 0x8f00000 0x1c40000 0x003c0000

Why not MTD0 u-boot and MTD1 u-boot-env. I'am stuck in u-boot, I will not crash my last chance to save it :slight_smile:

Test

I tried to write on MTD3:

  • stock rom (without first 0x40 bytes)
  • openwrt (kernel, factory, sysupgrade)
  • my MTD3 Save

No thing boot correctly. strange...

So i write, read back an check...
I fact 'sf write' didn't write, that why I put update on the exemple before, we have to update... It' longer but it works

u-boot># tftpboot 0x8f00000 RawMTD/DGS-1210-28MP.mtd3.bin
Using rtl8380#0 device
TFTP from server 192.168.1.66; our IP address is 192.168.1.132
Filename 'RawMTD/DGS-1210-28MP.mtd3.bin'.
Load address: 0x8f00000
Loading: Got ARP REPLY, mac addr (b4:b5:2f:b1:c2:fd), ip addr (192.168.1.66)
#################################################################
         #######################################################
done
Bytes transferred = 14155776 (d80000 hex)
u-boot># iminfo 0x8f00000

## Checking Image at 08f00000 ...
   Legacy image found
   Image Name:   OpenWrt
   Created:      2024-03-22  22:09:42 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    3236735 Bytes = 3.1 MB
   Load Address: 80100000
   Entry Point:  80100000
   Verifying Checksum ... OK

u-boot># md 08f00000
08f00000: 27051956 ffffffff 65fe01a6 0031637f    '..V....e....1c.
08f00010: 80100000 80100000 bff89088 05050201    ................
08f00020: 4f70656e 57727400 00000000 43414d45    OpenWrt.....CAME
08f00030: 4f544147 00000001 000010c1 80905a19    OTAG..........Z.
08f00040: 1f8b0800 00000000 02ffec7d 7d7c1c57    ...........}}|.W
08f00050: 79eebbb3 b3d2da5e ac91b456 16478946    y......^...V.G.F
08f00060: d68cb4a9 05ac1d83 55d83693 95ec3821    ........U.6...8!
08f00070: 80933a25 5ff4ee95 e460d350 9c105a97    ..:%_....`.P..Z.
08f00080: 08b395e4 209a8d46 37b88d49 dcb29525    .... ..F7..I...%
08f00090: dbd0b5d6 b40ab86d 02c20e89 29d01af3    .......m....)...
08f000a0: 715d0860 12830d24 d4400a86 2899fb3c    q].`...$.@..(..<
08f000b0: f3618d15 d9847b6f ff28b57f bff59939    .a....{o.(.....9
08f000c0: 1feff779 cf7bce9c 73146f7c d51f49e8    ...y.{..s.o|..I.
08f000d0: 5fdba3ce 5129a4cd cac72559 d9275ab6    _...Q)....%Y.'Z.
08f000e0: b6b0450a 0533ab16 ee3006df 7a57e5d3    ..E..3...0..zW..
08f000f0: 6254fe5e 1a2b7f27 a9caa4e8 89d8fbef    bT.^.+.'........

u-boot># sf write 0x8f00000 0x100000 d80000
u-boot># sf read 0x8f00000 0x100000 d80000
u-boot># iminfo 0x8f00000

## Checking Image at 08f00000 ...
   Legacy image found
   Bad Header Checksum

u-boot># md 08f00000
08f00000: 27051956 138cde24 65520002 0021427c    '..V...$eR...!B|
08f00010: 80100000 80100000 a1009000 05050201    ................
08f00020: 4d404042 00427000 00000000 00404944    M@@B.Bp......@ID
08f00030: 45500105 00000000 00001000 00000000    EP..............
08f00040: 1f8b0800 00000000 02ffec7d 7d781c57    ...........}}x.W
08f00050: 79eebbb3 b3d2da16 84001002 12438946    y............C.F
08f00060: d6082089 05081902 01901481 00640820    .. ..........d.
08f00070: 00932225 5ff4ea91 e460d350 18001096    .."%_....`.P....
08f00080: 008085a4 00120402 37980008 d8220501    ........7...."..
08f00090: 12d0b5d6 b40aa025 00020a89 09c00871    .......%.......q
08f000a0: 01490040 10800000 00000804 0098c83c    .I.@...........<
08f000b0: f1608114 09800967 de289156 3e949119    .`.....g.(.V>...
08f000c0: 190fe771 494b4a8c 1010046c 50150920    ...qIKJ....lP..
08f000d0: 528ba1c2 40012044 88c22501 51010a06    R...@. D..%.Q...
08f000e0: a6a0400a 04020206 2e100086 5a5645c1    ..@.........ZVE.
08f000f0: 02002a5e 02091527 80402440 8898c007    ..*^...'.@$@....

u-boot># sf update 0x8f00000 0x100000 d80000
u-boot># sf read 0x8f00000 0x100000 d80000
u-boot># iminfo 0x8f00000

## Checking Image at 08f00000 ...
   Legacy image found
   Image Name:   OpenWrt
   Created:      2024-03-22  22:09:42 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    3236735 Bytes = 3.1 MB
   Load Address: 80100000
   Entry Point:  80100000
   Verifying Checksum ... OK


u-boot># md 08f00000
08f00000: 27051956 ffffffff 65fe01a6 0031637f    '..V....e....1c.
08f00010: 80100000 80100000 bff89088 05050201    ................
08f00020: 4f70656e 57727400 00000000 43414d45    OpenWrt.....CAME
08f00030: 4f544147 00000001 000010c1 80905a19    OTAG..........Z.
08f00040: 1f8b0800 00000000 02ffec7d 7d7c1c57    ...........}}|.W
08f00050: 79eebbb3 b3d2da5e ac91b456 16478946    y......^...V.G.F
08f00060: d68cb4a9 05ac1d83 55d83693 95ec3821    ........U.6...8!
08f00070: 80933a25 5ff4ee95 e460d350 9c105a97    ..:%_....`.P..Z.
08f00080: 08b395e4 209a8d46 37b88d49 dcb29525    .... ..F7..I...%
08f00090: dbd0b5d6 b40ab86d 02c20e89 29d01af3    .......m....)...
08f000a0: 715d0860 12830d24 d4400a86 2899fb3c    q].`...$.@..(..<
08f000b0: f3618d15 d9847b6f ff28b57f bff59939    .a....{o.(.....9
08f000c0: 1feff779 cf7bce9c 73146f7c d51f49e8    ...y.{..s.o|..I.
08f000d0: 5fdba3ce 5129a4cd cac72559 d9275ab6    _...Q)....%Y.'Z.
08f000e0: b6b0450a 0533ab16 ee3006df 7a57e5d3    ..E..3...0..zW..
08f000f0: 6254fe5e 1a2b7f27 a9caa4e8 89d8fbef    bT.^.+.'.......

To finish, you can push a stock image like this:
(do not forget to strip 64 = 0x40 bytes, and to adapt a62410 with the size returned by tftpboot)

tftpboot 0x8f00000 DGS-1210-FX-SERIES-FX-6-20-B020.hex
sf update 0x8f00000 0xe80000 0xa62410
reset

u-boot># iminfo

## Checking Image at b4100000 ...
   Legacy image found
   Image Name:   OpenWrt
   Created:      2024-03-22  22:09:42 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    3236735 Bytes = 3.1 MB
   Load Address: 80100000
   Entry Point:  80100000
   Verifying Checksum ... OK

u-boot># iminfo 0xb4e80000

## Checking Image at b4e80000 ...
   Legacy image found
   Image Name:
   Created:      2021-09-17   9:50:05 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    1035509 Bytes = 1011.2 KB
   Load Address: 80000000
   Entry Point:  80262000
   Verifying Checksum ... OK

and folow baseline to chose on which you want to boot :slight_smile:

PS: it was a three days no sleep challenge...

2 Likes