Flashing D-Link DGS-1210-28 F2 revision with OpenWrt

Can you have a look at the internals? Share pictures? D-Link is notorious for its revisions, switching SoCs and vendors.

Would help if you can hook up serial at this point.

1 Like

Well, this is actually I would like to avoid - opening cover. Since there's sticker which tells warranty void if removed. Maybe I wait little bit, someone might respond.

EDIT: This is from wiki:

Version: F1 or newer (older versions are different SoC)

Technically, it should work with F2 version as well. Might just be some technical detail in order to flash F2 revision, will see.

When I check D-Link's download page they do differentiate between the hardware revisions (A-F), probably because it's all a different SoC. But no distinction between F1 and F2. So yes, might be as easy as a software check somewhere.

1 Like

Just in general, the realtek target and its device support is still a bit new. Having serial console access probably should still be considered a necessity for these devices, maybe you won't have to use it, but still expect it being part of the experience. Fortunately most of these devices have sturdy metal cases, with a couple of standard head screws and are easy to open - some have the UART on pre-populated header, some will need soldering one in (such as D-Link) - but at least there's no plastic and hidden clasps making them hard to open.

2 Likes

If you're in the US that warranty sticker means nothing as it is not valid as per the FTC's Bureau of Consumer Protection. It violates the 1975 Magnuson-Moss Warranty Act. See https://www.npr.org/sections/thetwo-way/2018/04/11/601582169/warranty-void-if-removed-as-it-turns-out-feds-say-those-warnings-are-illegal.

I did. F2 revision works exactly. You have to connect serial on board otherwise do not waste your time i think.

here is serial sw version dump

DGS-1210-28> show switch 
System name                       : 
System Contact                    : 
System Location                   : 
System up time                    : 0 days, 0 hrs, 1 min, 6 secs
System Time                       : 01/01/2020 00:10:41
System hardware version           : F2
System firmware version           : 6.20.007
System boot version               : 1.01.001

Here is OpenWRT installing on DGS1210-28' RAM

u-boot># tftpboot 0x8f000000 openwrt-realtek-generic-d-link_dgs-1210-28-initramfs-kernel.bin
Using rtl8380#0 device
TFTP from server 10.90.90.95; our IP address is 10.90.90.90
Filename 'openwrt-realtek-generic-d-link_dgs-1210-28-initramfs-kernel.bin'.
Load address: 0x8f000000
Loading: T T T T T Got ARP REPLY, mac addr (98:ee:cb:xx:xx:xx), ip addr (10.90.90.95)
Got ARP REPLY, mac addr (98:ee:cb:xx:xx:xx), ip addr (10.90.90.95)
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###########################################################
done
1 Like

@alfa That's just booting from RAM, can you confirm you were able to flash OpenWrt with sysupgrade after booting OpenWrt from RAM?

I am currently working on this, are these dumps enough?

SPI Boot >>

root@SW:~# uname -a
Linux SW 5.4.113 #0 Mon Apr 19 16:34:38 2021 mips GNU/Linux
root@SW:~# cat /proc/version 
Linux version 5.4.113 (builder@buildhost) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r16575-4dcdc8249c)) #0 Mon Apr 19 16:34:38 2021
root@SW:~# fw_printenv 
BID=99
Board_Version=32
Boot_Version=1.01.001
addargs=setenv bootargs console=$(console_device),$(baudrate) mem=$(memsize) noinitrd root=$(image) rw rootfstype=squashfs
baudrate=115200
boardmodel=RTL8382M_8218B_INTPHY_8218B_8214FC_DEMO
bootdelay=1
bootstop=off
console_device=ttyS0
gatewayip=10.90.90.254
hw_version=F2
ipaddr=10.90.90.90
memsize=122M
netmask=255.0.0.0
serverip=192.168.1.111
stderr=serial
stdin=serial
stdout=serial
ethaddr=
image=/dev/mtdblock4
bootcmd=run addargs ; bootm 0xb4100000
Serial_Number=

if you used initramfs, you haven't actually installed anything ....

next time you (re)boot you'll be back at stock fw.

Borrominis question is highly relevant.

flashed sysupgrade image and no problem.

2 Likes

Well, after a while I've finally decided to flash OpenWrt via serial connection. I've tried the latest stable 21.02 version or even the latest snapshot. Unfortunately I wasn't able to flash OpenWrt successfully. I was using this installation guide mentioned in git commit. At first I couldn't ssh into switch after loading initframfs image into memory, but I've solved that problem by changing one of the LAN ports from WAN to LAN interface according to installation guide mentioned here and I've used different port other than port 1 on the switch. Then I've copied sysupgrade image and performed sysupgrade via command line or later even via GUI. This is the output from serial connection after performing sysupgrade:

