D-Link open source switches: DGS 1210 product line

Dear friends,

DLink recently open-sourced some of their major switch products, see DLink opensource website.

I would like to point out this post, which I wrote about DLink DGS-1210 switch series.

This would be great to have access to cheap switches with 8 to 48 ports in LEDE. Those switches only support IPv4, therefore they are now widely available second hand no eBay ...

As I don't have any SPI analyser, I am giving you the link of my post, if you find it interesting, buy one of those switches and try to find the serial connection:

https://forum.openwrt.org/viewtopic.php?id=56245
https://wiki.openwrt.org/toh/d-link/dgs-1210

It should then be "relatively" easy to have them work.

I asked for help on DLink website:
http://forums.dlink.com/index.php?topic=67009.0

Just in case some might help me the location of the serial console or SPI plug.

Why has this been posted in the "Community Builds" category?
As far as I can see this thread is about adding support for this device, right?

Thanks tmomas. I justed pushed in the right section "Developers".

Grab Dlink 1210 with ME index. It have console port.
ARMv7 with 112Mb memory and 32Mb flash.

You mean console port over Ethernet or console port on the motherboard? I am looking for the console port on the motherboard. Kind regards,

See datasheet image. Left RJ45 connector - RS232 port. Early firmware revisions allow access to unprotected bootloader. Now, bootloader is protected ;(

i see, this is this kind of cable:
www.ebay.fr/itm/RS232-DB9-1-8m-Cable-adaptateur-connecteur-RJ45-Ethernet-/352007441987

I am looking for a serial plug on the motherboard.
Anyhow, these are good news.

I don't have the required hardware, i need to buy a jtag analyser.
or I will use a Raspberry Pie with tjtag-pi.

For what? Device based on custom? broadcom iProc SoC. You need soic8 clip and cheap SPI programmer based on CH341A to dump flash (MX25L25635E), modify squashfs stored in mtdblock3 (rootfs) and write it back.

Could you recommend me a cheap soic8 clip and programmer either on eBay or Amazon. I understand this is for dumping/reading flash. b

But do you know any tool that would help me find a serial console? Serial console is needed to dump caracteristics of the board and find drivers, etc ... I have a good working USB to ttl serial console tool, but after days and days, I never found a serial console. There must be some serial console somewhere.

I found this interesting post:

I have been looking for 4 pins:
VCC
Ground
Transmit
RX

i searched them in the same area, as there is ground and VCC everywhere on the board. Maybe I did not search very well and should reconsider my seach. Will get back.

this combo or this.
DON'T BUY "blue" or "green" borads, on it Chinese soldering cheapest voltage regulator instead of AMS1117-3.3 which able to provide current ~700 mA.

Buy logic analayzer - it really helps watching on multiple lines and decode protocols.

Don't know about cheap line DGS-1210, but in DGS-1210-x/ME - RJ45 console - mapped to /dev/ttyS0 and when kernel crashed - it show panics traces.

Inside switch nothing new - standard busybox, ISS.exe (main switch software), two proprietary broadcom kernel modules.

The GPL source code for the DGS-1210-ME is available here:
http://tsd.dlink.com.tw/downloads2008detail.asp

Scoll-down, select "Open Source" and choose your model.
The tarbal includes a build script to make the firmware;
Does not sound very "proprietary", but could be.

it even includes the build toolchain:

Install & Build

  1. Build Environment:
    1.1 CentOS 5.6 for 32-bit version, Ubuntu 10.4 for 32-bit version, fully install.
    1.2 You can open Terminal for using command line.
  1. Put "DGS-1210-10P-ME-GPLSourceCode.tar.gz" under /home and using command "tar -zxvf DGS-1210-10P-ME-GPLSourceCode.tar.gz" to untar it.

  2. Prepare for toolchain:
    3.1 Move /home/DGS-1210-10P-ME/toolchain/iproc_3.4.6 folder to /opt folder. (Ex. In /home/DGS-1210-10P-ME/, and using command "sudo mv toolchain/iproc_3.4.6 /opt")
    3.2 Change toolchain owner to root. (Ex. using command "sudo chown -R root:root /opt/iproc_3.4.6")

  3. Add yourself to the sudo list
    Edit "/etc/sudoers" to add your account to the sudoers.
    For example :
    user ALL=(ALL) NOPASSWD: ALL

    This action is only allowed by super user, and the file "sudoers" is read-only.
    You must login in super user and change the file permission.
    Remember to change file permission back to 440 by command "chmod 440 /etc/sudoers".

  1. In /home/DGS-1210-10P-ME/,
    then type command "source build.env" then type "make GPL".

  2. After building finished, you can find /home/DGS-1210-10P-ME/image folder and firmware("DGS-1210-10P-ME-B1-OS.hex"), ("DGS-1210-10P-ME-B1-BOOT.hex").

Here is the build script:

#################################################################

Copyright (C) 2009 D-Link Corp./D-Link Systems, Inc.

------------------------------------------------------

DESCRIPTION : The makefile for builing the complete

Management Switch image files.

#################################################################
include ${MGM_PROJECT_BASE_DIR}/make.h

CP := cp
RM := rm
CAT := cat
CC := $(CROSS_COMPILE)gcc
STRIP := $(CROSS_COMPILE)strip
GZIP := gzip
DD := dd
OBJDUMP := $(CROSS_COMPILE)objdump

os_dir := os/linux-3.6.5_iProLDK_3.4.6

OS_DIR := ${MGM_PROJECT_BASE_DIR}/${os_dir}
BOOT_ABSOLUTE_DIR := ${MGM_PROJECT_BASE_DIR}/boot/uboot-2012.10_iProLDK_3.4.6
OS_ABSOLUTE_DIR := ${MGM_PROJECT_BASE_DIR}/os/linux-3.6.5_iProLDK_3.4.6
IMAGE_ABSOLUTE_DIR := ${MGM_PROJECT_BASE_DIR}/image
TOOL_DIR := ${MGM_PROJECT_BASE_DIR}/tools

TAG_BOOT_VERSION := 1

IMGTAG := ${TOOL_DIR}/./imgtag
GEN_CHECKSUM := ${TOOL_DIR}/genTotalChecksum
IMGHDR := ${TOOL_DIR}/imghdr

MODEL := ${MODEL_NAME}
CUSTOMER_SIGNATURE := 2
BOARD_VERSION := 16
TAG_OS_VERSION := 1
HW_VER := B1
OUTPUT_BOOT_HEX := ${OUTPUT_IMAGE_FOLDER_NAME}-BOOT.hex
OUTPUT_OS_HEX := ${OUTPUT_IMAGE_FOLDER_NAME}-OS.hex
HEADER_MODEL := ${DISPLAY_MODEL_NAME}

.PHONY: os

Check if "image" folder exists

check-image-folder:
if [ -d ${IMAGE_ABSOLUTE_DIR} ]; then
echo "image folder exists";
else
echo "no image folder exists";
mkdir ${IMAGE_ABSOLUTE_DIR};
fi

change tool mod to 777

change_tools:
chmod 777 -R ${TOOL_DIR}

Make u-boot and copy ot to image dir

boot: check-image-folder
chmod 777 -R ${BOOT_ABSOLUTE_DIR}
${CP} ${BOOT_ABSOLUTE_DIR}/include/configs/cameo/smart5_series.h ${BOOT_ABSOLUTE_DIR}/include/configs/cameo/cameo_header.h
sed -i "s/hw_version=../hw_version=${HW_VER}/g" ${BOOT_ABSOLUTE_DIR}/include/configs/cameo/cameo_header.h
sed -i "s/#define BOARD_VERSION../#define BOARD_VERSION ${BOARD_VERSION}/g" ${BOOT_ABSOLUTE_DIR}/include/configs/cameo/cameo_header.h
make -w -C ${BOOT_ABSOLUTE_DIR} O=./build-output mdk-all
${CP} ${BOOT_ABSOLUTE_DIR}/build-output/u-boot.bin ${IMAGE_ABSOLUTE_DIR}/boot.bin

Make OS image and copy ot to image dir

os: check-image-folder
chmod 777 -R ${OS_ABSOLUTE_DIR}
cp ${OS_ABSOLUTE_DIR}/cameo/cameo.config/hurricane2_dgs_linux-3.6.5-flash.config ${OS_ABSOLUTE_DIR}/.config
make -w -C ${OS_ABSOLUTE_DIR} oldconfig
make -w -C ${OS_ABSOLUTE_DIR} zImage
if [ -f ${OS_ABSOLUTE_DIR}/arch/arm/boot/Image.gz ]; then
${RM} ${OS_ABSOLUTE_DIR}/arch/arm/boot/Image.gz;
fi
gzip -9 ${OS_ABSOLUTE_DIR}/arch/arm/boot/Image
echo 'start address ${LOADADDR}' > ${IMAGE_ABSOLUTE_DIR}/vmlinux.dump
${TOOL_DIR}/mkimage -A arm -O linux -T kernel -n Image -a ${LOADADDR} -C gzip -d ${OS_ABSOLUTE_DIR}/arch/arm/boot/Image.gz ${IMAGE_ABSOLUTE_DIR}/vmlinux.gz

os-clean:
make -w -C ${OS_DIR} clean

------------------------------------------------------------------------------

Make relevant image information and attach

------------------------------------------------------------------------------

.PHONY: vmlinux-attach-version-checksum
vmlinux-attach-version-checksum:
${CP} ${IMAGE_ABSOLUTE_DIR}/vmlinux.gz ${IMAGE_ABSOLUTE_DIR}/vmlinux.tag
${IMGTAG} ${IMAGE_ABSOLUTE_DIR}/vmlinux.tag ${TAG_OS_VERSION}
${GEN_CHECKSUM} ${IMAGE_ABSOLUTE_DIR}/vmlinux.tag ${IMAGE_ABSOLUTE_DIR}/vmlinux.sum
${CAT} ${IMAGE_ABSOLUTE_DIR}/vmlinux.tag ${IMAGE_ABSOLUTE_DIR}/vmlinux.sum > ${IMAGE_ABSOLUTE_DIR}/vmlinux.vc
${CP} ${IMAGE_ABSOLUTE_DIR}/vmlinux.vc ${IMAGE_ABSOLUTE_DIR}/vmlinux.ub
${RM} ${IMAGE_ABSOLUTE_DIR}/vmlinux.tag
${RM} ${IMAGE_ABSOLUTE_DIR}/vmlinux.sum

Make relevant image information and attach

boot-attach-version-checksum:
${CP} ${IMAGE_ABSOLUTE_DIR}/boot.bin ${IMAGE_ABSOLUTE_DIR}/boot.tag
${HEXTAG} ${IMAGE_ABSOLUTE_DIR}/boot.tag ${BOOT_VERSION}
${IMGTAG} ${IMAGE_ABSOLUTE_DIR}/boot.tag ${TAG_BOOT_VERSION}
${GEN_CHECKSUM} ${IMAGE_ABSOLUTE_DIR}/boot.tag ${IMAGE_ABSOLUTE_DIR}/boot.sum
${CAT} ${IMAGE_ABSOLUTE_DIR}/boot.tag ${IMAGE_ABSOLUTE_DIR}/boot.sum > ${IMAGE_ABSOLUTE_DIR}/boot.vc
${RM} ${IMAGE_ABSOLUTE_DIR}/boot.tag
${RM} ${IMAGE_ABSOLUTE_DIR}/boot.sum

Make bimage for update boot code only

bimage: boot-attach-version-checksum
${RM} -f ${IMAGE_ABSOLUTE_DIR}/bimage
${CP} ${IMAGE_ABSOLUTE_DIR}/boot.vc ${IMAGE_ABSOLUTE_DIR}/bimage
${IMGHDR} ${IMAGE_ABSOLUTE_DIR}/boot.vc ${IMAGE_ABSOLUTE_DIR}/${OUTPUT_BOOT_HEX} ${HEADER_MODEL} boot 0 ${CUSTOMER_SIGNATURE} ${BOARD_VERSION} ${IMAGE_ABSOLUTE_DIR}/vmlinux.dump
${RM} -f ${IMAGE_ABSOLUTE_DIR}/boot.vc ${IMAGE_ABSOLUTE_DIR}/boot.bin
${RM} -f ${IMAGE_ABSOLUTE_DIR}/bimage

zimage: vmlinux-attach-version-checksum
${RM} -f ${IMAGE_ABSOLUTE_DIR}/zimage
${DD} if=${IMAGE_ABSOLUTE_DIR}/vmlinux.vc of=${IMAGE_ABSOLUTE_DIR}/zimage bs=1024
${IMGHDR} ${IMAGE_ABSOLUTE_DIR}/vmlinux.vc ${IMAGE_ABSOLUTE_DIR}/${OUTPUT_OS_HEX} ${HEADER_MODEL} os 2 ${CUSTOMER_SIGNATURE} ${BOARD_VERSION} ${IMAGE_ABSOLUTE_DIR}/vmlinux.dump
${RM} -f ${IMAGE_ABSOLUTE_DIR}/vmlinux.vc

------------------------------------------------------------------------------

Remove unnecessary files to save disk space

------------------------------------------------------------------------------

clear-file:
find ./image -path "./image/" ! -name ".hex" -exec rm -f {} ;
find ./ -name ".pfx" -delete
find ./ -name "
.spc" -delete
find ./ -name ".pvk" -delete
find ./ -name "
.tgz" -delete
find ./ -name ".gz" -delete
find ./ -name "
.xz" -delete
find ./ -name ".bz" -delete
find ./ -name "
.bz2" -delete
find ./ -name ".Z" -delete
find ./ -name "
.tar" -delete
find ./ -name ".lha" -delete
find ./ -name "
.cab" -delete
find ./ -name "*.z" -delete

GPL:check-image-folder change_tools os zimage boot bimage clear-file

Well ... I will sacrifice my switch: build from scratch using the toolchain. Hoping to add telnet or SSH to able to gain serial access ...

I am installaling the requested Ubuntu 10.04 i386 in KVM and trying to compile all firmwares to make them available.

Edit : Dlink has been working on different versions of the 1210P switch for more than 10 years. i am running the first version of the 1210P, firmware A1 and it compiles with ... Redhat9 or Fedora code 3. This is back in 2004!!! And we are in 2017 at the time of writing. This shows how important it would be to support a line of "old" switches and make run under LEDE. The kernel of my 1210P-A1 must be full of bugs ...DLink has so many different products that it can hardly upgrade them all ...

Anyway, it is great to see all this open-source. I will build all versions and make them available to allow flashing switches (I am still dreaming it is possible).

I had a lot of fun installing this old Fedora Core 3 and it made the job.
Hopefully, I have been using GNU/Linux since RH7...

Here is the build script:

The only problem is the last command to create an image. It fails with an error!

Furthermore, this image does not seem (?) to be usable. It is just a kernel build.
What would you recommend? Starting from scratch using kernel config and making a custom LEDE firmware?

I am quite lost, although this could be quite easy as this seems non-proprietary.
I really wonder why there is nearly zero unbricked DLink switch runnning under LEDE.

By the way, I really need serial console, because after/if loading finally LEDE, there will be probably zero network configuration, thus a need for a console ...

Apparently, the switch has an emergency TFTP boot procedure.
Also included partial .config file

Anyone interested, go ahead and buy one of those switches.
They are cheap ...

Example, in UK;
http://www.ebay.fr/itm/D-LINK-WEB-SMART-SWITCH-DGS-1210-16-/132186724131?hash=item1ec6f15723:g:WrwAAOSww5hZEdOi

16 ports = 20 GDB + shipment

Before buying, verify that GPL source code is available:
http://tsd.dlink.com.tw/downloads2008detail.asp

Then contact me in this thread.

I will now try to compile a custom LEDE release for my D-Link switch.

Do I miss something or everything is available for a LEDE? What could happen worse now? What if I boot in LEDE and i don't have any network? What do you think of network and switch, is it well supported in your opinion?

Hi All.
Not sure if you are still interested by finding the serial console port...

I was playing with my DGS 1210-10P which has POE board broken. Yet, despite only the POE pcb (which is independent from the main pcb) the whole stuff refuse to boot correctly.
So I hack to find if I could simply configure somewhere there is no poe board...

Well the serial console is a RS232 one. CON2 is link to a ADM3202 RS232/TTL converter (at the back of the pcb)
IMG_8792

115200 bauds. Uboot console available, just hit a key to stop the boot. Looks like being able to boot from nfs...

Arnaud

2 Likes

I am looking at getting one of these (1210-28P) and I would very much like to have OpenWrt on it. Has there been any progress on this?