OpenWrt for D-Link DNS320 A1 - v25.12.0

Clone of OpenWrt repo with required changes and installable binaries. v25.12.0 (I'll add other releases as they become available, and patches can be adjusted for Snapshot but that's a moving target I don't want to keep up with):

Changes for device support are in a single commit including a fan control daemon.
GitHub releases include flashable binaries, but building your own is straightforward (clone openwrt's repo, check out v24.10.5 and cherry-pick top release from here. This repo includes a diffconfig). Images + u-boot are for a D-Link DNS-320-A1. Other hardware versions (including A2) are untested and most probably will not work.

Any feedback or review comments welcome. The goal is to have a PR to add support to OpenWrt main with a non-zero chance for it to be accepted.

Status

Everything works. :slight_smile:

BusyBox v1.37.0 (2026-03-03 00:14:15 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 25.12.0, r32713-f919e7899d Dave's Guitar
 -----------------------------------------------------

 OpenWrt recently switched to the "apk" package manager!

 OPKG Command           APK Equivalent      Description
 ------------------------------------------------------------------
 opkg install <pkg>     apk add <pkg>       Install a package
 opkg remove <pkg>      apk del <pkg>       Remove a package
 opkg upgrade           apk upgrade         Upgrade all packages
 opkg files <pkg>       apk info -L <pkg>   List package contents
 opkg list-installed    apk info            List installed packages
 opkg update            apk update          Update package lists
 opkg search <pkg>      apk search <pkg>    Search for packages
 ------------------------------------------------------------------

For more information visit:
https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet

dmesg
root@OpenWrt:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.12.71 (builder@buildhost) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 14.3.0 r32713-f919e7899d) 14.3.0, GNU ld (GNU Binutils) 2.44) #0 Tue Mar  3 00:14:15 2026
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: D-Link DNS-320 NAS (Rev A1)
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] OF: reserved mem: Reserved memory: No reserved-memory node in the DT
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Kernel command line: console=ttyS0,115200 mtdparts=orion_nand:0x0e0000@0x0(uboot)ro,0x20000@0x0e0000(ubootenv)ro,0x7f00000@0x100000(ubi) :::DB88FXX81:egiga0:none
[    0.000000] Unknown kernel command line parameters ":::DB88FXX81:egiga0:none", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32768
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] RCU Tasks Trace: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=1.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11467562657 ns
[    0.000003] sched_clock: 32 bits at 167MHz, resolution 6ns, wraps every 12884901885ns
[    0.000056] Switching to timer-based delay loop, resolution 6ns
[    0.000271] Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=1666666)
[    0.000314] CPU: Testing write buffer coherency: ok
[    0.000475] pid_max: default: 32768 minimum: 301
[    0.014551] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.014599] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.029349] Setting up static identity map for 0x100000 - 0x10003c
[    0.029783] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.030487] Memory: 118196K/131072K available (7385K kernel code, 585K rwdata, 1136K rodata, 1024K init, 242K bss, 12452K reserved, 0K cma-reserved)
[    0.040245] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.040297] futex hash table entries: 256 (order: 0, 3072 bytes, linear)
[    0.050299] pinctrl core: initialized pinctrl subsystem
[    0.055289] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.056110] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.058087] thermal_sys: Registered thermal governor 'step_wise'
[    0.058234] cpuidle: using governor ladder
[    0.058947] Feroceon L2: Enabling L2
[    0.058999] Feroceon L2: Cache support initialised.
[    0.062784] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-temp-alarm
[    0.062816] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-fan-tacho
[    0.062841] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-present-sata1
[    0.062865] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-present-sata0
[    0.062888] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-power-back-on
[    0.068772] No ATAGs?
[    0.092680] SCSI subsystem initialized
[    0.093568] libata version 3.00 loaded.
[    0.094013] usbcore: registered new interface driver usbfs
[    0.094091] usbcore: registered new interface driver hub
[    0.094193] usbcore: registered new device driver usb
[    0.097015] clocksource: Switched to clocksource orion_clocksource
[    0.112354] NET: Registered PF_INET protocol family
[    0.112796] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.114731] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.114775] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.116143] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.116182] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.116230] TCP: Hash tables configured (established 1024 bind 1024)
[    0.117073] MPTCP token hash table entries: 512 (order: 1, 6144 bytes, linear)
[    0.117408] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.117448] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.118684] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.118752] PCI: CLS 0 bytes, default 32
[    0.123070] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.125425] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.125443] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.130726] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.134068] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.136341] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.137363] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.140233] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.145510] printk: legacy console [ttyS0] disabled
[    0.146043] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 25, base_baud = 10416666) is a 16550A
[    0.146106] printk: legacy console [ttyS0] enabled
[    0.683958] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 26, base_baud = 10416666) is a 16550A
[    0.694594] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[    0.700982] nand: Samsung NAND 128MiB 3,3V 8-bit
[    0.705591] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.713235] Scanning device for bad blocks
[    0.821706] 3 cmdlinepart partitions found on MTD device orion_nand
[    0.827978] Creating 3 MTD partitions on "orion_nand":
[    0.833107] 0x000000000000-0x0000000e0000 : "uboot"
[    0.863654] 0x0000000e0000-0x000000100000 : "ubootenv"
[    0.870159] 0x000000100000-0x000008000000 : "ubi"
[    0.890935] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    1.618297] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address fc:75:16:01:85:bd
[    1.628097] rtc-mv f1010300.rtc: registered as rtc0
[    1.633007] rtc-mv f1010300.rtc: setting system clock to 2026-03-22T19:25:26 UTC (1774207526)
[    1.641684] i2c_dev: i2c /dev entries driver
[    1.647629] orion_wdt: Initial timeout 25 sec
[    1.657085] marvell-cesa f1030000.crypto: CESA device successfully registered
[    1.666688] NET: Registered PF_INET6 protocol family
[    1.675293] Segment Routing with IPv6
[    1.679132] In-situ OAM (IOAM) with IPv6
[    1.683225] NET: Registered PF_PACKET protocol family
[    1.688376] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    1.701768] 8021q: 802.1Q VLAN Support v1.8
[    1.753249] UBI: auto-attach mtd2
[    1.756602] ubi0: attaching mtd2
[    1.956878] ubi0: scanning is finished
[    1.975919] ubi0: attached mtd2 (name "ubi", size 127 MiB)
[    1.981466] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[    1.988354] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[    1.995042] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
[    2.001823] ubi0: good PEBs: 1016, bad PEBs: 0, corrupted PEBs: 0
[    2.007921] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
[    2.015121] ubi0: max/mean erase counter: 5/3, WL threshold: 4096, image sequence number: 1766005702
[    2.024248] ubi0: available PEBs: 0, total reserved PEBs: 1016, PEBs reserved for bad PEB handling: 20
[    2.033996] ubi0: background thread "ubi_bgt0d" started, PID 362
[    2.040769] block ubiblock0_1: created from ubi0:1(rootfs)
[    2.046254] ubiblock: device ubiblock0_1 (rootfs) set to be root filesystem
[    2.053538] clk: Disabling unused clocks
[    2.067152] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    2.078606] Freeing unused kernel image (initmem) memory: 1024K
[    2.084541] Run /sbin/init as init process
[    2.088664]   with arguments:
[    2.088676]     /sbin/init
[    2.088687]     :::DB88FXX81:egiga0:none
[    2.088697]   with environment:
[    2.088705]     HOME=/
[    2.088714]     TERM=linux
[    2.796558] init: Console is alive
[    2.800410] init: - watchdog -
[    3.553009] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.678417] gpio_button_hotplug: loading out-of-tree module taints kernel.
[    3.706672] orion-ehci f1050000.ehci: EHCI Host Controller
[    3.712292] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    3.720156] orion-ehci f1050000.ehci: irq 35, io mem 0xf1050000
[    3.737053] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    3.744278] hub 1-0:1.0: USB hub found
[    3.748444] hub 1-0:1.0: 1 port detected
[    3.770456] sata_mv f1080000.sata: version 1.28
[    3.771269] sata_mv f1080000.sata: slots 32 ports 2
[    3.782082] scsi host0: sata_mv
[    3.787665] scsi host1: sata_mv
[    3.791431] ata1: SATA max UDMA/133 irq 36 lpm-pol 0
[    3.796399] ata2: SATA max UDMA/133 irq 36 lpm-pol 0
[    4.277045] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[    4.285692] ata1.00: ATA-7: ST3320820AS, 3.CHN, max UDMA/100
[    4.291389] ata1.00: 625142448 sectors, multi 0: LBA48 NCQ (depth 31/32)
[    4.302720] ata1.00: configured for UDMA/100
[    4.307634] scsi 0:0:0:0: Direct-Access     ATA      ST3320820AS      N    PQ: 0 ANSI: 5
[    4.317984] sd 0:0:0:0: [sda] 625142448 512-byte logical blocks: (320 GB/298 GiB)
[    4.325556] sd 0:0:0:0: [sda] Write Protect is off
[    4.330385] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    4.330491] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    4.339678] sd 0:0:0:0: [sda] Preferred minimum I/O size 512 bytes
[    4.362376]  sda: sda1 sda2
[    4.365617] sd 0:0:0:0: [sda] Attached SCSI disk
[    9.867028] ata2: link is slow to respond, please be patient (ready=0)
[   10.587043] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[   10.617301] ata2.00: ATA-8: SAMSUNG HD501LJ, CR100-13, max UDMA7
[   10.623307] ata2.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   10.632631] ata2.00: configured for UDMA/133
[   10.637547] scsi 1:0:0:0: Direct-Access     ATA      SAMSUNG HD501LJ  0-13 PQ: 0 ANSI: 5
[   10.647710] sd 1:0:0:0: [sdb] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[   10.655239] sd 1:0:0:0: [sdb] Write Protect is off
[   10.660072] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[   10.660178] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   10.669369] sd 1:0:0:0: [sdb] Preferred minimum I/O size 512 bytes
[   10.687483]  sdb: sdb1
[   10.690267] sd 1:0:0:0: [sdb] Attached SCSI disk
[   10.700140] usbcore: registered new interface driver usb-storage
[   10.707608] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[   10.717900] init: - preinit -
[   13.797063] random: crng init done
[   17.778961] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
[   19.844771] UBIFS (ubi0:2): Mounting in unauthenticated mode
[   19.881587] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 560
[   20.011777] UBIFS (ubi0:2): UBIFS: mounted UBI device 0, volume 2, name "rootfs_data"
[   20.019656] UBIFS (ubi0:2): LEB size: 129024 bytes (126 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   20.029573] UBIFS (ubi0:2): FS size: 119218176 bytes (113 MiB, 924 LEBs), max 935 LEBs, journal size 5935104 bytes (5 MiB, 46 LEBs)
[   20.041382] UBIFS (ubi0:2): reserved for root: 4952683 bytes (4836 KiB)
[   20.048001] UBIFS (ubi0:2): media format: w5/r0 (latest is w5/r0), UUID D25C5BE5-40FB-4018-96FE-6627E1CBA82C, small LPT model
[   20.060749] mount_root: overlay filesystem has not been fully initialized yet
[   20.069111] mount_root: switching to ubifs overlay
[   20.473273] urandom-seed: Seed file not found (/etc/urandom.seed)
[   20.581736] procd: - early -
[   20.586017] procd: - watchdog -
[   21.248621] procd: - watchdog -
[   21.252205] procd: - ubus -
[   21.347485] procd: - init -
[   22.762638] kmodloader: loading kernel modules from /etc/modules.d/*
[   22.880797] tun: Universal TUN/TAP device driver, 1.6
[   22.901022] NET: Registered PF_APPLETALK protocol family
[   22.939103] hwmon hwmon0: temp1_input not attached to any thermal zone
[   22.959957] hwmon hwmon1: temp1_input not attached to any thermal zone
[   22.979893] gpio-fan gpio_fan: GPIO fan initialized
[   23.220580] PPP generic driver version 2.4.2
[   23.240028] NET: Registered PF_PPPOX protocol family
[   23.278072] kmodloader: done loading kernel modules from /etc/modules.d/*
[   24.092345] urngd: v1.0.2 started.
[   34.856645] br-lan: port 1(eth0) entered blocking state
[   34.861965] br-lan: port 1(eth0) entered disabled state
[   34.867263] mv643xx_eth_port mv643xx_eth_port.0 eth0: entered allmulticast mode
[   34.874875] mv643xx_eth_port mv643xx_eth_port.0 eth0: entered promiscuous mode
[   37.158150] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control enabled
[   37.168070] br-lan: port 1(eth0) entered blocking state
[   37.173301] br-lan: port 1(eth0) entered forwarding state
Adventures in flashing

OpenWrt can be installed without disassembly by using a patched version of Alt-F. Details on a post later on this thread or on GitHub repo. Install v25.10.5-r1 and then sysupgrade to any other (newer or older).

The safest approach to install is to disassemble the unit. The original u-boot does not support UBI, and a common issue with these devices especially at this age is NAND bad blocks. UBI was therefore a must. If the bootloader was being replaced, so was the old partitioning scheme. Installing this means saying goodbye to stock firmware or Alt-F forever.

As scary as flashing the bootloader sounds, these kirkwood devices are unbrickable. Full disassembly, a CP210x USB to UART Bridge (or similar), and a ext4 -formatted USB are required. Most pages on the net about flashing this device consider soldering header pins to the port... I didn't bother and just used a few pieces of a paper clip and masking tape to maintain pressure/contact. That was good enough. That is how easy going these devices are.


(I bought this second hand years ago. Whoever had it before added those heat sinks. Not sure if they help, but they don't come off easily, so I'm letting them be.)

As insurance and nice to have, but not mandatory, it helps to have a working kwboot application, which lets the device to boot from serial. This allows to test a u-boot without flashing it first (a truly unbrickable device). Most linux distributions have one, and precompiled versions are available online for Windows.
In best of theories, with kwboot and u-boot plus the uImage it is possible to completely boot from USB without flashing anything. That requires some u-boot environment magic that I couldn't figure out. I already flashed so it's not valuable to me to go back to stock to document that. If someone figures that out please share.

Installation

UPDATE: Installation without disassembly (carries a risk of bricking the device if anything goes wrong, requiring disassembly to unbrick) here: Post Below . This is the preferred installation method if running Alt-F or stock.

UPDATE: u-boot has now an option to flash environment or OpenWrt image from USB. Details here: Post below . This is the preferred recovery mechanism if u-boot was successfully flashed but env/ubi flash failed, before going for the screwdriver.

Safest approach is to disassemble. These are very succinct instructions with dissassembly, more details were shared on a later post.

  • Copy u-boot.kwb and openwrt-25.12.0-kirkwood-generic-dlink_dns320-squashfs-factory.bin to a ext4 USB drive (rename the latter to factory.bin to make life easier.
  • Connect USB drive and TTL to the board. Run a terminal on the computer (minicom worked great for me)
  • Power up or reboot the board and interrupt the boot by hitting [space] and '1'. Should give a u-boot prompt.
  • Load u-boot.kwb to memory and erase/write it to address 0x0, which is the start of NAND and where the bootloader lives. Unless you make a backup of NAND first, you will have no way back to stock firmware or ALT-F. Do a reset to restart the board with the new u-boot.
    Important: After every ext4load command validate the load was successful before proceeding. A message like 590156 bytes read in 45 ms (12.5 MiB/s) must be returned. If not, unplug/replug the USB and try again, and if not successful try with a different USB drive. The chipset is picky when it comes to USB drives, and some USB drives out there are very low quality.
    Something like:
usb reset ; ext4load usb 0:1 0x1000000 /u-boot.kwb

NOTE: device must respond with "590156 bytes read in 45 ms (12.5 MiB/s)" - where bytes read matches u-boot.kwb file size. Follow wih:

nand erase 0x0 0x0e0000
nand write 0x1000000 0x0 0x0e0000
reset
  • Again, interrupt the boot. Load factory.bin to RAM (again... command must respond with bytes read in nnn ms (xx.y MiB/s)). Then erase.part ubi (goodbye stock firmware, including mini-firmware, whatever you were) and write to address 0x100000. As per @Holig further down on this thread:
usb reset ; ext4load usb 0:1 0x1000000 /factory.bin
nand erase.part ubi
nand write 0x1000000 ubi 0xa80000

(no reset yet - set MAC address as per next point before)

  • add the MAC address of the adapter to the environment with setenv ethaddr 'FC:75:16:xx:xx:xx' (get it in advance from current firmware or from sticker on bottom) and persist with saveenv.
  • reset, cross fingers and enjoy the show.

After flash is done further upgrades are handled with sysupgrade or the LuCI UI. Already tested ksmbd and netatalk and they both work. snmpd runs fine, and so does collectd. Everything installs via opkg or LuCI. 127MB UBI partition provides tons of free space.

Recovery in case of issues or u-boot bricking
Refer to:

Thanks @Freeflod

Acknowledgements & reference:

1 Like

Benchmarks...

Peak throughput of 22 MB/s reached on GBE Ethernet and ksmb for lage files (sustained transfer)

No difference was noted between a SSD and HDD. CPU usage…

Using SSD:

Using HDD (first transfer with client on WiFi, second with client on GBE):

Funny thing… if client is on WiFi interrupts go 4x (6000/s with client on WiFi vs 1500 with client on GBE):

And interrupts go over the roof because packets go 4x:

So clearly there is something iffy with MTU or so between my WiFi and my GBE… but don’t blame that on the build. 0.22 gigabit sustained write speed is not awesome but matches stock (thanks alsg).

A 450GB Time Machine backup through WiFi to AFP takes about 15h. That's averages to 30GB/h or 8.3MB/s. Looks like 10MB/s sustained (that's the Fast Ethernet limit, more below). Not stellar, but it is reliable so ends up working fine.

The LAN segment where I can test has a fast Ethernet bottleneck (100 Mbit Ethernet) between the NAS and the access points, which I'm sure does not help. NAS is using a ATA-8 7200 RPM disk.

Further testing on a 1GBE network showed data transfer speed with client over WiFi spiking over 100Mbit to maybe 120Mbit but backup time ended up being similar. CPU and IO limits are not far behind my slow LAN segment.

Time Machine backups to Samba see a little bit less throughput and take maybe an hour longer. (Go AFP go!)

Clearly something is messed up with my LAN/WiFi… but that has nothing to do with this build or the NAS.

I'm confused as to why the transfer speed on gigabits local network is slower than the stock or Alt-F firmware?

Can I request for a more detail installation guide for flashing to Openwrt and reverting back to Alt-F firmware. Thank you.

and

That's the same with the DNS-320L.

Thank you for posting... reminds me to update the build to the latest version... will look into it as soon as I get a break.

I was waiting for a nice USB-serial adapter to embed into the NAS but it never arrived, even after ordering it twice (now thrice… third time lucky… letś see).

As to your question... I don't have stats from stock. Can't remember if I ever had this thing on stock or if I got it already on Alt-F. I have vague recollections of hating the stock UI so maybe.

The NAS has a GBE port, but the CPU/RAM are skimpy. A speed daemon this thing never was. It can saturate Fast Ethernet (100MBE) so maybe that's why it ended up with gigabit, but there's no way it reaches anywhere near gigabit throughput.

Maybe with the old Windows file sharing service, using now deprecated and unsafe encryption, there was some level of hardware support for those simple cyphers, and that pushed throughput higher.

Not the greatest how-to, but between reference links and the section with installation steps above it should be relatively easy to flash. Not sure I can make it clearer unless I go full FixIt quality on this and that's much more effort than what I can give to this now. Happy to answer questions, though.

Thank you for the quick reply.

Regarding the transfer speed, this NAS is capable of reaching around 21MB/s running on stock or Alt-F firmware in a gigabits LAN setup. I was wondering if the Flow Offloading under Firewall in Openwrt might be the cause, did you enable this settings? Without this settings enabled on my router, I can only reach 1/3 of a gigabits speed.

As for the How-to, I didn't goes through all the links provided. Seem like ggirou have done quite a detail write-up especially on the steps to follow after flashing. Now I need to know how to backup the current firmware (Alt-F) before attempting to flash.

Again, appreciated all your effort in keeping this NAS alive. Also looking forward to newer build in the near future. Cheer and have a good day.

Up until my latest testing I never saw sustained 21MB/s with this guy. Yes, it does that, with large files (sustained transfers), on GBE. For small files throughput is much, much slower.

Flow Offloading AFAIK is a Firewall feature when flows are being tracked through NAT. With a single Ethernet port, there is no point to load the Firewall at all; there is no NAT, and no routing. I have the service disabled, along with dhcpd and dnsmasq.

Backing up the firmware to allow flashing back stock is relatively easy and safe if using Alt-F. Just 'dd' the full contents of the flash to a file and save it somewhere safe. If using stock, tearing it apart and using u-boot works.

In order to flash OpenWrt full disassembly is required and a Serial-USB converter has to be soldered (or rigged as I did), Once a serial connection is in place and the boot can be stopped by typing [enter} and '1' the flash can be re-written from a file on USB through u-boot commands (ggirou's site has details on this - I admit I'm being lazy and not copying/reformatting here), making the trip back to Alt-F & stock possible.

I'll try refresh/build/flash my system this coming week.

v24.10.2-r1 posted to GitHub.

@alsg You were right. 22 MBps throughput possible while on wired Ethernet all the way. Tested with a spindle disk and a SSD; no major differences noticed. Will update 1st post with new collectd images.

Throughput is noticeably slower if the client is on WiFi. Noted, WiFi is half duplex and adds latency, but client is on 11ax WiFi so shouldn’t be that bad. Looking at packet count… while on WiFi it is much higher… which makes me think WiFi is fragmenting packets. More packets results in much higher interrupts on the NAS, and much lower throughput. This might be an issue with my network and MTU sizes in LAN and WiFi; it should have nothing to do with the images published and how the NAS behaves, but now I have a reason to look at his on my network.

Build may have an issue with SSDs… it did not detect my uber-cheap SSD on bay 1 (left side if looking at side where power button is located), but did so when a normal HDD was there and the SSD was on bay 2 (right side). May be an issue with u-boot config bits… that’s a bit above my pay grade but now that I know it may be an issue, I’ll read about it to see if it can be addressed. Methinks it’s due to u-boot not understanding how to deal with the SSD, but the kernel does (u-boot starts 1 disk, the kernel starts the second one, supposedly to be nice to the power supply). Maybe u-boot should be configured to leave the SATA adapter alone and leave it to the kernel to deal with it.

Regardless… testing with SSD vs HDD didn’t show much of a difference… and a (cheapo) SSD on a NAS for backups might not be the greatest idea ever. I’ll probably get a 8TB HDD instead.

Anyways, 24.10.2-r1 release posted. Tested, works great.

Cheers!

Finally got the UST-TTL module. This:

I was too lazy to get the drill out or borrow a dremel so ended up with a few scratches on the case. Now I have a USB console port.

It works great!

With a bit of time and luck I’ll get to document a howto for flashing from stock, via Alt-F.

Hello,
thank you very much for this build! It's really something I wanted!

Unfortunatly I'm kind of stuck in the part:

Load factory.bin to RAM. erase.part ubi

I got the new u-boot, nand done

mtdparts: mtdparts=orion_nand:0x0e0000@0x0(uboot),0x20000@0x0e0000(ubootenv),0x7f00000@0x100000(ubi)

but after ubi write I can't go futher:

=> ubifsmount ubi:rootfs
UBIFS error (ubi0:0 pid 0): ubifs_read_node: bad node type (0 but expected 6)
UBIFS error (ubi0:0 pid 0): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 1
Not a node, first 24 bytes:Error reading superblock on volume 'ubi:rootfs' errno=-22!
ubifsmount - mount UBIFS volume

I'm using latest v24.10.2-r1 and also tested previous one.

Could you give me a little help?

Looks like you got the new u-boot in place and booted from it. That’s great. Please confirm it booted from it and not through kwboot.

Can you dump the u-boot environment? printenv will do. What does it look like? I have to clean it up a bit…

What were the write commands you used to write the factory.bin image? Can you double-check it’s the factory one and not the sysupgrade one?

I acknowledge my instructions above are not great. There’s no need to create a UBI partition as it states on ggirou’s pages because the factory image is a UBI partition image. Should be something like (assuming you have the factory.bin in USB and mtdparts as you have them listed)…

usb reset ; ext4load usb 0:1 0x1000000 /factory.bin
nand erase 0x100000 0xa80000
nand write 0x1000000 0x100000 0xa80000
reset

Note, u-boot should be smart enough to know what the ubi partition is… this is an option

usb reset ; ext4load usb 0:1 0x1000000 /factory.bin
nand erase.part ubi
nand write 0x1000000 ubi 0xa80000
reset

but I’m not sure it works, and it erases much more than what needs to be written. Something to try though if the first more conservative erase doesn’t work.

With all that said, and if that all fails…

It’s the same u-boot for 24.10.0 and 24.10.2… so… even though I’m using 24.10.2, I got there through an upgrade from within OpenWrt. Both 24.10.0 and 24.10.2 files seem to have an UBI header.

me@here:~/Downloads$ dd if=openwrt-24.10.0-kirkwood-generic-dlink_dns320-squashfs-factory.bin bs=512 count=1 | od -c
1+0 records in
1+0 records out
512 bytes copied, 2.1283e-05 s, 24.1 MB/s
0000000   U   B   I   # 001  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020  \0  \0 002  \0  \0  \0  \b  \0   g 241   L 261  \0  \0  \0  \0
0000040  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000060  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0   ~ 212 247   7
0000100 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
*
0001000

me@here:~/Downloads$ dd if=openwrt-24.10.2-kirkwood-generic-dlink_dns320-squashfs-factory.bin bs=512 count=1 | od -c
1+0 records in
1+0 records out
512 bytes copied, 2.8768e-05 s, 17.8 MB/s
0000000   U   B   I   # 001  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020  \0  \0 002  \0  \0  \0  \b  \0   h   Y 273 304  \0  \0  \0  \0
0000040  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000060  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 302 236 204 016
0000100 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
*
0001000

Can you do a quick check on your factory.bin file to ensure it has the “UBI” tag at start of file?

Maybe I did something superbly stupid on the last build… you could try using factory.bin 24.10.0 (do not reflash the u-boot… the one you have is fine, and the least writes the better for the flash).

Let me know how the write for factory.bin above goes, and we’ll take it from there.

Thanks for trying this!

Edit: I see you already tried 24.10.0… maybe it’s just the write piece.
Edit2: I had erase.part ubi on my writeup, so clearly it worked at some point. Both write sequences should work… try either please. I just checked file length and I think 0xa80000 is accurate, but please double check. I don’t know if u-boot is smart enough to figure out how large the file is.

Thank you for your reply.
Yes, I'm booted from new u-boot from nand. (I did not use kwboot at all)

I'll post printenv tonight (France timezone)

Command I used for flashing:

nand erase.part root
ubi part root
ubi create rootfs
usb reset ; ext4load usb 0:1 0x1000000 /factory.bin
ubi write 0x1000000 rootfs 0xa80000
ubifsmount ubi:rootfs

I got the above mentioned error with last command line

Yes, I checked file header (both version also) and have the UBI header, file size is also correct.

With nand write I got an error (don't remember exactly what but 0 byte written)
Maybe it's due the ubi being mounted.
I'll test without any ubi command.

I'll post update later.

Don’t use those commands. That is the issue.

Use the snippet I sent to write the image. Either version.

U-boot complained because those commands refer to partitions that don’t exist. There is no root partition on the new layout (only ubi). The image to write is a ubi snapshot so no need to create a rootfs partition. And no need or reason to do ubifsmount. Just reset (to restart).

I got it working ! :partying_face:

I had a few thing messed up.

I've reflashed (latest version) with this code

usb reset ; ext4load usb 0:1 0x1000000 /factory.bin
nand erase.part ubi
nand write 0x1000000 ubi 0xa80000
reset

With nand write 0x1000000 0x100000 0xa80000 it always end up failing to write on same block even after declaring it as bad (7 bad blocks now :face_with_peeking_eye:)

Then kernel booting ! But I faced Kernel panic

Kernel panic
[    1.864316] UBI error: cannot open mtd rootfs, error -2
[    1.869917] clk: Disabling unused clocks
[    1.874302] ubi0:rootfs: Can't lookup blockdev
[    1.878790] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,253): error -2
[    1.886870] Please append a correct "root=" boot option; here are the available partitions:
[    1.895194] 1f00             896 mtdblock0 
[    1.895207]  (driver?)
[    1.901738] 1f01             128 mtdblock1 
[    1.901750]  (driver?)
[    1.908277] 1f02          130048 mtdblock2 
[    1.908289]  (driver?)
[    1.914796] List of all bdev filesystems:
[    1.918800]  squashfs
[    1.918808] 
[    1.922548] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,253)

After poking arround I guess I cant shorten to: I should not use ggirou setenv setbootargs [...]
I've put the same as you have Kernel command line as on you dmesg

Below the info/result:
printenv is probably with too much variables

printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200 mtdparts=orion_nand:0x0e0000@0x0(uboot),0x20000@0x0e0000(ubootenv),0x7f00000@0x100000(ubi) cmdlinepart.mtdparts=orion_nand:0x0e0000@0x0(uboot),0x20000@0x0e0000(ubootenv),0x7f00000@0x100000(ubi) root=ubi0:rootfs ubi.mtd=rootfs rootfstype=ubifs
bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw
bootcmd=if test -n ${bootenv} && usb start; then if run loadbootenv; then echo Loaded environment ${bootenv} from usb;run importbootenv;fi;if test -n ${bootenvcmd}; then echo Running bootenvcmd ...;run bootenvcmd;fi;run setnandbootenv subbootcmd;fi;ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootdelay=3
bootenv=uEnv.txt
bootenvloadimage=nand read ${loadaddr} kernel
bootenvroot=ubi0:rootfs ubi.mtd=rootfs
bootenvrootfstype=ubifs
console=ttyS0,115200
ethact=egiga0
ethaddr=00:50:43:00:02:02
fdtcontroladdr=7b3dda8
fileaddr=1000000
filesize=a80000
importbootenv=echo Importing environment ...; env import -t ${loadaddr} ${filesize}
loadaddr=0x800000
loadbootenv=fatload usb 0 ${loadaddr} ${bootenv}
mtddevname=uboot
mtddevnum=0
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x0e0000@0x0(uboot),0x20000@0x0e0000(ubootenv),0x7f00000@0x100000(ubi)
nand_erasesize=20000
nand_oobsize=40
nand_writesize=800
nandloadimage=nand read ${loadaddr} kernel
nandroot=ubi0:rootfs ubi.mtd=rootfs
nandrootfstype=ubifs
partition=nand0,0
root_flash=ubi.mtd=root root=ubi0:rootfs rootfstype=ubifs
setbootargs=setenv bootargs console=ttyS0,115200 :::DB88FXX81:egiga0:none
setnandbootenv=echo Booting from nand ...; setenv bootenvroot ${nandroot}; setenv bootenvrootfstype ${nandrootfstype}; setenv bootenvloadimage ${nandloadimage}
stderr=serial
stdin=serial
stdout=serial
subbootcmd=run setbootargs; if run bootenvloadimage; then bootm ${loadaddr};fi;

Environment size: 1813/131068 bytes
Full boot log

U-Boot 2020.04 (Jun 23 2025 - 20:40:36 +0000)
D-Link DNS-320

SoC:   Kirkwood 88F6281_A1
DRAM:  128 MiB
NAND:  128 MiB
Loading Environment from NAND... OK
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
Hit any key to stop autoboot:  3  2  1  0 
starting USB...
Bus ehci@50000: USB EHCI 1.00
scanning bus ehci@50000 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Booting from nand ...

NAND read: incorrect device type in kernel
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0: attached mtd3 (name "ubi", size 127 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 2048
ubi0: good PEBs: 1009, bad PEBs: 7, corrupted PEBs: 0
ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 1738624177
ubi0: available PEBs: 0, total reserved PEBs: 1009, PEBs reserved for bad PEB handling: 13
No size specified -> Using max size (3225600)
Read 3225600 bytes from volume kernel to 00800000
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   ARM OpenWrt Linux-6.6.73
   Created:      2025-02-03  23:09:37 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3125003 Bytes = 3 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   Loading Kernel Image

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.6.73 (builder@buildhost) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 13.3.0 r28427-6df0e3d02a) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 Mon Feb  3 23:09:37 2025
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: D-Link DNS-320 NAS (Rev A1)
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Kernel command line: console=ttyS0,115200 :::DB88FXX81:egiga0:none
[    0.000000] Unknown kernel command line parameters ":::DB88FXX81:egiga0:none", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 118624K/131072K available (7193K kernel code, 593K rwdata, 1076K rodata, 1024K init, 235K bss, 12448K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11467562657 ns
[    0.000002] sched_clock: 32 bits at 167MHz, resolution 6ns, wraps every 12884901885ns
[    0.000056] Switching to timer-based delay loop, resolution 6ns
[    0.000263] Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=1666666)
[    0.000305] CPU: Testing write buffer coherency: ok
[    0.000459] pid_max: default: 32768 minimum: 301
[    0.015169] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.015217] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.029040] RCU Tasks Trace: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=1.
[    0.029435] Setting up static identity map for 0x100000 - 0x10003c
[    0.029930] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.039430] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.039489] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.043340] pinctrl core: initialized pinctrl subsystem
[    0.048703] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.049496] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.051698] thermal_sys: Registered thermal governor 'step_wise'
[    0.051773] cpuidle: using governor ladder
[    0.052374] Feroceon L2: Enabling L2
[    0.052422] Feroceon L2: Cache support initialised.
[    0.055867] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-temp-alarm
[    0.055896] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-fan-tacho
[    0.055920] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-present-sata1
[    0.055943] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-present-sata0
[    0.055965] /ocp@f1000000/pin-controller@10000: Fixed dependency cycle(s) with /ocp@f1000000/pin-controller@10000/pmx-power-back-on
[    0.061814] No ATAGs?
[    0.071393] SCSI subsystem initialized
[    0.072671] usbcore: registered new interface driver usbfs
[    0.072733] usbcore: registered new interface driver hub
[    0.072797] usbcore: registered new device driver usb
[    0.075423] clocksource: Switched to clocksource orion_clocksource
[    0.090627] NET: Registered PF_INET protocol family
[    0.090922] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.092851] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.092894] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.092918] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.092949] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.092995] TCP: Hash tables configured (established 1024 bind 1024)
[    0.093839] MPTCP token hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.094191] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.094230] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.095494] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.095564] PCI: CLS 0 bytes, default 32
[    0.101103] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.103384] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.103399] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.114033] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.117586] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.119932] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.120827] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.122036] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.127460] printk: console [ttyS0] disabled
[    0.127988] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 25, base_baud = 10416666) is a 16550A
[    0.128056] printk: console [ttyS0] enabled
[    0.648807] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 26, base_baud = 10416666) is a 16550A
[    0.659448] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[    0.665829] nand: Samsung NAND 128MiB 3,3V 8-bit
[    0.670431] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.678091] Scanning device for bad blocks
[    0.684373] Bad eraseblock 21 at 0x0000002a0000
[    0.694347] Bad eraseblock 75 at 0x000000960000
[    0.700661] Bad eraseblock 93 at 0x000000ba0000
[    0.723854] Bad eraseblock 277 at 0x0000022a0000
[    0.737271] Bad eraseblock 364 at 0x000002d80000
[    0.749256] Bad eraseblock 437 at 0x0000036a0000
[    0.756467] Bad eraseblock 463 at 0x0000039e0000
[    0.818143] 3 fixed-partitions partitions found on MTD device orion_nand
[    0.824828] Creating 3 MTD partitions on "orion_nand":
[    0.829974] 0x000000000000-0x0000000e0000 : "u-boot"
[    0.884675] 0x000000100000-0x000008000000 : "ubi"
[    0.892354] 0x0000000e0000-0x000000100000 : "env"
[    0.921663] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    1.686682] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:50:43:00:02:02
[    1.696406] rtc-mv f1010300.rtc: registered as rtc0
[    1.701309] rtc-mv f1010300.rtc: setting system clock to 2025-02-03T23:14:38 UTC (1738624478)
[    1.709969] i2c_dev: i2c /dev entries driver
[    1.715986] orion_wdt: Initial timeout 25 sec
[    1.737050] marvell-cesa f1030000.crypto: CESA device successfully registered
[    1.746876] NET: Registered PF_INET6 protocol family
[    1.755609] Segment Routing with IPv6
[    1.759373] In-situ OAM (IOAM) with IPv6
[    1.763493] NET: Registered PF_PACKET protocol family
[    1.768613] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    1.781929] 8021q: 802.1Q VLAN Support v1.8
[    1.854285] UBI: auto-attach mtd1
[    1.857691] ubi0: attaching mtd1
[    2.056840] ubi0: scanning is finished
[    2.077043] ubi0: attached mtd1 (name "ubi", size 127 MiB)
[    2.082538] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[    2.089438] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[    2.096133] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
[    2.102900] ubi0: good PEBs: 1009, bad PEBs: 7, corrupted PEBs: 0
[    2.108987] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
[    2.116201] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 1738624177
[    2.125303] ubi0: available PEBs: 0, total reserved PEBs: 1009, PEBs reserved for bad PEB handling: 13
[    2.135062] ubi0: background thread "ubi_bgt0d" started, PID 364
[    2.141814] block ubiblock0_1: created from ubi0:1(rootfs)
[    2.147322] ubiblock: device ubiblock0_1 (rootfs) set to be root filesystem
[    2.154569] clk: Disabling unused clocks
[    2.167654] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    2.179197] Freeing unused kernel image (initmem) memory: 1024K
[    2.185118] Run /sbin/init as init process
[    2.974088] init: Console is alive
[    2.977910] init: - watchdog -
[    3.933367] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.047953] gpio_button_hotplug: loading out-of-tree module taints kernel.
[    4.078737] orion-ehci f1050000.ehci: EHCI Host Controller
[    4.084270] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    4.092167] orion-ehci f1050000.ehci: irq 35, io mem 0xf1050000
[    4.125456] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    4.133051] hub 1-0:1.0: USB hub found
[    4.137453] hub 1-0:1.0: 1 port detected
[    4.162730] sata_mv f1080000.sata: slots 32 ports 2
[    4.175282] scsi host0: sata_mv
[    4.181586] scsi host1: sata_mv
[    4.185639] ata1: SATA max UDMA/133 irq 36
[    4.189739] ata2: SATA max UDMA/133 irq 36
[    4.425442] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    4.528363] ata1: SATA link down (SStatus 0 SControl F300)
[    4.856760] ata2: SATA link down (SStatus 0 SControl F300)
[    4.870544] usbcore: registered new interface driver usb-storage
[    4.882809] usbcore: registered new interface driver uas
[    4.892807] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.902995] init: - preinit -
[    5.149134] usb-storage 1-1:1.0: USB Mass Storage device detected
[    5.314796] scsi host2: usb-storage 1-1:1.0
[    6.347671] scsi 2:0:0:0: Direct-Access     Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6
[    6.406477] sd 2:0:0:0: [sda] 60604416 512-byte logical blocks: (31.0 GB/28.9 GiB)
[    6.417852] sd 2:0:0:0: [sda] Write Protect is off
[    6.433334] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    6.472497]  sda: sda1
[    6.475385] sd 2:0:0:0: [sda] Attached SCSI removable disk
[    7.595487] random: crng init done
Cannot parse config file '/etc/fw_env.config': No such file or directory
Failed to find NVMEM device
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   13.751594] mount_root: loading kmods from internal overlay
[   13.788272] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[   13.797970] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[   14.141272] block: attempting to load /tmp/overlay/upper/etc/config/fstab
[   14.148459] block: unable to load configuration (fstab: Entry not found)
[   14.155364] block: attempting to load /tmp/overlay/etc/config/fstab
[   14.161933] block: unable to load configuration (fstab: Entry not found)
[   14.168817] block: attempting to load /etc/config/fstab
[   14.176880] block: unable to load configuration (fstab: Entry not found)
[   14.183770] block: no usable configuration
[   14.195179] UBIFS (ubi0:2): Mounting in unauthenticated mode
[   14.232843] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 556
[   14.271828] UBIFS (ubi0:2): recovery needed
[   14.427270] UBIFS (ubi0:2): recovery completed
[   14.431861] UBIFS (ubi0:2): UBIFS: mounted UBI device 0, volume 2, name "rootfs_data"
[   14.439697] UBIFS (ubi0:2): LEB size: 129024 bytes (126 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   14.449596] UBIFS (ubi0:2): FS size: 115992576 bytes (110 MiB, 899 LEBs), max 910 LEBs, journal size 5806080 bytes (5 MiB, 45 LEBs)
[   14.461397] UBIFS (ubi0:2): reserved for root: 4952683 bytes (4836 KiB)
[   14.468010] UBIFS (ubi0:2): media format: w5/r0 (latest is w5/r0), UUID 21E9BE49-CF44-4371-94F2-A7F9DD3F7F64, small LPT model
[   14.483110] block: attempting to load /tmp/ubifs_cfg/upper/etc/config/fstab
[   14.493506] block: extroot: not configured
[   14.497860] UBIFS (ubi0:2): un-mount UBI device 0
[   14.502599] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" stops
[   14.516413] UBIFS (ubi0:2): Mounting in unauthenticated mode
[   14.553200] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 560
[   14.661973] UBIFS (ubi0:2): UBIFS: mounted UBI device 0, volume 2, name "rootfs_data"
[   14.669826] UBIFS (ubi0:2): LEB size: 129024 bytes (126 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   14.679722] UBIFS (ubi0:2): FS size: 115992576 bytes (110 MiB, 899 LEBs), max 910 LEBs, journal size 5806080 bytes (5 MiB, 45 LEBs)
[   14.691523] UBIFS (ubi0:2): reserved for root: 4952683 bytes (4836 KiB)
[   14.698131] UBIFS (ubi0:2): media format: w5/r0 (latest is w5/r0), UUID 21E9BE49-CF44-4371-94F2-A7F9DD3F7F64, small LPT model
[   14.861372] block: attempting to load /tmp/overlay/upper/etc/config/fstab
[   14.871396] block: extroot: not configured
[   14.881015] block: attempting to load /tmp/ubifs_cfg/upper/etc/config/fstab
[   14.888894] block: extroot: not configured
[   14.895073] mount_root: switching to ubifs overlay
[   14.910076] urandom-seed: Seeding with /etc/urandom.seed
[   15.030101] procd: - early -
[   15.033212] procd: - watchdog -
[   15.735819] procd: - watchdog -
[   15.805800] procd: - ubus -
[   15.997858] procd: - init -
Please press Enter to activate this console.
[   17.051869] urngd: jent-rng init failed, err: 11
[   17.682469] kmodloader: loading kernel modules from /etc/modules.d/*
[   18.281986] NET: Registered PF_APPLETALK protocol family
[   18.335709] gpio-fan gpio_fan: GPIO fan initialized
[   18.511594] PPP generic driver version 2.4.2
[   18.526954] NET: Registered PF_PPPOX protocol family
[   18.558528] kmodloader: done loading kernel modules from /etc/modules.d/*
[   22.764144] mtdblock: MTD device 'env' is NAND, please consider using UBI block devices instead.
[   22.802164] mtdblock: MTD device 'ubi' is NAND, please consider using UBI block devices instead.
[   22.889925] mtdblock: MTD device 'u-boot' is NAND, please consider using UBI block devices instead.
[   22.899625] ecc_sw_hamming_correct: uncorrectable ECC error
[   22.905203] I/O error, dev mtdblock0, sector 1664 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   22.915452] ecc_sw_hamming_correct: uncorrectable ECC error
[   22.921022] I/O error, dev mtdblock0, sector 1776 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   22.930807] ecc_sw_hamming_correct: uncorrectable ECC error
[   22.936409] I/O error, dev mtdblock0, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   22.957628] ecc_sw_hamming_correct: uncorrectable ECC error
[   22.963225] I/O error, dev mtdblock0, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   31.667165] br-lan: port 1(eth0) entered blocking state
[   31.672422] br-lan: port 1(eth0) entered disabled state
[   31.677735] mv643xx_eth_port mv643xx_eth_port.0 eth0: entered allmulticast mode
[   31.685363] mv643xx_eth_port mv643xx_eth_port.0 eth0: entered promiscuous mode



BusyBox v1.36.1 (2025-02-03 23:09:37 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 24.10.0, r28427-6df0e3d02a
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# 

Let's play now with this new/old baby ! :robot:
Thank you again for your work

1 Like

I need to clean up the uboot env.

I have a much shorter version booting, but I didn’t get to update the repo with it.

I’ll post it here later for you, and rebuild when I have time with a cleaner version.

Thank you very much for trying this image out. What you did helps flush out issues and bugs.

Enjoy!

Edit: now I see it in your boot log… yeah, 7 bad blocks. That’s unfortunate. I’m lucky in that I don’t have any (yet). UBI will help by in theory spreading the updates better, hopefully getting a lot more life out of the device.

Here is my uboot env:

=> printenv
baudrate=115200
bootargs=console=ttyS0,115200 :::DB88FXX81:egiga0:none
bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw
bootcmd=ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootdelay=3
console=console=ttyS0,115200
ethact=egiga0
ethaddr=fc:75:16:02:75:de
ethprime=egiga0
fdtcontroladdr=7b3dda8
mtddevname=uboot
mtddevnum=0
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x0e0000@0x0(uboot),0x20000@0x0e0000(ubootenv),0x7f00000@0x100000(ubi)
partition=nand0,0
stderr=serial
stdin=serial
stdout=serial

Environment size: 528/131068 bytes

That is all that is needed (in theory you should adjust with your own MAC). I will clean up the mess that the build has.

For what it is worth, that mess is there from trying to adopt ggigou’s or lentini’s boot from USB, which would be a nice to have for recovery purposes. I’m not too good at u-boot config, so I tried it but it didn’t work. I thought I had cleaned it but obviously didn’t. Next release should have that in.

I suggest that next time you’re booting you clean your environment to match. It has been working great for me for a while. If you are good with u-boot config and can get the USB boot working, please share and I’ll happily include that in the repo.

Indeed, much more cleaner env.
I have no idea how I end up with autoload=no in mine! :face_with_spiral_eyes:
I was going crazy, because was not booting alone. When I connect and see it's stuck in u-boot I just enter reset and it was booting normally.
FYI: After removing autoload it seems it need 2 power cycles to correctly boot.

An other interesting bit, I wanted to see/edit env from linux/busybox.
For fw_printenv to work you need to create config /etc/fw_env.config

fw_env.config
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 000e0000 00020000 "u-boot"
mtd1: 07f00000 00020000 "ubi"
mtd2: 00020000 00020000 "env"
# cat /etc/fw_env.config
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mtd2               0x0000          0x20000         0x10000

Unfortunatly fw_setenv doesn't work for me.

# fw_setenv bootenv
MTD erase error on /dev/mtd2: Invalid argument
Error: can't write fw_env to flash

I did not search too long. It may be related to my bad env/configuration.

Other than that, this old boy is working good !
Next, I'll try to see if I can get back/rebuild my RAID 1 from ofw.

Ah, yes… another thing I didn’t get to do.

I have the /etc/fw_env.config. It works. Didn’t manage to add it to the build… maybe for next round.

Here it is:

# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is ignored on NOR.

# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd2		0x00000		0x20000		0x20000

You were on the right track, but sector size is 0x20000, not 0x10000.

Just be mindful of write cycles on that sector. If it were to go bad a workaround would be to move it elsewhere with a custom build. Originally the environment device was much larger… 16 sectors maybe. I got skimpy and left it to one sector which I stole off the u-boot device. IMO u-boot and environment is not something you want to be touching frequently. Environment could be mapped elsewhere… as for u-boot, if sector 0 goes bad, then the device is dead.

RAID… mdadm is included in the image with the required module. I’ve never used it. A service file exists in /etc/init.d, and a config in /etc/config. Any mdadm tutorial for linux should apply.

When I build I get a plethora of modules beyond what I included in the image. These are in packages.zip in the release, in case you are missing anything. Or… feel free to rebuild from the repo.

Now that you’ve tried it and ironed some kinks, I am getting the itch to make a PR to add the device to the mainline… it’s a ton of work and I’m sure I did a few nonstandard things that would need to be changed, but now at least we have two users. Hopefully alsg will jump in too.

It’s risky, but a procedure to flash without having to tear apart would make it a lot easier for anyone having one of these to install OpenWrt… that’s what I’d rather put time into.

I'm poking at 24.10.3 to update the build for this thing... and this file will take some effort. Maybe.
Turns out it is automagically generated by the uboot-envtools package, provided the config for the box exists in package/boot/uboot-envtools/files/kirkwood, which of course doesn't. And since I moved the uboot environment up, it will take more than one line to patch that. Not complicated, but not something I'd like to do now.

So file is there, above, and can be manually created to deal w/the uboot env, for the time being.


v24.10.3-r1 release posted to GitHub!

Any progress in D-Link DNS-320 support?

Recently, the support of D-Link DNS-325 has been done:

D-Link DNS-320L is already supported too:

Recent Linux on the D-Link DNS-313 (Last boot 2025-06-03 on kernel v6.12.31 with OpenWRT as rootfs):

Note: There are other D-Link DNS too:

DNS-327L too, here for Debian (badly no specs page on https://wikidevi.wi-cat.ru/ + https://techinfodepot.shoutwiki.com/), it can be added with informations from here:

DNS-321 (badly no specs page on https://wikidevi.wi-cat.ru/ + https://techinfodepot.shoutwiki.com/), it can be added with informations from here:

DNS-323 (Debian support exists):

DNS-343 (badly no specs page on https://wikidevi.wi-cat.ru/ + https://techinfodepot.shoutwiki.com/), it can be added with informations from here:

D-Link NAS models:

  • DNS-313
  • DNS-315
  • DNS-320
  • DNS-320L
  • DNS-320LW
  • DNS-321
  • DNS-323
  • DNS-325
  • DNS-327L
  • DNS-340L
  • DNS-343
  • DNS-345