U-Boot 2011.12.(2.1.5.67086)-Candidate1 (Jun 22 2020 - 14:58:40)

Board: RTL838x CPU:500MHz LXB:200MHz MEM:300MHz
DRAM:  128 MB
SPI-F: 1x32 MB
Loading 1024B env. variables from offset 0x80000
Board Model = DGS-1210-28-F1 Cameo_bdinfo_get_BoardID [293] 
Switch Model: RTL8382M_8218B_INTPHY_8218B_8214FC_DEMO (Port Count: 28)
Switch Chip: RTL8382
**************************************************
#### RTL8218B config - MAC ID = 0 ####
Now External 8218B
**************************************************
#### RTL8218B config - MAC ID = 8 ####
Now Internal PHY
**************************************************
#### RTL8218B config - MAC ID = 16 ####
Now External 8218B
**************************************************
**** RTL8214FC config - MAC ID = 24 ****
Now External 8214FC
Net:   Net Initialization Skipped
rtl8380#0
Hit Esc key to stop autoboot:  0 

Loading Runtime Image .OS:...FAILED
read: 0x56b69ccf, calculated: 0x5806c19fFS:...FAILED!!
os_ver = 83ddf784, fs_ver = 1.........(os_ver & fs_ver) = 0...
## Booting kernel from Legacy Image at b4e80000 ...
   Image Name:   
   Created:      2020-12-16  10:54:03 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    1035510 Bytes = 1011.2 KB
   Load Address: 80000000
   Entry Point:  80262000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

Linux version 2.6.19 (simon@208Server) (gcc version 3.4.4 mipssde-6.03.00-20051020) #20 PREEMPT Wed Dec 16 10:53:49 CST 2020
CPU revision is: 00019070
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
User-defined physical RAM map:
 memory: 07a00000 @ 00000000 (usable)
Built 1 zonelists.  Total pages: 30988
Kernel command line: console=ttyS0,115200 mem=122M noinitrd root=/dev/mtdblock7 rw rootfstype=squashfs csb=0x0142C0E0 cso=0x08676FCB csf=0x56C6A823 sfin=<NULL>,32MB,0;10891296 
Primary instruction cache 16kB, physically tagged, 4-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (32 instructions).
Synthesized TLB modify handler fastpath (31 instructions).
PID hash table entries: 512 (order: 9, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 121088k/124928k available (2015k kernel code, 3724k reserved, 421k data, 108k init, 0k highmem)
Mount-cache hash table entries: 512
Checking for 'wait' instruction...  available.
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 4096 bind 2048)
TCP reno registered
squashfs: version 3.3 (2007/10/31) Phillip Lougher
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver $Revision: 1.1.1.1 $ 1 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x0 (irq = 31) is a 16550A
Probe: SPI CS1 Flash Type MX25L25635F
Creating 9 MTD partitions on "Total SPI FLASH":
0x00000000-0x00080000 : "BOOT"
0x00080000-0x000c0000 : "BDINFO"
0x000c0000-0x00100000 : "BDINFO2"
0x00100000-0x00280000 : "KERNEL1"
0x00280000-0x00e80000 : "ROOTFS1"
0x00e80000-0x01000000 : "KERNEL2"
0x01000000-0x01040000 : "SYSINFO"
0x01040000-0x01c40000 : "ROOTFS2"
0x01c40000-0x02000000 : "JFFS2"
IPv4 over IPv4 tunneling driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
NET: Registered protocol family 17
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 108k freed
init started:  BusyBox v1.00 (2020.12.16-02:52+0000) multi-call binary
Starting pid 14, console : '/etc/rc'
Init RTCORE Driver Module....OK
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
passwd file exit
ssdh_config file exit

 Complete NpHwInit  
RTK.0> device TAP0 entered promiscuous mode
x3sMxRs@FoGn8: not found
w1: not found




DGS-1210-28 login: 

It seems that lines below suggest that flash wasn't successful. I still can get into u-boot and load initframfs image and repeat sysupgrade but with the same result.

Loading Runtime Image .OS:...FAILED
read: 0x56b69ccf, calculated: 0x5806c19fFS:...FAILED!!
os_ver = 83ddf784, fs_ver = 1.........(os_ver & fs_ver) = 0...

