The D-Link DIR-685 is based around the Gemini platform and ARMv4 Faraday FA526 silicon design. It has the following features:
No UART access is required to flash this device: a recovery web server is available.
You can use the default OpenWrt builds to install the router.
If you trust it, an image with LuCI and ksmbd working out of the box can be found here: https://dflund.se/~triad/krad/dlink-dir-685/openwrt-gemini-dlink_dir-685-squashfs-factory.bin but rebuilding OpenWrt for your need is more fun.
reset button on the back side of the device with a small screwdriver or paperclip.reset press down and power on device, wait around 10 seconds, the device should now be in web firmware upgrade modeLAN TP connectorshttp://192.168.0.1openwrt-gemini-generic-dlink_dir-685-squashfs-factory.bin), upload it and wait for the device to rebootUsing this method, new installs are downloaded using TFTP, see the generic OpenWrt TFTP instructions.
The firmware can be reflashed from the RedBoot derivative “Boot Menu” that comes up if you have a serial console and hammer Ctrl+C during startup like this:
openwrt-gemini-generic-dlink_dir-685-squashfs-factory.bin file using TFTP, you need to rename it because the boot loader cannot handle this long filename. I just name it openwrtErase flash (0x30040000): Size=32768000 ........ Program flash (0x30040000): Size=6750212 ........
Now OpenWrt is installed on your router, and you can proceed to basic configuration.
Upload the openwrt-gemini-generic-dlink_dir-685-squashfs-sysupgrade.bin image to the routers /tmp directory. If your networking is set up properly it should be just something like:
scp openwrt-gemini-generic-dlink_dir-685-squashfs-sysupgrade.bin root@192.168.1.2:/tmp
Then issue sysupgrade:
sysupgrade /tmp/openwrt-gemini-generic-dlink_dir-685-squashfs-sysupgrade.bin
The DIR-685 will flash the firmware upgrade and reboot.
There is no need to wait for the JFFS2 to initialize when upgrading the firmware: this is just needed on factory installs.
The first time you boot up the device the integrity of the JFFS2 filesystem will be checked and only after around 300 seconds, when this is finished the remaining flash will be erased and the network will come up:
[ 299.633285] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 jffs2_build_filesystem(): unlocking the mtd device... done. [ 299.935160] jffs2_build_filesystem(): erasing all blocks after the end marker...
After an additional 400 seconds the JFFS2 file system is built:
[ 408.373438] jffs2: notice: (1739) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found. [ 415.688054] overlayfs: upper fs does not support tmpfile.
After this, the device is fully installed. Do not turn off the device during this initialization time.
This gemini ethernet switch uses a DSA (distributed switch architecture) switch which is a reasonably new feature in the mainline kernel (v5+). It allows for individual ports to be configured with more features than just VLAN IDs. Because of this, the network setup is slightly different. Upon typing ifconfig, you should see a distinct 'lan#' port for each lan port on the switch. Users interested in more details can refer to the DSA section in the kernel docs.
If you slot in a hard disk in the device this can be pretty easily partitioned, formatted and used for storage, e.g. for using the router as a NAS device. With a completely blank disk the procedure is something like this:
fdisk /dev/sda press n, p, ENTER, ENTER, ENTER, w to create /dev/sda1mkfs.ext4 /dev/sda1block detect | uci import fstabuci set fstab.@mount[-1].enabled='1'uci commit fstab/dev/sda1 for mounting with cat /etc/config/fstab/dev/sda1 mounted as /mnt/sda1
The same procedure can be used for a USB disk, just augment the above. If you have both an internal harddrive and a USB disk attached, the internal harddrive will be /dev/sda and the USB disk will be /dev/sdb.
A basic configuration as an OpenWrt NAS is very simple and straight forward, for this memory-constrained device it is recommended to use ksmbd as SMB server if you desire to use the SMB protocol to access your NAS (such as with Windows and many media players). The most common SMB server samba4 is unfortunately too memory hungry and can make the device thrash and hang, and connections and transfers time out as a result.
Enable hdparm in your build by:
make menuconfig
From the top menu: Base system → Customize busybox options → Miscellaneous utilities → hdparm
This tool is used to instruct the harddrive to spin down when unused. Not doing that will be annoying since the drive will always be spinning.
If you rebuild the firmware image from scratch to get ksmbd you can do like this:
scripts/feeds update scripts/feeds install ksmbd-server make menuconfig
From the top menu, select Network → Filesystem → ksmbd-server, then select as 'y' (star) to get into default install and rebuild OpenWrt. I usually also install the utils, but they are only needed if you want to create individual users. After you put the resulting ext4 filesystem on the drive, rebooted and made basic set-up like above /dev/sda should exist and you can proceed to set up a samba share:
chown nobody /mnt/sda1 chgrp nogroup /mnt/sda1
Edit /etc/config/ksmbd to contain something like this:
config globals
option 'workgroup' 'WORKGROUP'
option 'description' 'ksmbd on DIR-685'
config share
option path '/mnt/sda1'
option name 'dir685'
option create_mask '0666'
option dir_mask '0777'
option read_only 'no'
option guest_ok 'yes'
Reboot and you can browse to the IP number (etc) of your NAS, use the dns313 share and upload and download files that will appear in /mnt/sda1, of course you can set up whatever partition etc you like.
The little video screen appear as tty0 so one way of making use of it is to install the package iftop and let init run it, by adding the following to the end of /etc/inittab:
tty0::respawn:iftop -i br-lan
For background and generic information see the generic serial console documentation.
The J3 header on the top in the front picture is the serial port connector. This is the pin assignment:
o o o _ o | | | | | | | RX | | VCC | GND TX
Once the UART is properly connected open (in this case) /dev/ttyUSB0 in your serial console (terminal) program and set it to 19200 baud, no hardware flow control (obviously, do you see any CTS or DTS leads) 8 bits, 1 stop bit.