Markus Stockhausen 4439b2ddc2 realtek: add support for D-Link DGS-1250-28X
Hardware specification
----------------------

* RTL9301 SoC, 1 MIPS 34KEc core @ 800MHz
* 512MB DRAM
* 64MB NAND Flash
* 24 x 10/100/1000BASE-T ports
* 4 x 10G SFP+ ports
* Power LED, Console LED, Fan Fault LED
* Reset button on front panel
* LM75 temperature sensor
* Atmel AT24C02 2kb eeprom
* fan (controllable via gpio for on/off and LM75 for low/high speed)
* UART (115200 8N1) via RJ45

Installation using serial interface
-----------------------------------

 1. Prepare TFTP server & connect to serial port.
 2. Connect DGS-1250 to your computer or network with one of the
    1G ports. All of them will be fine.
 3. Power on DGS-1250 and interrupt autoboot with "&".
 4. Change U-Boot startup sequence
	> setenv silent
	> setenv bootcmd 'cp.l 0xb4200000 0x84000000 0x300000; bootm 0x84000000'
	> saveenv
 5. Enable networking within U-Boot.
	> rtk network on
 6. Set switch IP and TFTP server IP (optional, adjust to your setup).
	> setenv ipaddr <ip>
	> setenv serverip <ip>
 7. Download initramfs image from TFTP server.
	> tftpboot 0x84000000 <image name>
 8. Boot with the downloaded image.
	> bootm 0x84000000
 9. With rambooted OpenWrt, backup the stock firmware.
    THIS IS CRITICAL! /dev/mtd3 contains data that is not provided
    in the downloadable vendor firmware images.
10. Copy sysupgrade image to the device.
11. Perform sysupgrade with the sysupgrade image.
12. After reboot, you should have functional OpenWrt.

Installation using OEM webinterface
-----------------------------------

This is not possible because the vendor image uses a ubifs based
loading technique with encrypted images. To be precise the boot
sequence basically runs as follows.

 1. U-Boot starts
 2. U-Boot mounts 62MB ubifs from mtd3
 3. U-Boot reads Linux kernel from file uImage inside ubifs
 4. Linux starts (this is a initramfs image)
 5. Linux mounts ubifs
 6. Linux calls a loader binary
 7. Depending on current configuration first (file Image1) or
    second firmware image (file Image2) is loaded and decrypted
 8. Inside the decrpyted firmware image there is a executable
    named “switch”
 9. "switch" executable is run and the switch comes alive

Reverting to stock firmware
---------------------------

 1. Boot OpenWrt from initramfs (like in installation section above)
 2. Restore partition /dev/mtd3 from backup
 3. Erase Openwrt special U-Boot env
	# mtd erase mtd1
 4. reboot

Further information
-------------------

Wiki: https://openwrt.org/toh/d-link/dgs-1250
Forum: https://forum.openwrt.org/t/support-for-d-link-dgs-1250-switches
Partition dumps: https://github.com/plappermaul/realtek-doc/tree/main/DGS-1250

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22530
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-03-30 19:10:46 +02:00
..