DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-03-27 12:59:56

chris_cs
Member
Registered: 2011-03-27
Posts: 6

Building a custom ROM

Hi,

I have just added a section to the wiki about a development kit that is offered by dlink which allows you to build your own firmware-packs (See http://dns323.kood.org/dns-320). I also found the U-Boot parameters via looking at the uboot binary yesterday.

Any firmware hackers out there ? smile

I'd love to see my DNS-320 boot a (non chroot) debian!

take care
chris

I have started to reconstruct the build script, I have not much experience as a linux hacker, so ANY help is welcome!

this is work in progress:

History
- added missing directories
- compile linux kernel  2.6.22-18 (doesn't get added to the resulting flashable image yet)

build_fw

Code:

cd ..
ln -s dns320_GPL DNS320
cd DNS320
mkdir Image
mkdir -p module/crfs/crfs/driver

tar zxvf arm-none-linux-gnueabi-6xxx.tgz

WORKDIR=$(pwd)
export WORKDIR
PATH=${WORKDIR}/arm-none-linux-gnueabi-6xxx/bin:$PATH
export PATH
CC=arm-none-linux-gnueabi-gcc
export CC
export CROSS_COMPILE=arm-none-linux-gnueabi-
CXX=${CROSS_COMPILE}g++
export CXX
RANLIB=arm-none-linux-gnueabi-ranlib
export RANLIB
LD=arm-none-linux-gnueabi-ld
export LD
STRIP=arm-none-linux-gnueabi-strip
export STRIP

# build kernel
tar zxvf linux-2.6.22.18.tgz
cd linux-2.6.22.18
./cv.sh
make
./cpuImage
./cpmodules
cd ..

tar zxvf ramdisk.tgz
tar zxvf merge.tgz
cd merge
sudo cp ../ramdisk/uRamdisk .
./merge

Last edited by chris_cs (2011-03-28 01:48:29)

Offline

 

#2 2011-03-30 12:52:38

stefanth
Member
Registered: 2010-12-14
Posts: 63

Re: Building a custom ROM

Hi

Sounds interesting, I have to look into this

I would like to see the following modified dns-320 boot loader

Standard or very small kernel

No busybox

No uClibc but instead GLibc

including at leas the following "extra" commands: ssh, tar, gzip

Only one communication skill, either a ftp server or wget

Standard tool chain.

The only web ui that the "kernel" supports is a log in page and the ability to reformat disk(s), like RAID 1.
But this might be an overdue if it possible to make the same thing at command prompt.

If the kernel detects a disk(s) then it will mount the disk as / (and not as /mnt/HD/HD_a2/) and sets up the
/bin, /lib /include etc. as before (in the case they already exists on the disk it is not even needed to copy them.

If the disk(s) have crashed or can not be mounted then the kernel do as before, that is, creating / in ram instead
with it's original set-up so it is possible to log on using ssh.

The "kernel" should not include samba, ajaxplorer, user handling via WEB, DLNA server etc. etc. as it does today.

By having it like this, the system will behave as a normal clean coherent GNU/Linux system and no need for /ffp/ links and it is possible
to install all the software needed without re target it /ffp/lib/include/bin,

There will be no size restrictions (due to RAM size) in the /lib /bin /include directories

It is still possible reformat the drives or set up disk(s) as RAID 1 even if the drivers are new or crashed.

No duplicates of kernels or libc running at the same time

It will be possible to login via ssh and execute download/installation scripts or manually install via wget/ftp


/Stefan

Offline

 

#3 2011-03-30 19:45:56

Dlink
Member
Registered: 2007-11-21
Posts: 106

Re: Building a custom ROM

DNS-320 and DNS-325 do not use uClibc anymore. They are using Glibc.

Offline

 

#4 2011-03-30 20:56:18

mangus
Member
From: Bologna , Italy
Registered: 2011-01-29
Posts: 22

Re: Building a custom ROM

interesting....I'm rebuilding the kernel for fun now , one thing come to my mind looking at the config.. the Inotify support seems present but doesn't work as I tried it with minidlna but maybe I need to look at it again  .. this should be a good starting point
http://curvedbrain.org/2008/06/09/build … k-dns-323/
I'm afraid...this kind of thing may brick the device very easily without some kind of fallback...

edit: minidlna is working with inotify support big_smile I remembered that it wasn't some time ago, maybe the firmware upgrade changed this?

Last edited by mangus (2011-03-31 00:21:29)

Offline

 

#5 2011-03-31 10:30:05

chris_cs
Member
Registered: 2011-03-27
Posts: 6

Re: Building a custom ROM

I would try to boot the machine via UBOOT and NFS first (look at the UBOOT section in the wiki) before flashing a thing. But thanks for the link, it provides some more valuable insight into how to actually build the fw image

Offline

 

#6 2011-04-01 11:36:31

stefanth
Member
Registered: 2010-12-14
Posts: 63

Re: Building a custom ROM

Dlink wrote:

DNS-320 and DNS-325 do not use uClibc anymore. They are using Glibc.

Fonz plug do, and that is where the toolchain is

Offline

 

#7 2011-04-01 11:51:47

stefanth
Member
Registered: 2010-12-14
Posts: 63

Re: Building a custom ROM

mangus wrote:

http://curvedbrain.org/2008/06/09/building-firmware-binary-image-d-link-dns-323/

Interesting page, he had another article, http://curvedbrain.org/2009/03/10/insta … an-dns323/
and this is exactly what I am looking for but for the NAS-320

Offline

 

#8 2011-04-07 11:23:15

stefanth
Member
Registered: 2010-12-14
Posts: 63

Re: Building a custom ROM

Hi

when I execute the build_fw script on my NAS

Code:

chmod 777 build_fw
sed -i 's:sudo::g' build_fw

./build_fw
I get the following error message on ./merge

Code:

...
...
merge/
merge/uRamdisk
merge/DNS320-firmware
merge/merge
merge/default.tar.gz
merge/uImage
merge/image.cfs
./merge: line 1: syntax error: "(" unexpected

On line 1 in the merge file (ELF file) it seems that it is looking for /lib/ld-linux.so.2 but on my NAS-320
this file do not exist but instead /lib/ld-linux.so.3

Have someone encountered this and solved it ?

/Stefan

Last edited by stefanth (2011-04-07 11:27:47)

Offline

 

#9 2011-04-16 15:06:50

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

to build default settings rember it must be x86 32bits envormet  or 64bits envorment with 32bits support other wise u can not build with dlink build envorment
to build the soucre code
type soucre build_fw 

I have manger build my own costumize uImage (kernel) I have not yet figout how to merge it yet.

here is my modify build_fw
# Dlink build envorment it only works on x86 arch (32Bits)

if [ ! -d "arm-none-linux-gnueabi-6xxx" ]; then
   # directory did not exists unpack it
   tar zxvf arm-none-linux-gnueabi-6xxx.tgz
fi

WORKDIR=$(pwd)
export WORKDIR
PATH=${WORKDIR}/arm-none-linux-gnueabi-6xxx/bin:$PATH
export PATH
CC=arm-none-linux-gnueabi-gcc
export CC
export CROSS_COMPILE=arm-none-linux-gnueabi-
CXX=${CROSS_COMPILE}g++
export CXX
RANLIB=arm-none-linux-gnueabi-ranlib
export RANLIB
LD=arm-none-linux-gnueabi-ld
export LD
STRIP=arm-none-linux-gnueabi-strip
export STRIP

# gl setup path to mkimage
if [ ! -d "ramdisk" ]; then
  tar -xzf ramdisk.tgz
fi
PATH=${WORKDIR}/ramdisk:$PATH

# gl extract kernel
if [ ! -d "linux-2.5.22.18" ]; then
  tar -xzf linux-2.6.22.18.tgz
fi

# config our kernel and build it
cd ./linux-2.6.22.18
# make clean
make menuconfig
make modules
make uImage
make
cd ../

# Dlink run merge now
tar zxvf merge.tgz
cd merge
sudo cp ../ramdisk/uRamdisk .
./merge

I do not known where current uImage comes from yet and how to replace it with my new one

Offline

 

#10 2011-04-16 16:33:17

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

I have manger now build a custom kernel and merge it.
I waiting now testing all build settings is okay.
if they are, I have reach the goal I did have.

But if anyone want I can try figout how the *.cfs file works (it is their all packets are store in.
basic idea is figout how to unpack *.cfs and mount it then add you own software.
the URamDisk is basic same as ramdisk at http://curvedbrain.org/2008/06/09/build … k-dns-323/

1. cd ramdisk
2. mv ramdisk_el.gz Ramdisk_el.gz
3. gunzip Ramdisk_el.gz
4. mkdir ramdisk_el
5. sudo mount -o loop Ramdisk_el ./ramdisk_el

now u can do changes to URamdisk images everthing are mounted to ramdisk_el

after u have made changes to it  u need repack it.

I have not comming any futher and that.

Offline

 

#11 2011-04-16 17:22:20

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

I will not post any more build script now. this is my last one.
I tested and flash my dlink with custom kernel settings with this build_fw script


# Dlink build envorment it only works on x86 arch (32Bits)

if [ ! -d "arm-none-linux-gnueabi-6xxx" ]; then
   # directory did not exists unpack it
   tar zxvf arm-none-linux-gnueabi-6xxx.tgz
fi

WORKDIR=$(pwd)
export WORKDIR
PATH=${WORKDIR}/arm-none-linux-gnueabi-6xxx/bin:$PATH
export PATH
CC=arm-none-linux-gnueabi-gcc
export CC
export CROSS_COMPILE=arm-none-linux-gnueabi-
CXX=${CROSS_COMPILE}g++
export CXX
RANLIB=arm-none-linux-gnueabi-ranlib
export RANLIB
LD=arm-none-linux-gnueabi-ld
export LD
STRIP=arm-none-linux-gnueabi-strip
export STRIP

# gl setup path to mkimage
if [ ! -d "ramdisk" ]; then
  tar -xzf ramdisk.tgz
fi
PATH=${WORKDIR}/ramdisk:$PATH

# gl extract kernel
if [ ! -d "linux-2.5.22.18" ]; then
  tar -xzf linux-2.6.22.18.tgz
fi

# config our kernel and build it
cd ./linux-2.6.22.18
sh cv.sh
# make clean
make menuconfig
make
make modules
make uImage
cd ../

# Dlink run merge now
if [ ! -d "merge" ]; then
tar zxvf merge.tgz
fi

if [ ! -f "merge/uImage.org" ]; then
  mv merge/uImage merge/uImage.org
fi

if [ -f "merge/uImage" ]; then
rm merge/uImage
fi

cp linux-2.6.22.18/arch/arm/boot/uImage merge/uImage

cd merge
sudo cp ../ramdisk/uRamdisk .
./merge

Last edited by GreatLord (2011-04-16 17:33:30)

Offline

 

#12 2012-01-16 21:05:23

themaxx32000
New member
Registered: 2012-01-15
Posts: 2

Re: Building a custom ROM

Hi,

I'm also very interested in getting a custom firmware up and running (for ssh and hfsplus-support for example). I've got everything working in ffp environment,but looking for a native solution.

Is there anyone out there who managed to build a ssh enabled custom-fw? I tried to build a custom fw yesterday, but the webinterface won't accept my 'DNS320-firmware' file.

Box is currently running v. 2.02 of D-Links original firmware..

Thanks,

Max

Last edited by themaxx32000 (2012-01-16 21:05:51)

Offline

 

#13 2012-01-17 15:21:18

lentinj
Member
Registered: 2011-09-29
Posts: 5

Re: Building a custom ROM

I have a regular mainline kernel and Debian running on both a DNS-320 and a DNS-325. I'm in the middle of writing this up and publishing another patch, but not finished yet.

Requires a serial cable though, I'm not looking into making something that can be uploaded from the d-link web interface. Is the format of these files known?

Offline

 

#14 2012-02-09 22:52:29

johim
New member
Registered: 2012-02-09
Posts: 3

Re: Building a custom ROM

That sounds interesting!! Cant wait for this to test it on my 320

Offline

 

#15 2012-04-13 22:50:43

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

I am working on setting up a svn at sourcefroge with frimware 2.02 source code for dns-320. it will take few days set it up with my build script and my own code to replace dlink merge program forn dns-320.

If any one want helping with making dlink firmware better and update diffent packet to lates version or other modifcation I can give write access to the svn.

Offline

 

#16 2012-04-14 20:15:16

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

I have create now a sourceforge project with DNS-320 firmware 2.02 at https://sourceforge.net/projects/dns320/
I am commit the source code at moment. My internet connection are not stable for sending up so much source code at time. I am commiting in part.  then config so everthing are rebuild from the source code after that or maybe before I will upload a custom firmware. if anyone is instread helping out let me known.  Any suggetions for the firmware and help I am greatfull.

Offline

 

#17 2012-04-15 03:01:33

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

now all source code is commited.

out of box 
follow is working
1. setting up debian 64 bits envoirm right  run sh setup.sh to get all packet u need, 32bits need comment out the 64bits part
2. to build the kernel type sh build.sh

I have not config how to pack the firmware yet.
the reason is firmware 2.02 is lite diffent against 1.xx firmware.

Offline

 

#18 2012-04-15 14:24:52

GreatLord
Member
Registered: 2011-04-16
Posts: 12

Re: Building a custom ROM

status for https://sourceforge.net/projects/dns320/
1. It build the kernel OK
2. dlink own merge program gone replace with my own, it can extract DNS-320 frimware as well,
3. add build.sh inside merge folder.

left todo figout  how to modify and create image.cfs I need help with that

Offline

 

#19 2012-08-11 17:23:49

machitza
New member
Registered: 2012-08-11
Posts: 3

Re: Building a custom ROM

failed to upload new firmware with new kernel... maybe it's about config.xml in default.tar.gz ?

<config>
        <sw_ver_1>1.00b01</sw_ver_1>
        <sw_ver_2>1.00.0610.2010</sw_ver_2>
        <hw_ver>DNS-320</hw_ver>

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB