⬆️ ⬇️

We continue to put OpenWrt on anything. D-link DNS-320L

I purchased this NAS for a clear purpose, it should work on OpenWRT. I myself am not strong in linux, so I collected information bit by bit from the Internet. Nothing was found in the Russian-language part, so I decided to write an instruction for the people + to save something, since I don’t trust my memory.



The result was a NAS, which loads the firmware from the internal memory and mounts the hard drive connected via usb, as the main memory.



A man named Andreas Böhler wrote a patch for openwrt revision 39746 to be able to compile the firmware. The following actions are performed in the Debian OS under VirtualBox.



Install packages for compilation:

sudo apt-get install subversion git g ++ libncurses5-dev zlib1g-dev gawk


Download the firmware sources:

svn co -r 39746 svn: //svn.openwrt.org/openwrt/trunk dns320l


Apply patches:

cd dns320l

wget www.aboehler.at/hg/linux-dns320l/raw-rev/223820522d49 -O patch.diff

patch -p0 <./patch.diff

patch -p0 -ib / openwrt / openwrt-dns320l.patch


')

Well, compile the firmware.

Check installed components:

make prereq


If such a window appears, select the Marwell Kirkwood line in the Target System and the D-Link DNS320L line in the Target Profile:







If this does not happen, and there are no errors, you need to do:

make menuconfig


Actually, this is enough for a clean initial working firmware. If desired, you can run around the menu and install the necessary packages. I installed Base System -> block-mount and Kernel Modules -> FileSystem -> kmod-fs-ext4 , since I plan to transfer the root directory to the hard disk. I used external USB hard, but you could just as well use sata hard or a USB flash drive.



Run the compilation:

make


If you have a multi-core computer, then:

make –j5


where 5 is the number of cores +1



Let's leave the compilation, this is a slow matter. Next you need to connect to the NAS console. To do this, there are 4 pins on the ward, are located near usb and network, I soldered the sticks to them for easy connection, I use this adapter, you can use any adapter on PL2303, for example, a cable from Siemens dca-510:







The pins on the DNS320L board are (from jamie.lentin.co.uk/devices/dlink-dns325 ):







The pins of the board must be connected to the corresponding pins of the USB-TTL adapter. If it does not work, then swap the RX and TX, you do not need to connect 3.3v! I connected and burned 2 adapters.







After connecting, open Putty and set the connection port (the port can be viewed in the Device Manager -> COM and LPT Ports) speed 115200.







In the category of serial Data bits - 8, Flow Control - None.







We click Open - the empty console opens. We connect the NAS power supply and press the power button, the download has gone, we are waiting for the inscription: If you want to stop it, then press the key

Quickly press "Space", then "1". We get the input line:

Marvell>

(Sorry, forgot to make screenshots)

Next, run the tftp server.

To do this, download tftpd32.jounin.net/download/tftpd32.450.zip

We unpack and drop the openwrt-kirkwood-dns320l-jffs2-nand-2048-128k.img and openwrt-kirkwood-uImage compiled firmware files into the same folder. We connect the NAS to the Patch-cord computer, give the ip address of the computer 2.66.66.32, and run tftp32:







In the putty write (information on the site http://www.aboehler.at/cms/projects-a-hacks/50-dns320l with errors)



setenv bootargs_openwrt 'console=ttyS0,115200 earlyprintk root=/dev/mtdblock2 rootfstype=jffs2' setenv bootcmd_openwrt 'setenv bootargs $(bootargs_openwrt); nand read.e 0xa00000 0x100000 0x400000; bootm 0xa00000' setenv to_openwrt 'setenv mainlineLinux yes; setenv bootcmd \'run bootcmd_openwrt\'; saveenv; reset' tftp 0x6400000 openwrt-kirkwood-uImage nand erase 0x100000 0x400000 nand write.e 0x6400000 0x100000 0x400000 tftp 0x6400000 openwrt-kirkwood-dns320l-jffs2-nand-2048-128k.img nand erase 0x500000 0xfb00000 nand write.e 0x6400000 0x500000 0x200000 run to_openwrt 


After that, the NAS restarts and OpenWRT starts.

We will examine in more detail
 setenv bootargs_openwrt 'console=ttyS0,115200 earlyprintk root=/dev/mtdblock2 rootfstype=jffs2'  -   ,  /   jffs2 setenv bootcmd_openwrt 'setenv bootargs $(bootargs_openwrt); nand read.e 0xa00000 0x100000 0x400000; bootm 0xa00000'   -   nand  0x100000  0x400000  RAM   0xa00000 ,     0xa00000 tftpboot 0x6400000 openwrt-kirkwood-uImage   tftp   openwrt-kirkwood-uImage  ram   0x6400000 nand erase 0x100000 0x400000  nand   uImage nand write.e 0x6400000 0x100000 0x400000   0x6400000 ram  0x100000 nand  0x400000 tftpboot 0x6400000 openwrt-kirkwood-dns320l-jffs2-nand-2048-128k.img   tftp   openwrt-kirkwood-dns320l-jffs2-nand-2048-128k.img  ram   0x6400000 nand erase 0x500000 0xfb00000  nand   uImage nand write.e 0x6400000 0x500000 0x200000   0x6400000 ram  0x500000 nand  0x200000 run to_openwrt      OpenWRT 




After downloading OpenWRT, you need to change some files.

 vi /etc/opkg.conf -      : #src/gz barrier_breaker http://downloads.openwrt.org/snapshots/trunk/kirkwood/packages  : src/gz barrier_breaker http://downloads.openwrt.org/attitude_adjustment/12.09/kirkwood/generic/packages 


 vi /etc/config/network –  ,    dhcp config interface 'lan' option ifname 'eth0' option proto 'dhcp' option defaultroute '1' # option type 'bridge' # option proto 'static' # option ipaddr '192.168.1.1' # option netmask '255.255.255.0' # option ip6assign '60' 


Further:

passwd


Enter the root password:

reboot


And after the download starts, openwrt will get an ip address over the network, you can connect via ssh.



Next, hard, which will be / formatted in ext4, unzip it openwrt-kirkwood-dns320l-rootfs.tar in NAS

opkg install kmod-usb-uhci kmod-usb-storage block-mount kmod-fs-ext4

installs the necessary packages for transfer to usb

vi / etc / config / fstab



config mount

option target / overlay

option device / dev / sda1

option fstype ext4

option options rw, sync

option enabled 1

option enabled_fsck 0



sda1 change to a disk partition on which there will be / and you unpacked the archive.



After rebooting, if everything is done correctly, we get OpenWRT with the root on the disk.

Only 2 half problems left:

1. the cooler does not spin, I decided to connect it to the power supply bypassing the board;

2. discs do not park, temporary solution - UPS from sudden loss of light



The files with the firmware that I used are on Yandex.Disk .

UPD1: A bit changed the kernel settings, now the available memory is 118 MB Yandex.Disk bigroot , you need to re-flash the kernel and jffs.



UPD2: I can’t compare the speed (now there are other screws, and there is no possibility of returning), who can dump the official backup / backup ?, make a comparison of the official one, alt-f and openwrt 12 and 14, Write in a personal ;-)



PS If you see an error, do not hesitate to write in a personal, I will correct as soon as I can.

Source: https://habr.com/ru/post/244921/



All Articles