Any suggestion or possible solution would be helpful. Thanks.

post the output of the Uboot printenv command.

1 Like

Thank you for reply. This is the output from Uboot printenv command:

u-boot># printenv    
BID=99
Board_Version=32
Boot_Version=1.01.001
Serial_Number=XXXXXXXXXXXXX
addargs=setenv bootargs console=$(console_device),$(baudrate) mem=$(memsize) noinitrd root=$(image) rw rootfstype=squashfs
baudrate=115200
boardmodel=RTL8382M_8218B_INTPHY_8218B_8214FC_DEMO
bootcmd=run addargs ; bootm 0xb4e80000
bootdelay=1
bootstop=off
console_device=ttyS0
ethact=rtl8380#0
ethaddr=XX:XX:XX:XX:XX:XX
gatewayip=10.90.90.254
hw_version=F2
image=/dev/mtdblock7
ipaddr=10.90.90.90
memsize=122M
netmask=255.0.0.0
serverip=192.168.1.111
stderr=serial
stdin=serial
stdout=serial

Environment size: 611/1020 bytes

your bootm address is different than the one posted by alfa, same goes for the image parameter.

check if you can get some mtd info from stock OS, or if you boot the initramfs.

1 Like

This is the output from fw_printenv command on initframfs image:

root@OpenWrt:/# fw_printenv
BID=99
Board_Version=32
Boot_Version=1.01.001
addargs=setenv bootargs console=$(console_device),$(baudrate) mem=$(memsize) noinitrd root=$(image) rw rootfstype=squashfs
baudrate=115200
boardmodel=RTL8382M_8218B_INTPHY_8218B_8214FC_DEMO
bootdelay=1
bootstop=off
console_device=ttyS0
gatewayip=10.90.90.254
hw_version=F2
ipaddr=10.90.90.90
memsize=122M
netmask=255.0.0.0
serverip=192.168.1.111
stderr=serial
stdin=serial
stdout=serial
ethaddr=XX:XX:XX:XX:XX:XX
Serial_Number=XXXXXXXXXXXXX
image=/dev/mtdblock7
bootcmd=run addargs ; bootm 0xb4e80000

do a cat /proc/mtd from in there.

1 Like

Thanks for reply. Output from cat /proc/mtd command:

root@OpenWrt:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00010000 "u-boot"
mtd1: 00040000 00010000 "u-boot-env"
mtd2: 00040000 00010000 "u-boot-env2"
mtd3: 00d80000 00010000 "firmware"
mtd4: 002b0000 00010000 "kernel"
mtd5: 00ad0000 00010000 "rootfs"
mtd6: 00860000 00010000 "rootfs_data"
mtd7: 00180000 00010000 "kernel2"
mtd8: 00040000 00010000 "sysinfo"
mtd9: 00c00000 00010000 "rootfs2"
mtd10: 003c0000 00010000 "jffs2"

add the dmesg part where the mtds are detected/listed.

1 Like

This is the part where mtds are detected:

[    1.577617] 8 fixed-partitions partitions found on MTD device rtl838x_nor
[    1.585299] Creating 8 MTD partitions on "rtl838x_nor":
[    1.591237] 0x000000000000-0x000000080000 : "u-boot"
[    1.599278] 0x000000080000-0x0000000c0000 : "u-boot-env"
[    1.607796] 0x0000000c0000-0x000000100000 : "u-boot-env2"
[    1.616432] 0x000000100000-0x000000e80000 : "firmware"
[    1.637710] 2 uimage-fw partitions found on MTD device firmware
[    1.644464] Creating 2 MTD partitions on "firmware":
[    1.650122] 0x000000000000-0x0000002b0000 : "kernel"
[    1.658216] 0x0000002b0000-0x000000d80000 : "rootfs"
[    1.666226] mtd: device 5 (rootfs) set to be root filesystem
[    1.672734] 1 squashfs-split partitions found on MTD device rootfs
[    1.679771] 0x000000520000-0x000000d80000 : "rootfs_data"
[    1.688404] 0x000000e80000-0x000001000000 : "kernel2"
[    1.696741] 0x000001000000-0x000001040000 : "sysinfo"
[    1.705028] 0x000001040000-0x000001c40000 : "rootfs2"
[    1.713284] 0x000001c40000-0x000002000000 : "jffs2"

I've uploaded full dmesg output to this link in case it would be needed.

After struggling I've decided to hard reset device via reset button located on the front of the switch. Surprisingly OpenWrt now works on DGS-1210-28 F2 revision!

2 Likes